Skip to content

Commit 0b5af5f

Browse files
author
thyttan
committed
Revert "voldisp: make sure widgets wont draw over volume bar"
This reverts commit fec5eb0.
1 parent 108a932 commit 0b5af5f

File tree

1 file changed

+11
-41
lines changed

1 file changed

+11
-41
lines changed

apps/voldisp/boot.js

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,6 @@
44
if (timeout) {clearTimeout(timeout); timeout=undefined;}
55

66
if (Bangle.CLOCK) {
7-
8-
const WIDGET_UTILS_HIDE = function() {
9-
//exports.cleanup();
10-
if (!global.WIDGETS) return;
11-
g.reset(); // reset colors
12-
for (var w of global.WIDGETS) {
13-
if (w._draw) return; // already hidden
14-
w._draw = w.draw;
15-
w.draw = () => {};
16-
w._area = w.area;
17-
w.area = "";
18-
if (w.x!=undefined) g.clearRect(w.x,w.y,w.x+w.width-1,w.y+23);
19-
}
20-
};
21-
/// Show any hidden widgets
22-
const WIDGET_UTILS_SHOW = function() {
23-
//exports.cleanup();
24-
if (!global.WIDGETS) return;
25-
for (var w of global.WIDGETS) {
26-
if (!w._draw) return; // not hidden
27-
w.draw = w._draw;
28-
w.area = w._area;
29-
delete w._draw;
30-
delete w._area;
31-
w.draw(w);
32-
}
33-
};
34-
35-
let isAllWidgetsHidden = true;
36-
if (global.WIDGETS) {
37-
for (var w of global.WIDGETS) {
38-
if (!w._draw) {
39-
isAllWidgetsHidden = false;
40-
break;
41-
}
42-
}
43-
}
44-
WIDGET_UTILS_HIDE();
457
let barWidth = g.getWidth()*volPercent/100;
468
g.
479
setColor(0x0000).fillRect(0,0,g.getWidth(),24).
@@ -50,9 +12,17 @@
5012
drawString("volume",barWidth,1);
5113

5214
let goAway = ()=>{
15+
let isAllWidgetsHidden = true;
16+
if (global.WIDGETS) {
17+
for (var w of global.WIDGETS) {
18+
if (!w._draw) {
19+
isAllWidgetsHidden = false;
20+
break;
21+
}
22+
}
23+
}
5324
if (!isAllWidgetsHidden) {
54-
g.reset().clearRect(0,0,g.getWidth(),24);
55-
WIDGET_UTILS_SHOW();
25+
Bangle.drawWidgets();
5626
} else if (Bangle.uiRedraw) {
5727
Bangle.uiRedraw();
5828
} else {
@@ -63,5 +33,5 @@
6333
}
6434
};
6535
Bangle.on("musicVolume", onMusicVolume);
66-
//GB({t:"audio",v:66});
36+
//GB({t:"audio",v:10});
6737
}

0 commit comments

Comments
 (0)