feat: add enter key handling to dev sample calculator
This commit is contained in:
@@ -330,7 +330,14 @@
|
|||||||
|
|
||||||
function execute(name) {
|
function execute(name) {
|
||||||
try {
|
try {
|
||||||
if (name === 'swap') {
|
if (name === 'enter') {
|
||||||
|
if (calc.isEditing) {
|
||||||
|
pushEditingValueIfNeeded();
|
||||||
|
} else if (calc.stack.length >= 1) {
|
||||||
|
calc.push(calc.stack[0]);
|
||||||
|
if (calc.stack.length > 4) calc.stack.length = 4;
|
||||||
|
}
|
||||||
|
} else if (name === 'swap') {
|
||||||
pushEditingValueIfNeeded();
|
pushEditingValueIfNeeded();
|
||||||
if (calc.stack.length >= 2) calc.swap(0, 1);
|
if (calc.stack.length >= 2) calc.swap(0, 1);
|
||||||
} else if (name === 'drop') {
|
} else if (name === 'drop') {
|
||||||
|
|||||||
Reference in New Issue
Block a user