feat: enable editing from the down button in calc sample
This commit is contained in:
1 parent
40e1043a03
commit
02b3b280f8
1 file changed
+11
-1
@@ -356,7 +356,17 @@ constButton.addEventListener('click', (event) => {
|
|||||||
|
|
||||||
leftButton.addEventListener('click', () => {});
|
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', () => {
|
rightButton.addEventListener('click', () => {
|
||||||
execute('swap');
|
execute('swap');
|
||||||
|
|||||||
Reference in new issue
Block a user