ctrlpad: simplify state wrangling

pull/3383/head
Rob Pilling 2024-04-25 12:53:27 +01:00
parent d0897eabe1
commit fd3de13257
1 changed files with 6 additions and 8 deletions

View File

@ -181,10 +181,8 @@
switch (state) {
case State.IgnoreCurrent:
if(e.b === 0){
if(e.b === 0)
state = State.Idle;
ui = undefined;
}
break;
case State.Idle:
@ -196,7 +194,6 @@
}else{
//console.log(" ignoring this drag (too low @ " + e.y + ")");
state = State.IgnoreCurrent;
ui = undefined
}
}
break;
@ -212,12 +209,13 @@
Bangle.prependListener("touch", onTouch);
Bangle.buzz(20);
ui!.overlay.setBottom(g.getHeight());
}else{
//console.log("returning to idle");
state = State.Idle;
ui?.overlay.hide();
ui = undefined;
break;
}
//console.log("returning to idle");
state = State.Idle;
ui?.overlay.hide();
ui = undefined;
}else{
// partial drag, show UI feedback:
const dragOffset = 32;