mirror of https://github.com/espruino/BangleApps
clock_info: add focus and unfocus to item
parent
30d1bc7c4c
commit
8f86d9297b
|
@ -288,10 +288,16 @@ exports.addInteractive = function(menu, options) {
|
|||
options.focus=false;
|
||||
delete Bangle.CLKINFO_FOCUS;
|
||||
options.redraw();
|
||||
const itm = menu[options.menuA].items[options.menuB];
|
||||
if (itm.unfocus) itm.unfocus(options);
|
||||
};
|
||||
const focus = (redraw) => {
|
||||
if (!options.focus) {
|
||||
options.focus=true;
|
||||
Bangle.CLKINFO_FOCUS=true;
|
||||
const itm = menu[options.menuA].items[options.menuB];
|
||||
if (itm.focus) itm.focus(options);
|
||||
}
|
||||
if (redraw) options.redraw();
|
||||
};
|
||||
let touchHandler, lockHandler;
|
||||
|
|
|
@ -15,6 +15,8 @@ declare module ClockInfo {
|
|||
hide(options: InteractiveOptions): void,
|
||||
on(what: "redraw", cb: () => void): void, // extending from Object
|
||||
run?(options: InteractiveOptions): void,
|
||||
focus?(options: InteractiveOptions): void,
|
||||
unfocus?(options: InteractiveOptions): void,
|
||||
} & (
|
||||
{
|
||||
hasRange: true,
|
||||
|
|
Loading…
Reference in New Issue