ctrlpad: inline activate/deactivate

pull/3383/head
Rob Pilling 2023-08-28 12:18:50 +01:00
parent 5e8cdc3a16
commit 56d9111e79
1 changed files with 9 additions and 16 deletions

View File

@ -146,7 +146,11 @@
console.log("topdrag stopped, distance: " + (e.y - startY));
if(e.y > startY + dragDistance){
console.log("activating");
activate();
state = State.Active;
startY = 0;
Bangle.prependListener("touch", onTouch);
Bangle.buzz(20);
overlay!.setBottom(g.getHeight());
break;
}
console.log("returning to idle");
@ -186,10 +190,12 @@
overlay = undefined;
return;
}
overlay?.setBottom(bottom)
overlay?.setBottom(bottom);
bottom -= 10;
}, 50)
deactivate();
Bangle.removeListener("touch", onTouch);
state = State.Idle;
}
break;
}
@ -200,19 +206,6 @@
// TODO: button presses
}) satisfies TouchCallback;
const activate = () => {
state = State.Active;
startY = 0;
Bangle.prependListener("touch", onTouch);
Bangle.buzz(20);
overlay!.setBottom(g.getHeight());
};
const deactivate = () => {
Bangle.removeListener("touch", onTouch);
state = State.Idle;
};
Bangle.prependListener("drag", onDrag);
WIDGETS["hid"] = {