From b2965fe4e2883b958b4cb8242c8cca9361146d60 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Mon, 21 Nov 2022 00:31:43 +0100 Subject: [PATCH] widget_utils - Prevent initial draw clearing on global g --- modules/widget_utils.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/widget_utils.js b/modules/widget_utils.js index 9e25a1981..c674cfdf7 100644 --- a/modules/widget_utils.js +++ b/modules/widget_utils.js @@ -42,6 +42,10 @@ exports.cleanup = function() { clearTimeout(exports.hideTimeout); delete exports.hideTimeout; } + if (exports.origDraw) { + Bangle.drawWidgets = exports.origDraw; + delete exports.origDraw; + } } /** Put widgets offscreen, and allow them to be swiped @@ -85,7 +89,13 @@ exports.swipeOn = function() { if (w.area.startsWith("b")) 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) { if (exports.animInterval) clearInterval(exports.interval);