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