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;
|
options.focus=false;
|
||||||
delete Bangle.CLKINFO_FOCUS;
|
delete Bangle.CLKINFO_FOCUS;
|
||||||
options.redraw();
|
options.redraw();
|
||||||
|
const itm = menu[options.menuA].items[options.menuB];
|
||||||
|
if (itm.unfocus) itm.unfocus(options);
|
||||||
};
|
};
|
||||||
const focus = (redraw) => {
|
const focus = (redraw) => {
|
||||||
options.focus=true;
|
if (!options.focus) {
|
||||||
Bangle.CLKINFO_FOCUS=true;
|
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();
|
if (redraw) options.redraw();
|
||||||
};
|
};
|
||||||
let touchHandler, lockHandler;
|
let touchHandler, lockHandler;
|
||||||
|
|
|
@ -15,6 +15,8 @@ declare module ClockInfo {
|
||||||
hide(options: InteractiveOptions): void,
|
hide(options: InteractiveOptions): void,
|
||||||
on(what: "redraw", cb: () => void): void, // extending from Object
|
on(what: "redraw", cb: () => void): void, // extending from Object
|
||||||
run?(options: InteractiveOptions): void,
|
run?(options: InteractiveOptions): void,
|
||||||
|
focus?(options: InteractiveOptions): void,
|
||||||
|
unfocus?(options: InteractiveOptions): void,
|
||||||
} & (
|
} & (
|
||||||
{
|
{
|
||||||
hasRange: true,
|
hasRange: true,
|
||||||
|
|
Loading…
Reference in New Issue