widget_utils - Prevent initial draw clearing on global g

master
Martin Boonk 2022-11-21 00:31:43 +01:00
parent 72265bebff
commit b2965fe4e2
1 changed files with 11 additions and 1 deletions

View File

@ -42,6 +42,10 @@ exports.cleanup = function() {
clearTimeout(exports.hideTimeout); clearTimeout(exports.hideTimeout);
delete exports.hideTimeout; delete exports.hideTimeout;
} }
if (exports.origDraw) {
Bangle.drawWidgets = exports.origDraw;
delete exports.origDraw;
}
} }
/** Put widgets offscreen, and allow them to be swiped /** Put widgets offscreen, and allow them to be swiped
@ -85,7 +89,13 @@ exports.swipeOn = function() {
if (w.area.startsWith("b")) if (w.area.startsWith("b"))
w.area = "t"+w.area.substr(1); w.area = "t"+w.area.substr(1);
} }
Bangle.drawWidgets();
exports.origDraw = Bangle.drawWidgets;
Bangle.drawWidgets = ()=>{
g=og;
exports.origDraw();
g=_g;
};
function anim(dir, callback) { function anim(dir, callback) {
if (exports.animInterval) clearInterval(exports.interval); if (exports.animInterval) clearInterval(exports.interval);