mirror of https://github.com/espruino/BangleApps
Update calculator - now shows currently active operation
parent
0da2a699e5
commit
3b8c365b0f
|
@ -1,3 +1,4 @@
|
||||||
0.01: New App!
|
0.01: New App!
|
||||||
0.02: fix precision rounding issue + no reset when equals pressed
|
0.02: fix precision rounding issue + no reset when equals pressed
|
||||||
0.03: Support for different screen sizes and touchscreen
|
0.03: Support for different screen sizes and touchscreen
|
||||||
|
0.04: Display current operation on LHS
|
||||||
|
|
|
@ -199,8 +199,7 @@ function doMath(x, y, operator) {
|
||||||
function displayOutput(num) {
|
function displayOutput(num) {
|
||||||
var len;
|
var len;
|
||||||
var minusMarge = 0;
|
var minusMarge = 0;
|
||||||
g.setColor(0);
|
g.setBgColor(0).clearRect(0, 0, g.getWidth(), RESULT_HEIGHT-1);
|
||||||
g.fillRect(0, 0, g.getWidth(), RESULT_HEIGHT-1);
|
|
||||||
g.setColor(-1);
|
g.setColor(-1);
|
||||||
if (num === Infinity || num === -Infinity || isNaN(num)) {
|
if (num === Infinity || num === -Infinity || isNaN(num)) {
|
||||||
// handle division by 0
|
// handle division by 0
|
||||||
|
@ -244,6 +243,10 @@ function displayOutput(num) {
|
||||||
}
|
}
|
||||||
g.setFontAlign(1,0);
|
g.setFontAlign(1,0);
|
||||||
g.drawString(num, g.getWidth()-20, RESULT_HEIGHT/2);
|
g.drawString(num, g.getWidth()-20, RESULT_HEIGHT/2);
|
||||||
|
if (operator) {
|
||||||
|
g.setFont('Vector', 22).setFontAlign(1,0);
|
||||||
|
g.drawString(operator, g.getWidth()-1, RESULT_HEIGHT/2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var wasPressedEquals = false;
|
var wasPressedEquals = false;
|
||||||
var hasPressedNumber = false;
|
var hasPressedNumber = false;
|
||||||
|
|
Loading…
Reference in New Issue