Skip to content

Commit 2f7df6b

Browse files
author
thyttan
committed
bigclkinfo: fix inital menu position bug
1 parent 81db403 commit 2f7df6b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

apps/bigclkinfo/app.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let clockInfoItems = require("clock_info").load();
1515
// Add the
1616
let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, {
1717
// Add the dimensions we're rendering to here - these are used to detect taps on the clock info area
18-
x : 0, y: 0, w: Bangle.appRect.w, h: Bangle.appRect.h,
18+
x : 0, y: 0, w: Bangle.appRect.w, h: Bangle.appRect.h, app: "bigclkinfo",
1919
// You can add other information here you want to be passed into 'options' in 'draw'
2020
// This function draws the info
2121
draw : (itm, info, options) => {
@@ -33,6 +33,11 @@ let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, {
3333
g.setFont("6x8:2").setFontAlign(0,1).drawString(info.text, midx,options.y+160); // draw the text
3434
}
3535
});
36-
clockInfoMenu.menuA = 0;
37-
if (clockInfoItems[0].items[6]) clockInfoMenu.menuB = 6; // Assume clkinfoclk is at indices (0,6)
38-
setTimeout(clockInfoMenu.redraw,0); // Make sure correct item is set before redraw.
36+
setTimeout(
37+
()=>{
38+
clockInfoMenu.menuA = 0;
39+
if (clockInfoItems[0].items[6]) clockInfoMenu.menuB = 6; // Assume clkinfoclk is at indices (0,6)
40+
clockInfoMenu.redraw()
41+
}, 5
42+
)
43+
E.prependListener("kill", ()=>{clockInfoMenu.menuA = 0; clockInfoMenu.menuB = 6;}) // reset to initial menu state to prepare for next launch.

0 commit comments

Comments
 (0)