From c5edb09cd0c07e9982ce2202a2950c827873b7e9 Mon Sep 17 00:00:00 2001 From: karthik Date: Mon, 28 Jul 2025 16:45:42 +0530 Subject: [PATCH] fix : x (clear) is working --- .../touch-pad-menu.component.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts index 77a964f..08df19c 100755 --- a/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts +++ b/btc-UI/src/app/components/touch-pad-menu/touch-pad-menu.component.ts @@ -240,20 +240,22 @@ 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)) { - this.selectionService.updatePartial({ - value, - isBoxed: this.isBoxed, - label: this.selectedLabel || '', - numbers: [...this.selectedNumbers] - }); - } + const value = parseFloat(this.padValue) || 0; + this.selectionService.updatePartial({ + value, + isBoxed: this.isBoxed, + label: this.selectedLabel || '', + numbers: [...this.selectedNumbers] + }); } updateCanPrint() { @@ -400,4 +402,4 @@ export class TouchPadMenuComponent implements OnInit { this.closeFieldModal(); } } -} +} \ No newline at end of file