mirror of https://github.com/espruino/BangleApps
Merge branch 'master' of github.com:espruino/BangleApps
commit
6d58146dee
|
@ -4,3 +4,4 @@
|
||||||
0.04: Display current operation on LHS
|
0.04: Display current operation on LHS
|
||||||
0.05: Grid positioning and swipe controls to switch between numbers, operators and special (for Bangle.js 2)
|
0.05: Grid positioning and swipe controls to switch between numbers, operators and special (for Bangle.js 2)
|
||||||
0.06: Bangle.js 2: Exit with a short press of the physical button
|
0.06: Bangle.js 2: Exit with a short press of the physical button
|
||||||
|
0.07: Bangle.js 2: Exit by pressing upper left corner of the screen
|
||||||
|
|
|
@ -12,12 +12,20 @@ Basic calculator reminiscent of MacOs's one. Handy for small calculus.
|
||||||
|
|
||||||
## Controls
|
## Controls
|
||||||
|
|
||||||
|
Bangle.js 1
|
||||||
- UP: BTN1
|
- UP: BTN1
|
||||||
- DOWN: BTN3
|
- DOWN: BTN3
|
||||||
- LEFT: BTN4
|
- LEFT: BTN4
|
||||||
- RIGHT: BTN5
|
- RIGHT: BTN5
|
||||||
- SELECT: BTN2
|
- SELECT: BTN2
|
||||||
|
|
||||||
|
Bangle.js 2
|
||||||
|
- Swipes to change visible buttons
|
||||||
|
- Click physical button to exit
|
||||||
|
- Press upper left corner of screen to exit (where the red back button would be)
|
||||||
## Creator
|
## Creator
|
||||||
|
|
||||||
<https://twitter.com/fredericrous>
|
<https://twitter.com/fredericrous>
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
[thyttan](https://github.com/thyttan)
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
*
|
*
|
||||||
* Original Author: Frederic Rousseau https://github.com/fredericrous
|
* Original Author: Frederic Rousseau https://github.com/fredericrous
|
||||||
* Created: April 2020
|
* Created: April 2020
|
||||||
|
*
|
||||||
|
* Contributors: thyttan https://github.com/thyttan
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g.clear();
|
g.clear();
|
||||||
|
@ -402,38 +404,42 @@ if (process.env.HWVERSION==1) {
|
||||||
swipeEnabled = false;
|
swipeEnabled = false;
|
||||||
drawGlobal();
|
drawGlobal();
|
||||||
} else { // touchscreen?
|
} else { // touchscreen?
|
||||||
setWatch(_ => {load();}, BTN1, {edge:'falling'}); // Exit with a short press to physical button
|
selected = "NONE";
|
||||||
selected = "NONE";
|
|
||||||
swipeEnabled = true;
|
swipeEnabled = true;
|
||||||
prepareScreen(numbers, numbersGrid, COLORS.DEFAULT);
|
prepareScreen(numbers, numbersGrid, COLORS.DEFAULT);
|
||||||
prepareScreen(operators, operatorsGrid, COLORS.OPERATOR);
|
prepareScreen(operators, operatorsGrid, COLORS.OPERATOR);
|
||||||
prepareScreen(specials, specialsGrid, COLORS.SPECIAL);
|
prepareScreen(specials, specialsGrid, COLORS.SPECIAL);
|
||||||
drawNumbers();
|
drawNumbers();
|
||||||
Bangle.on('touch',(n,e)=>{
|
|
||||||
for (var key in screen) {
|
Bangle.setUI({
|
||||||
if (typeof screen[key] == "undefined") break;
|
mode : 'custom',
|
||||||
var r = screen[key].xy;
|
back : load, // Clicking physical button or pressing upper left corner turns off (where red back button would be)
|
||||||
if (e.x>=r[0] && e.y>=r[1] &&
|
touch : (n,e)=>{
|
||||||
e.x<r[2] && e.y<r[3]) {
|
for (var key in screen) {
|
||||||
//print("Press "+key);
|
if (typeof screen[key] == "undefined") break;
|
||||||
buttonPress(""+key);
|
var r = screen[key].xy;
|
||||||
|
if (e.x>=r[0] && e.y>=r[1] && e.x<r[2] && e.y<r[3]) {
|
||||||
|
//print("Press "+key);
|
||||||
|
buttonPress(""+key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
swipe : (LR, UD) => {
|
||||||
|
if (LR == 1) { // right
|
||||||
|
drawSpecials();
|
||||||
|
}
|
||||||
|
if (LR == -1) { // left
|
||||||
|
drawOperators();
|
||||||
|
}
|
||||||
|
if (UD == 1) { // down
|
||||||
|
drawNumbers();
|
||||||
|
}
|
||||||
|
if (UD == -1) { // up
|
||||||
|
drawNumbers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Bangle.on('swipe', (LR, UD) => {
|
|
||||||
if (LR == 1) { // right
|
|
||||||
drawSpecials();
|
|
||||||
}
|
|
||||||
if (LR == -1) { // left
|
|
||||||
drawOperators();
|
|
||||||
}
|
|
||||||
if (UD == 1) { // down
|
|
||||||
drawNumbers();
|
|
||||||
}
|
|
||||||
if (UD == -1) { // up
|
|
||||||
drawNumbers();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
displayOutput(0);
|
displayOutput(0);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"id": "calculator",
|
"id": "calculator",
|
||||||
"name": "Calculator",
|
"name": "Calculator",
|
||||||
"shortName": "Calculator",
|
"shortName": "Calculator",
|
||||||
"version": "0.06",
|
"version": "0.07",
|
||||||
"description": "Basic calculator reminiscent of MacOs's one. Handy for small calculus.",
|
"description": "Basic calculator reminiscent of MacOs's one. Handy for small calculus.",
|
||||||
"icon": "calculator.png",
|
"icon": "calculator.png",
|
||||||
"screenshots": [{"url":"screenshot_calculator.png"}],
|
"screenshots": [{"url":"screenshot_calculator.png"}],
|
||||||
|
|
Loading…
Reference in New Issue