mirror of https://github.com/espruino/BangleApps
0.05: fix alignment of clock items caused by 0.04 (fix #2970)
Also move var->let, to stop fast load memory leakspull/2973/head
parent
9eded4cb3c
commit
656b8a275c
|
@ -2,3 +2,4 @@
|
|||
0.02: Use clock_info module as an app
|
||||
0.03: clock_info now uses app name to maintain settings specifically for this clock face
|
||||
0.04: clock_info is loaded before widgets to match other clocks
|
||||
0.05: fix alignment of clock items caused by 0.04 (fix #2970)
|
|
@ -30,16 +30,6 @@ let draw = function() {
|
|||
}, 60000 - (Date.now() % 60000));
|
||||
};
|
||||
|
||||
var R = Bangle.appRect;
|
||||
R.x+=1;
|
||||
R.y+=1;
|
||||
R.x2-=1;
|
||||
R.y2-=1;
|
||||
R.w-=2;
|
||||
R.h-=2;
|
||||
var midX = R.x+R.w/2;
|
||||
var barY = 80;
|
||||
|
||||
let clockInfoDraw = (itm, info, options) => {
|
||||
let texty = options.y+41;
|
||||
g.reset().setFont("7Seg").setColor(g.theme.bg).setBgColor(g.theme.fg);
|
||||
|
@ -52,11 +42,7 @@ let clockInfoDraw = (itm, info, options) => {
|
|||
if (title!="Bangle") g.setFontAlign(1,0).drawString(title.toUpperCase(), options.x+options.w-2, options.y+14);
|
||||
if (g.setFont("7Seg:2").stringWidth(text)+8>options.w) g.setFont("7Seg");
|
||||
g.setFontAlign(0,0).drawString(text, options.x+options.w/2, options.y+40);
|
||||
|
||||
};
|
||||
let clockInfoItems = require("clock_info").load();
|
||||
let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:R.x, y:R.y, w:midX-2, h:barY-R.y-2, draw : clockInfoDraw});
|
||||
let clockInfoMenu2 = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:midX+2, y:R.y, w:midX-3, h:barY-R.y-2, draw : clockInfoDraw});
|
||||
|
||||
// Show launcher when middle button pressed
|
||||
Bangle.setUI({
|
||||
|
@ -76,10 +62,24 @@ Bangle.setUI({
|
|||
}});
|
||||
// Load widgets
|
||||
Bangle.loadWidgets();
|
||||
// Work out sizes
|
||||
let R = Bangle.appRect;
|
||||
R.x+=1;
|
||||
R.y+=1;
|
||||
R.x2-=1;
|
||||
R.y2-=1;
|
||||
R.w-=2;
|
||||
R.h-=2;
|
||||
let midX = R.x+R.w/2;
|
||||
let barY = 80;
|
||||
// Clear the screen once, at startup
|
||||
let oldTheme = g.theme;
|
||||
g.setTheme({bg:"#000",fg:"#fff",dark:true}).clear(1);
|
||||
g.fillRect({x:R.x, y:R.y, w:R.w, h:R.h, r:8}).clearRect(R.x,barY,R.w,barY+1).clearRect(midX,R.y,midX+1,barY);
|
||||
draw();
|
||||
setTimeout(Bangle.drawWidgets,0);
|
||||
}
|
||||
Bangle.drawWidgets();
|
||||
// Allocate and draw clockinfos
|
||||
let clockInfoItems = require("clock_info").load();
|
||||
let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:R.x, y:R.y, w:midX-2, h:barY-R.y-2, draw : clockInfoDraw});
|
||||
let clockInfoMenu2 = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:midX+2, y:R.y, w:midX-3, h:barY-R.y-2, draw : clockInfoDraw});
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{ "id": "lcdclock",
|
||||
"name": "LCD Clock",
|
||||
"version":"0.04",
|
||||
"version":"0.05",
|
||||
"description": "A Casio-style clock, with ClockInfo areas at the top and bottom. Tap them and swipe up/down to toggle between different information",
|
||||
"icon": "app.png",
|
||||
"screenshots": [{"url":"screenshot.png"}],
|
||||
|
|
Loading…
Reference in New Issue