increase readability by adding some spaces
parent
99854df4df
commit
ed58557824
|
|
@ -1,13 +1,18 @@
|
|||
{
|
||||
|
||||
const defaultSettings = {
|
||||
loadWidgets : false,
|
||||
textAboveHands : false,
|
||||
shortHrHand : false,
|
||||
show24HourMode : true
|
||||
show24HourMode : false
|
||||
};
|
||||
|
||||
const settings = Object.assign(defaultSettings, require('Storage').readJSON('cc_clock24.json', 1) || {});
|
||||
|
||||
const c={"x":g.getWidth()/2,"y":g.getHeight()/2};
|
||||
const c = {
|
||||
"x": g.getWidth()/2,
|
||||
"y": g.getHeight()/2
|
||||
};
|
||||
|
||||
const zahlpos = (function() {
|
||||
let z = [];
|
||||
|
|
@ -30,8 +35,21 @@ const zahlpos=(function() {
|
|||
const zeiger = function(len, dia, tim) {
|
||||
const x = c.x + Math.cos(tim) * len/2,
|
||||
y = c.y + Math.sin(tim) * len/2,
|
||||
d={"d":3,"x":dia/2*Math.cos(tim+Math.PI/2),"y":dia/2*Math.sin(tim+Math.PI/2)},
|
||||
pol=[c.x-d.x,c.y-d.y,c.x+d.x,c.y+d.y,x+d.x,y+d.y,x-d.x,y-d.y];
|
||||
d = {
|
||||
"d": 3,
|
||||
"x": dia/2 * Math.cos(tim + Math.PI/2),
|
||||
"y": dia/2 * Math.sin(tim + Math.PI/2)
|
||||
},
|
||||
pol = [
|
||||
c.x - d.x,
|
||||
c.y - d.y,
|
||||
c.x + d.x,
|
||||
c.y + d.y,
|
||||
x + d.x,
|
||||
y + d.y,
|
||||
x - d.x,
|
||||
y - d.y
|
||||
];
|
||||
return pol;
|
||||
};
|
||||
|
||||
|
|
@ -47,11 +65,9 @@ const drawHands = function(d) {
|
|||
|
||||
// calculates the position of the minute, second and hour hand
|
||||
h = 2 * Math.PI / numHoursForHourHand * (h + m/60) - Math.PI/2;
|
||||
//more accurate
|
||||
//m=2*Math.PI/60*(m+s/60)-Math.PI/2;
|
||||
m=2*Math.PI/60*(m)-Math.PI/2;
|
||||
|
||||
m = 2 * Math.PI / 60 * m - Math.PI/2;
|
||||
s = 2 * Math.PI / 60 * s - Math.PI/2;
|
||||
|
||||
//g.setColor(1,0,0);
|
||||
const hz = zeiger(settings.shortHrHand? 88 : 100, 5, h);
|
||||
g.fillPoly(hz, true);
|
||||
|
|
@ -163,17 +179,21 @@ Bangle.setUI({
|
|||
Bangle.removeListener('lcdPower', updateState);
|
||||
Bangle.removeListener('lock', updateState);
|
||||
Bangle.removeListener('charging', draw);
|
||||
|
||||
// We clear drawTimout after removing all listeners, because they can add one again
|
||||
if (drawTimeout) clearTimeout(drawTimeout);
|
||||
drawTimeout = undefined;
|
||||
require("widget_utils").show();
|
||||
}
|
||||
});
|
||||
|
||||
// Load widgets if needed, and make them show swipeable
|
||||
if (settings.loadWidgets) {
|
||||
Bangle.loadWidgets();
|
||||
require("widget_utils").swipeOn();
|
||||
} else if (global.WIDGETS) require("widget_utils").hide();
|
||||
} else if (global.WIDGETS) {
|
||||
require("widget_utils").hide();
|
||||
}
|
||||
|
||||
// Stop updates when LCD is off, restart when on
|
||||
Bangle.on('lcdPower', updateState);
|
||||
|
|
@ -183,4 +203,5 @@ Bangle.on('charging', draw); // Immediately redraw when charger (dis)connected
|
|||
updateState();
|
||||
drawScale();
|
||||
draw();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
loadWidgets : false,
|
||||
textAboveHands : false,
|
||||
shortHrHand : false,
|
||||
show24HourMode : true
|
||||
show24HourMode : false
|
||||
}
|
||||
let settings = Object.assign(defaultSettings, require('Storage').readJSON('cc_clock24.json',1) || {});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue