Fix typo that meant that watches on buttons from E.showMenu/etc weren't removed like they should be

master
Gordon Williams 2022-04-27 09:28:16 +01:00
parent 9d8769e80f
commit e6eb8b0cb4
1 changed files with 8 additions and 8 deletions

View File

@ -138,15 +138,15 @@ function Layout(layout, options) {
} }
// enough physical buttons // enough physical buttons
let btnHeight = Math.floor(Bangle.appRect.h / this.physBtns); let btnHeight = Math.floor(Bangle.appRect.h / this.physBtns);
if (Bangle.btnWatch) Bangle.btnWatch.forEach(clearWatch); if (Bangle.btnWatches) Bangle.btnWatches.forEach(clearWatch);
Bangle.btnWatch = []; Bangle.btnWatches = [];
if (this.physBtns > 2 && buttons.length==1) if (this.physBtns > 2 && buttons.length==1)
buttons.unshift({label:""}); // pad so if we have a button in the middle buttons.unshift({label:""}); // pad so if we have a button in the middle
while (this.physBtns > buttons.length) while (this.physBtns > buttons.length)
buttons.push({label:""}); buttons.push({label:""});
if (buttons[0]) Bangle.btnWatch.push(setWatch(pressHandler.bind(this,0), BTN1, {repeat:true,edge:-1})); if (buttons[0]) Bangle.btnWatches.push(setWatch(pressHandler.bind(this,0), BTN1, {repeat:true,edge:-1}));
if (buttons[1]) Bangle.btnWatch.push(setWatch(pressHandler.bind(this,1), BTN2, {repeat:true,edge:-1})); if (buttons[1]) Bangle.btnWatches.push(setWatch(pressHandler.bind(this,1), BTN2, {repeat:true,edge:-1}));
if (buttons[2]) Bangle.btnWatch.push(setWatch(pressHandler.bind(this,2), BTN3, {repeat:true,edge:-1})); if (buttons[2]) Bangle.btnWatches.push(setWatch(pressHandler.bind(this,2), BTN3, {repeat:true,edge:-1}));
this._l.width = g.getWidth()-8; // text width this._l.width = g.getWidth()-8; // text width
this._l = {type:"h", filly:1, c: [ this._l = {type:"h", filly:1, c: [
this._l, this._l,
@ -190,9 +190,9 @@ function Layout(layout, options) {
} }
Layout.prototype.remove = function (l) { Layout.prototype.remove = function (l) {
if (Bangle.btnWatch) { if (Bangle.btnWatches) {
Bangle.btnWatch.forEach(clearWatch); Bangle.btnWatches.forEach(clearWatch);
delete Bangle.btnWatch; delete Bangle.btnWatches;
} }
if (Bangle.touchHandler) { if (Bangle.touchHandler) {
Bangle.removeListener("touch",Bangle.touchHandler); Bangle.removeListener("touch",Bangle.touchHandler);