diff --git a/apps/scicalc/ChangeLog b/apps/scicalc/ChangeLog index 6cce3743ac..63f2e6fccb 100644 --- a/apps/scicalc/ChangeLog +++ b/apps/scicalc/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Swiping up has now the same effect as hitting the "<" button. +0.03: Use Swipe up/down to switch between screens, left to delete, right to calculate result diff --git a/apps/scicalc/README.md b/apps/scicalc/README.md index fe65823614..aff5e1013e 100644 --- a/apps/scicalc/README.md +++ b/apps/scicalc/README.md @@ -5,7 +5,7 @@ by the JS interpreter. ## Usage -Buttons are arranged on 3 separate screens, swiping left or right switches between them. Swiping down has the same effect as hitting the "=" button. Swiping up has the same effect as hitting the "<" button. +Buttons are arranged on 3 separate screens, swiping up or down switches between them. Swiping right has the same effect as hitting the "=" button. Swiping left has the same effect as hitting the "<" button. ## Features diff --git a/apps/scicalc/app.js b/apps/scicalc/app.js index d3d94bb5f9..6bd8323701 100644 --- a/apps/scicalc/app.js +++ b/apps/scicalc/app.js @@ -70,7 +70,7 @@ function compute() { console.log(processInp(inputStr)); try { res = eval(processInp(inputStr)); } catch(e) { res = "error"; } - inputStr = res === undefined ? '' : res; + inputStr = res === undefined ? '' : res.toString(); qResult = true; updateDisp(inputStr, 19); } @@ -99,7 +99,7 @@ function touchHandler(e, d) { updateDisp(inputStr, 32); } -function swipeHandler(e,d) { +function swipeHandler(d,e) { curPage -= e; if (curPage>buttons.length-1) curPage = 0; if (curPage<0) curPage = buttons.length-1; @@ -112,8 +112,12 @@ function swipeHandler(e,d) { } } -Bangle.on("touch", touchHandler); -Bangle.on("swipe", swipeHandler); -setWatch(() => load(), BTN, { repeat: false, edge: "falling" }); +Bangle.setUI({ + mode : "custom", + touch : touchHandler, + swipe : swipeHandler, + btn : () => load(), +}); + g.clear(); drawPage(curPage); diff --git a/apps/scicalc/metadata.json b/apps/scicalc/metadata.json index f05d97ec58..7dd0e0b681 100644 --- a/apps/scicalc/metadata.json +++ b/apps/scicalc/metadata.json @@ -1,7 +1,7 @@ { "id": "scicalc", "name": "Scientific Calculator", "shortName":"SciCalc", - "version":"0.02", + "version":"0.03", "description": "Scientific calculator", "icon": "scicalc.png", "screenshots" : [ { "url":"scicalc_screenshot1.png" }, { "url":"scicalc_screenshot2.png" }, { "url":"scicalc_screenshot3.png" } ],