From 02b3b280f88157c8ba07303719af3715864008a0 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Fri, 15 May 2026 20:24:21 +0200 Subject: [PATCH] feat: enable editing from the down button in calc sample --- samples/calc-02/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/samples/calc-02/index.js b/samples/calc-02/index.js index a397d1b..129807d 100644 --- a/samples/calc-02/index.js +++ b/samples/calc-02/index.js @@ -356,7 +356,17 @@ constButton.addEventListener('click', (event) => { leftButton.addEventListener('click', () => {}); -downButton.addEventListener('click', () => {}); +downButton.addEventListener('click', () => { +if (!calc.isEditing && calc.isValidIndex(0)) { + const value = calc.stack[0]; + calc.remove(0); + calc.isEditing = true; + calc.inputValue = calc.formatNumber(value); + render(); + focusInput(); +} +}); + rightButton.addEventListener('click', () => { execute('swap');