tinyhead: fix the touch handler

pull/3635/head
michele 2024-11-01 17:51:37 +01:00
parent 71f3f69304
commit 9306de32eb
1 changed files with 5 additions and 2 deletions

View File

@ -22,7 +22,8 @@
let helpShown = false; let helpShown = false;
let tapCount = 0; let tapCount = 0;
let centerX, centerY, minuteHandLength, hourHandLength, handOutline; let centerX, centerY, minuteHandLength, hourHandLength, handOutline;
let originalTheme = Object.assign({}, g.theme);
// Open the eyes and schedule the next blink // Open the eyes and schedule the next blink
let blinkOpen = function blinkOpen() { let blinkOpen = function blinkOpen() {
if (blinkTimeout) clearTimeout(blinkTimeout); if (blinkTimeout) clearTimeout(blinkTimeout);
@ -229,13 +230,14 @@
activeEyesNum = disconnectedEyes; activeEyesNum = disconnectedEyes;
} }
Bangle.setUI("clock", { Bangle.setUI({
mode:"custom", mode:"custom",
clock: true, clock: true,
touch: (button, xy) => { touch: (button, xy) => {
// Go direct to feature select in settings on long screen press // Go direct to feature select in settings on long screen press
if (xy.type == 2) { if (xy.type == 2) {
eval(require("Storage").read("tinyheads.settings.js"))(()=> { eval(require("Storage").read("tinyheads.settings.js"))(()=> {
g.setTheme(originalTheme);
E.showMenu(); E.showMenu();
init(); init();
}, true, helpShown); }, true, helpShown);
@ -253,6 +255,7 @@
} }
}, },
remove: function() { remove: function() {
g.setTheme(originalTheme);
// Clear timeouts and listeners for fast loading // Clear timeouts and listeners for fast loading
if (drawTimeout) clearTimeout(drawTimeout); if (drawTimeout) clearTimeout(drawTimeout);
if (blinkTimeout) clearTimeout(blinkTimeout); if (blinkTimeout) clearTimeout(blinkTimeout);