Skip to content

Commit 3182c0f

Browse files
committed
Bangle.js: Modify Bangle.drawWidgets to only clear the areas where widgets actually are, not the whole top&bottom bar (ref espruino/BangleApps#121)
1 parent 9df1c13 commit 3182c0f

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
Bangle.js: Modify handling of widgets to allow variable width widgets (requires new widget JS)
120120
Changed 6x8 builtin font to a modified Dina_r400-6 supporting non-ASCII characters
121121
Bangle.js: Modify E.showMessage/Prompt/Alert to clear the entire screen and redraw widgets (fix #1771)
122+
Bangle.js: Modify Bangle.drawWidgets to only clear the areas where widgets actually are, not the whole top&bottom bar
122123

123124
2v04 : Allow \1..\9 escape codes in RegExp
124125
ESP8266: reading storage is not working for boot from user2 (fix #1507)
Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
(function() {
22
var w=g.getWidth(), h=g.getHeight();
33
var pos = {
4-
tl:{x:32, y:0, r:0}, // if r==1, we're right->left
5-
tr:{x:w-32, y:0, r:1},
6-
bl:{x:32, y:h-24, r:0},
7-
br:{x:w-32, y:h-24, r:1}
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}
88
};
9-
g.reset().clearRect(0,0,w-1,23).clearRect(0,h-24,w-1,h-1);
10-
if (global.WIDGETS) for (var wd of WIDGETS) {
9+
if (global.WIDGETS) {
10+
for (var wd of WIDGETS) {
1111
var p = pos[wd.area];
1212
if (!p) return;
1313
wd.x = p.x - p.r*wd.width;
1414
wd.y = p.y;
1515
p.x += wd.width*(1-2*p.r);
1616
wd.draw(wd);
17+
}
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
20+
for (wd of WIDGETS) wd.draw(wd);
1721
}
1822
})

libs/js/banglejs/Bangle_drawWidgets.min.js

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

0 commit comments

Comments
 (0)