ctrlpad: regenerate js

pull/3383/head
Rob Pilling 2024-04-26 18:43:22 +01:00
parent 597ee4c08b
commit 305ab3bc6f
1 changed files with 24 additions and 15 deletions

View File

@ -109,9 +109,6 @@
var initUI = function () { var initUI = function () {
if (ui) if (ui)
return; return;
function noop(tap) {
return (this.bg === colour.on.bg) !== tap;
}
var controls = [ var controls = [
{ {
text: "BLE", text: "BLE",
@ -168,8 +165,22 @@
return !off !== tap; 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(); var overlay = new Overlay();
ui = { ui = {
@ -178,6 +189,11 @@
}; };
ui.ctrls.draw(ui.overlay.g2); 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 onDrag = (function (e) {
var _a, _b; var _a, _b;
var dragDistance = 30; var dragDistance = 30;
@ -210,9 +226,7 @@
ui.overlay.setBottom(g.getHeight()); ui.overlay.setBottom(g.getHeight());
} }
else { else {
state = 0; terminateUI();
ui === null || ui === void 0 ? void 0 : ui.overlay.hide();
ui = undefined;
break; break;
} }
} }
@ -244,8 +258,7 @@
if (!ui || bottom_1 <= 0) { if (!ui || bottom_1 <= 0) {
clearInterval(upDragAnim); clearInterval(upDragAnim);
upDragAnim = undefined; upDragAnim = undefined;
ui === null || ui === void 0 ? void 0 : ui.overlay.hide(); terminateUI();
ui = undefined;
return; return;
} }
ui.overlay.setBottom(bottom_1); ui.overlay.setBottom(bottom_1);
@ -284,9 +297,5 @@
ui.ctrls.draw(ui.overlay.g2, ctrl); ui.ctrls.draw(ui.overlay.g2, ctrl);
}; };
Bangle.prependListener("drag", onDrag); Bangle.prependListener("drag", onDrag);
Bangle.on("lock", function () { Bangle.on("lock", terminateUI);
state = 0;
ui === null || ui === void 0 ? void 0 : ui.overlay.hide();
ui = undefined;
});
})(); })();