promenu: pull out touch handler

master
Rob Pilling 2025-07-23 20:06:02 +01:00
parent 7b5a7afb06
commit febeda3375
1 changed files with 8 additions and 6 deletions

View File

@ -257,6 +257,13 @@ E.showMenu = ((items?: Menu): MenuInstance | void => {
else l.select(evt); else l.select(evt);
}; };
const touchcb = ((_button, xy) => {
// since we've specified options.touch,
// we need to pass through all taps since the default
// touchHandler isn't installed in setUI
cb(void 0, xy);
}) satisfies TouchCallback;
Bangle.setUI({ Bangle.setUI({
mode: "updown", mode: "updown",
back: back as () => void, back: back as () => void,
@ -265,12 +272,7 @@ E.showMenu = ((items?: Menu): MenuInstance | void => {
Bangle.removeListener("swipe", onSwipe); Bangle.removeListener("swipe", onSwipe);
options.remove?.(); options.remove?.();
}, },
touch: ((_button, xy) => { touch: touchcb,
// since we've specified options.touch,
// we need to pass through all taps since the default
// touchHandler isn't installed in setUI
cb(void 0, xy);
}) satisfies TouchCallback,
} as SetUIArg<"updown">, cb); } as SetUIArg<"updown">, cb);
return l; return l;