diff --git a/apps/widclkinfo/widget.js b/apps/widclkinfo/widget.js index ff0d233e7c..7771617c48 100644 --- a/apps/widclkinfo/widget.js +++ b/apps/widclkinfo/widget.js @@ -61,9 +61,8 @@ if (!require("clock_info").loadCount) { // don't load if a clock_info was alread widget_utils.on("hidden", () => { console.log("hidden"); clockInfoMenu.y = -24; - clockInfoMenu.force_blur(); // needs to be here so it doesn't stay the focused color if (clockInfoMenu.focus) { - //clockInfoMenu.force_blur(); + clockInfoMenu.force_blur(); console.log("Forced blur bc hidden"); } }); diff --git a/modules/widget_utils.js b/modules/widget_utils.js index c64c9df2ad..2070d23c77 100644 --- a/modules/widget_utils.js +++ b/modules/widget_utils.js @@ -11,6 +11,7 @@ exports.hide = function() { w.area = ""; if (w.x!=undefined) g.clearRect(w.x,w.y,w.x+w.width-1,w.y+23); } + // TODO: do we need to emit event here too? }; /// Show any hidden widgets @@ -132,11 +133,11 @@ exports.swipeOn = function(autohide) { if (dir>0 && exports.offset>=0) { // fully down stop = true; exports.offset = 0; - exports.emit("shown"); + Bangle.emit("widgets-shown"); } else if (dir<0 && exports.offset<-23) { // fully up stop = true; exports.offset = -24; - exports.emit("hidden"); + Bangle.emit("widgets-hidden"); } if (stop) { clearInterval(exports.animInterval); @@ -158,8 +159,14 @@ exports.swipeOn = function(autohide) { anim(-4); }, exports.autohide); }; - if (ud>0 && exports.offset<0) anim(4, cb); - if (ud<0 && exports.offset>-24) anim(-4); + if (ud>0 && exports.offset<0) { + Bangle.emit("widgets-start-show"); + anim(4, cb); + } + if (ud<0 && exports.offset>-24) { + Bangle.emit("widgets-start-hide"); + anim(-4); + } }; Bangle.on("swipe", exports.swipeHandler); Bangle.drawWidgets();