Skip to content

Commit f531aa7

Browse files
committed
Bangle.js: Modify E.showMessage/Prompt/Alert to clear the entire screen and redraw widgets (fix #1771)
1 parent 9c17b44 commit f531aa7

File tree

5 files changed

+13
-23
lines changed

5 files changed

+13
-23
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
Bangle.js: remove graphical_menu lib and inline specialised version into E.showMenu
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
121+
Bangle.js: Modify E.showMessage/Prompt/Alert to clear the entire screen and redraw widgets (fix #1771)
121122

122123
2v04 : Allow \1..\9 escape codes in RegExp
123124
ESP8266: reading storage is not working for boot from user2 (fix #1507)

libs/js/banglejs/E_showMessage.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
(function(msg,title) {
2-
g.reset();
3-
g.clearRect(0,24,239,215); // leave room for widgets
4-
g.setFont("6x8",2);
5-
g.setFontAlign(0,0);
2+
g.clear(1).flip(); // clear screen
3+
Bangle.drawWidgets(); // redraw widgets
4+
g.reset().setFont("6x8",2).setFontAlign(0,0);
65
var loc = require("locale");
76
var W = g.getWidth();
87
var H = g.getHeight();

libs/js/banglejs/E_showMessage.min.js

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

libs/js/banglejs/E_showPrompt.js

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
if (!options.selected)
1212
options.selected = 0;
1313
function draw() {
14-
g.reset();
15-
g.clearRect(0,24,239,215); // leave room for widgets
16-
g.setFont("6x8",2);
17-
g.setFontAlign(0,0);
14+
g.reset().setFont("6x8",2).setFontAlign(0,0);
1815
var W = g.getWidth();
1916
var H = g.getHeight();
2017
var title = options.title;
@@ -47,26 +44,19 @@
4744
x-bw-4,y+8,
4845
x-bw-4,y-8,
4946
x-bw,y-12];
50-
if (idx==options.selected) {
51-
g.setColor(0x02F7);
52-
g.fillPoly(poly);
53-
g.setColor(-1);
54-
}
55-
g.drawPoly(poly);
56-
g.drawString(btn,x,y+1);
47+
g.setColor(idx==options.selected ? 0x02F7 : 0).fillPoly(poly).setColor(-1).drawPoly(poly).drawString(btn,x,y+1);
5748
x += (buttonPadding+w)/2;
5849
});
59-
g.setColor(-1);
60-
g.flip(); // turn screen on
50+
g.setColor(-1).flip(); // turn screen on
6151
}
6252

6353
if (Bangle.btnWatches) {
6454
Bangle.btnWatches.forEach(clearWatch);
6555
Bangle.btnWatches = undefined;
6656
}
57+
g.clear(1); // clear screen
58+
Bangle.drawWidgets(); // redraw widgets
6759
if (!msg) {
68-
g.clearRect(0,24,239,215); // leave room for widgets
69-
g.flip(); // turn screen on
7060
return Promise.resolve();
7161
}
7262
draw();

libs/js/banglejs/E_showPrompt.min.js

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

0 commit comments

Comments
 (0)