fix : x (clear) is working

This commit is contained in:
karthik 2025-07-28 16:45:42 +05:30
parent aa1471e89c
commit c5edb09cd0

View File

@ -240,13 +240,16 @@ export class TouchPadMenuComponent implements OnInit {
enterPadVal(key: string) {
if (!this.numericPadEnabled) return;
if (/[0-9]/.test(key)) this.padValue += key;
else if (key === 'X') this.padValue += 'X';
if (key === 'X') {
this.padValue = ''; // Clear the pad value
} else if (/[0-9]/.test(key)) {
this.padValue += key; // Append numeric key
}
this.updateCanPrint();
const value = parseFloat(this.padValue);
if (!isNaN(value)) {
const value = parseFloat(this.padValue) || 0;
this.selectionService.updatePartial({
value,
isBoxed: this.isBoxed,
@ -254,7 +257,6 @@ export class TouchPadMenuComponent implements OnInit {
numbers: [...this.selectedNumbers]
});
}
}
updateCanPrint() {
this.canPrint = this.padValue.trim().length > 0 && /^[0-9]+$/.test(this.padValue);