Skip to content

Commit 292f7d0

Browse files
committed
Tweaks to prev. commit, ref: espruino/BangleApps#121
1 parent b9d6e22 commit 292f7d0

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
(function() {
22
var w=g.getWidth(), h=g.getHeight();
33
var pos = {
4-
tl:{x:28, y:0, r:0}, // if r==1, we're right->left
5-
tr:{x:w-28, y:0, r:1},
6-
bl:{x:24, y:h-24, r:0},
7-
br:{x:w-24, y:h-24, r:1}
4+
tl:{x:28, y:0, r:0, c:0}, // if r==1, we're right->left
5+
tr:{x:w-28, y:0, r:1, c:0},
6+
bl:{x:24, y:h-24, r:0, c:0},
7+
br:{x:w-24, y:h-24, r:1, c:0}
88
};
99
if (global.WIDGETS) {
1010
for (var wd of WIDGETS) {
@@ -13,10 +13,14 @@
1313
wd.x = p.x - p.r*wd.width;
1414
wd.y = p.y;
1515
p.x += wd.width*(1-2*p.r);
16+
p.c++;
1617
wd.draw(wd);
1718
}
18-
g.reset().clearRect(0,0,pos.tl.x,23).clearRect(0,h-24,pos.bl.x,h-1); // left
19-
g.clearRect(pos.tr.x,0,w-1,23).clearRect(pos.br.x,h-24,w-1,h-1); // right
19+
g.reset();
20+
if (pos.tl.c) g.clearRect(0,0,pos.tl.x,23);
21+
if (pos.bl.c) g.clearRect(0,h-24,pos.bl.x,h-1);
22+
if (pos.tr.c) g.clearRect(pos.tr.x,0,w-1,23);
23+
if (pos.br.c) g.clearRect(pos.br.x,h-24,w-1,h-1);
2024
for (wd of WIDGETS) wd.draw(wd);
2125
}
2226
})

libs/js/banglejs/Bangle_drawWidgets.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)