From 305ab3bc6f1e07b9037ba2e0523def385327e5b4 Mon Sep 17 00:00:00 2001 From: Rob Pilling Date: Fri, 26 Apr 2024 18:43:22 +0100 Subject: [PATCH] ctrlpad: regenerate js --- apps/ctrlpad/main.js | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/apps/ctrlpad/main.js b/apps/ctrlpad/main.js index 622e4df80..9aa189c69 100644 --- a/apps/ctrlpad/main.js +++ b/apps/ctrlpad/main.js @@ -109,9 +109,6 @@ var initUI = function () { if (ui) return; - function noop(tap) { - return (this.bg === colour.on.bg) !== tap; - } var controls = [ { text: "BLE", @@ -168,8 +165,22 @@ return !off !== tap; } }, - { text: "B-", cb: noop }, - { text: "B+", cb: noop }, + { + text: "clk", + cb: function (tap) { + if (tap) + Bangle.showClock(), terminateUI(); + return true; + }, + }, + { + text: "lch", + cb: function (tap) { + if (tap) + Bangle.showLauncher(), terminateUI(); + return true; + }, + }, ]; var overlay = new Overlay(); ui = { @@ -178,6 +189,11 @@ }; ui.ctrls.draw(ui.overlay.g2); }; + var terminateUI = function () { + state = 0; + ui === null || ui === void 0 ? void 0 : ui.overlay.hide(); + ui = undefined; + }; var onDrag = (function (e) { var _a, _b; var dragDistance = 30; @@ -210,9 +226,7 @@ ui.overlay.setBottom(g.getHeight()); } else { - state = 0; - ui === null || ui === void 0 ? void 0 : ui.overlay.hide(); - ui = undefined; + terminateUI(); break; } } @@ -244,8 +258,7 @@ if (!ui || bottom_1 <= 0) { clearInterval(upDragAnim); upDragAnim = undefined; - ui === null || ui === void 0 ? void 0 : ui.overlay.hide(); - ui = undefined; + terminateUI(); return; } ui.overlay.setBottom(bottom_1); @@ -284,9 +297,5 @@ ui.ctrls.draw(ui.overlay.g2, ctrl); }; Bangle.prependListener("drag", onDrag); - Bangle.on("lock", function () { - state = 0; - ui === null || ui === void 0 ? void 0 : ui.overlay.hide(); - ui = undefined; - }); + Bangle.on("lock", terminateUI); })();