Skip to content

Commit de845be

Browse files
author
Corwin Kerr
committed
widclkinfo: Don't redraw widget if its clock_info is off screen
I think it's okay to not update the clock_info in this case because they are designed to be on screen.
1 parent 4584330 commit de845be

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/widclkinfo/widget.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if (!require("clock_info").loadCount) { // don't load if a clock_info was alread
66
app: "widclkinfo",
77
// Add the dimensions we're rendering to here - these are used to detect taps on the clock info area
88
x: 0,
9-
y: 0, // maybe set offset to initial offset
9+
y: -24, // TODO how know if offscreen to start?
1010
w: 72,
1111
h: 24,
1212
// You can add other information here you want to be passed into 'options' in 'draw'
@@ -16,13 +16,13 @@ if (!require("clock_info").loadCount) { // don't load if a clock_info was alread
1616
// info: data returned from itm.get() containing text/img/etc
1717
// options: options passed into addInteractive
1818
clockInfoInfo = info;
19-
if (WIDGETS["clkinfo"]) {
2019
clockInfoMenu.y = options.y;
20+
if (WIDGETS["clkinfo"] && clockInfoMenu.y > -24) {
2121
WIDGETS["clkinfo"].draw(WIDGETS["clkinfo"]);
22-
console.log("Clock Info was updated, thus drawing widget.");
2322
}
2423
}
2524
});
25+
2626
let clockInfoInfo; // when clockInfoMenu.draw is called we set this up
2727
let draw = function(e) {
2828
clockInfoMenu.x = e.x;

0 commit comments

Comments
 (0)