Revert "voldisp: make sure widgets wont draw over volume bar"
This reverts commit fec5eb0804.
master
parent
108a932a58
commit
0b5af5f48e
|
|
@ -4,34 +4,14 @@
|
||||||
if (timeout) {clearTimeout(timeout); timeout=undefined;}
|
if (timeout) {clearTimeout(timeout); timeout=undefined;}
|
||||||
|
|
||||||
if (Bangle.CLOCK) {
|
if (Bangle.CLOCK) {
|
||||||
|
let barWidth = g.getWidth()*volPercent/100;
|
||||||
|
g.
|
||||||
|
setColor(0x0000).fillRect(0,0,g.getWidth(),24).
|
||||||
|
setColor(0xF800).fillRect(0,0,barWidth,19).
|
||||||
|
setColor(0xFFFF).setFont("12x20").setFontAlign(1,-1).
|
||||||
|
drawString("volume",barWidth,1);
|
||||||
|
|
||||||
const WIDGET_UTILS_HIDE = function() {
|
let goAway = ()=>{
|
||||||
//exports.cleanup();
|
|
||||||
if (!global.WIDGETS) return;
|
|
||||||
g.reset(); // reset colors
|
|
||||||
for (var w of global.WIDGETS) {
|
|
||||||
if (w._draw) return; // already hidden
|
|
||||||
w._draw = w.draw;
|
|
||||||
w.draw = () => {};
|
|
||||||
w._area = w.area;
|
|
||||||
w.area = "";
|
|
||||||
if (w.x!=undefined) g.clearRect(w.x,w.y,w.x+w.width-1,w.y+23);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
/// Show any hidden widgets
|
|
||||||
const WIDGET_UTILS_SHOW = function() {
|
|
||||||
//exports.cleanup();
|
|
||||||
if (!global.WIDGETS) return;
|
|
||||||
for (var w of global.WIDGETS) {
|
|
||||||
if (!w._draw) return; // not hidden
|
|
||||||
w.draw = w._draw;
|
|
||||||
w.area = w._area;
|
|
||||||
delete w._draw;
|
|
||||||
delete w._area;
|
|
||||||
w.draw(w);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let isAllWidgetsHidden = true;
|
let isAllWidgetsHidden = true;
|
||||||
if (global.WIDGETS) {
|
if (global.WIDGETS) {
|
||||||
for (var w of global.WIDGETS) {
|
for (var w of global.WIDGETS) {
|
||||||
|
|
@ -41,18 +21,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WIDGET_UTILS_HIDE();
|
|
||||||
let barWidth = g.getWidth()*volPercent/100;
|
|
||||||
g.
|
|
||||||
setColor(0x0000).fillRect(0,0,g.getWidth(),24).
|
|
||||||
setColor(0xF800).fillRect(0,0,barWidth,19).
|
|
||||||
setColor(0xFFFF).setFont("12x20").setFontAlign(1,-1).
|
|
||||||
drawString("volume",barWidth,1);
|
|
||||||
|
|
||||||
let goAway = ()=>{
|
|
||||||
if (!isAllWidgetsHidden) {
|
if (!isAllWidgetsHidden) {
|
||||||
g.reset().clearRect(0,0,g.getWidth(),24);
|
Bangle.drawWidgets();
|
||||||
WIDGET_UTILS_SHOW();
|
|
||||||
} else if (Bangle.uiRedraw) {
|
} else if (Bangle.uiRedraw) {
|
||||||
Bangle.uiRedraw();
|
Bangle.uiRedraw();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -63,5 +33,5 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Bangle.on("musicVolume", onMusicVolume);
|
Bangle.on("musicVolume", onMusicVolume);
|
||||||
//GB({t:"audio",v:66});
|
//GB({t:"audio",v:10});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue