So just to be clear: you want to use showScroller/showMenu as-is, with drag up/down to select, but then you want to be able to swap between menus by swiping left and right?
That seems to be your plan in something like showMenu.js?
I think the issue is that Bangle.setUI (which is used in turn by E.showMenu/E.showScroller) is intended to be used when you're displaying a full-screen UI. It keeps track of all the swipe/drag/buttons events and the next time it's called it removes the old ones and calls the remove handler (if supplied).
In a way that's not actually what you want, because you want your swipe handler to run in addition to showScroller/etc.
So I'd just define the handler outside of setUI, like:
function swipeHandler(lr,up) {
// calls showMenu1/2/3() depending on swipe
}
Bangle.on('swipe', swipeHandler); // this swipe handler won't get removed by setUI
function showMenu1() {
E.showMenu(...)
}
function showMenu2() {
E.showScroller(...)
}
and now regardless of what menus you go between, it'll always be active
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi!
So just to be clear: you want to use showScroller/showMenu as-is, with drag up/down to select, but then you want to be able to swap between menus by swiping left and right?
That seems to be your plan in something like
showMenu.js
?I think the issue is that
Bangle.setUI
(which is used in turn by E.showMenu/E.showScroller) is intended to be used when you're displaying a full-screen UI. It keeps track of all the swipe/drag/buttons events and the next time it's called it removes the old ones and calls theremove
handler (if supplied).In a way that's not actually what you want, because you want your swipe handler to run in addition to showScroller/etc.
So I'd just define the handler outside of setUI, like:
and now regardless of what menus you go between, it'll always be active