diff --git a/libs/js/banglejs/Bangle_setUI_Q3.js b/libs/js/banglejs/Bangle_setUI_Q3.js index 3a30c43a96..f30f22b09c 100644 --- a/libs/js/banglejs/Bangle_setUI_Q3.js +++ b/libs/js/banglejs/Bangle_setUI_Q3.js @@ -52,7 +52,7 @@ Bangle.on('drag',Bangle.dragHandler); Bangle.touchHandler = d => {b();cb();}; Bangle.btnWatches = [ - setWatch(function() { b();cb(); }, BTN1, {repeat:1, edge:"falling"}), + setWatch(function() { b();cb(); }, BTN1, {repeat:1, edge:"rising"}), ]; } else if (mode=="leftright") { var dx = 0; @@ -68,12 +68,12 @@ Bangle.on('drag',Bangle.dragHandler); Bangle.touchHandler = d => {b();cb();}; Bangle.btnWatches = [ - setWatch(function() { b();cb(); }, BTN1, {repeat:1, edge:"falling"}), + setWatch(function() { b();cb(); }, BTN1, {repeat:1, edge:"rising"}), ]; } else if (mode=="clock") { Bangle.CLOCK=1; Bangle.btnWatches = [ - setWatch(Bangle.showLauncher, BTN1, {repeat:1,edge:"falling"}) + setWatch(Bangle.showLauncher, BTN1, {repeat:1,edge:"rising"}) ]; } else if (mode=="clockupdown") { Bangle.CLOCK=1; @@ -82,31 +82,37 @@ b();cb((e.y > 88) ? 1 : -1); }; Bangle.btnWatches = [ - setWatch(Bangle.showLauncher, BTN1, {repeat:1,edge:"falling"}) + setWatch(Bangle.showLauncher, BTN1, {repeat:1,edge:"rising"}) ]; } else if (mode=="custom") { - if (options.clock) Bangle.CLOCK=1; - if (options.touch) - Bangle.touchHandler = options.touch; - if (options.drag) { - Bangle.dragHandler = options.drag; - Bangle.on("drag", Bangle.dragHandler); - } - if (options.swipe) { - Bangle.swipeHandler = options.swipe; - Bangle.on("swipe", Bangle.swipeHandler); - } - if (options.btn) { - Bangle.btnWatches = [ - setWatch(function() { options.btn(1); }, BTN1, {repeat:1,edge:"falling"}) - ]; - } else if (options.clock) { - Bangle.btnWatches = [ - setWatch(Bangle.showLauncher, BTN1, {repeat:1,edge:"falling"}) - ]; - } } else throw new Error("Unknown UI mode "+E.toJS(mode)); + if (options.clock) Bangle.CLOCK=1; + if (options.touch) + Bangle.touchHandler = options.touch; + if (options.drag) { + Bangle.dragHandler = options.drag; + Bangle.on("drag", Bangle.dragHandler); + } + if (options.swipe) { + Bangle.swipeHandler = options.swipe; + Bangle.on("swipe", Bangle.swipeHandler); + } + if (options.btn) { + if (Bangle.btnWatches) Bangle.btnWatches.forEach(clearWatch); + var e = "rising"; + if ("object"==typeof options.btn) { + e = options.btn.edge; + options.btn = options.btn.fn; + } + Bangle.btnWatches = [ + setWatch(function() { options.btn(1); }, BTN1, {repeat:1,edge:e}) + ]; + } else if (options.clock) { + Bangle.btnWatches = [ + setWatch(Bangle.showLauncher, BTN1, {repeat:1,edge:"rising"}) + ]; + } if (options.remove) // handler for removing the UI (intervals/etc) Bangle.uiRemove = options.remove; if (options.redraw) // handler for redrawing the UI @@ -133,7 +139,7 @@ btnWatch = setWatch(function() { btnWatch = undefined; options.back(); - }, BTN1, {edge:"falling"}); + }, BTN1, {edge:"rising"}); WIDGETS = Object.assign({back:{ area:"tl", width:24, draw:e=>g.reset().setColor("#f00").drawImage(atob("GBiBAAAYAAH/gAf/4A//8B//+D///D///H/P/n+H/n8P/n4f/vwAP/wAP34f/n8P/n+H/n/P/j///D///B//+A//8Af/4AH/gAAYAA=="),e.x,e.y),