forked from FOSS/BangleApps
clkinfo: repeating selection if menu is empty
parent
964ee01617
commit
1fb5c0433d
|
@ -239,10 +239,15 @@ exports.addInteractive = function(menu, options) {
|
||||||
} else if (lr) {
|
} else if (lr) {
|
||||||
if (menu.length==1) return; // 1 item - can't move
|
if (menu.length==1) return; // 1 item - can't move
|
||||||
oldMenuItem = menu[options.menuA].items[options.menuB];
|
oldMenuItem = menu[options.menuA].items[options.menuB];
|
||||||
|
do {
|
||||||
options.menuA += lr;
|
options.menuA += lr;
|
||||||
if (options.menuA<0) options.menuA = menu.length-1;
|
if (options.menuA<0) options.menuA = menu.length-1;
|
||||||
if (options.menuA>=menu.length) options.menuA = 0;
|
if (options.menuA>=menu.length) options.menuA = 0;
|
||||||
options.menuB = 0;
|
options.menuB = 0;
|
||||||
|
//get the next one if the menu is empty
|
||||||
|
//can happen for dynamic ones (alarms, events)
|
||||||
|
//in the worst case we come back to 0
|
||||||
|
} while(menu[options.menuA].items.length==0);
|
||||||
}
|
}
|
||||||
if (oldMenuItem) {
|
if (oldMenuItem) {
|
||||||
menuHideItem(oldMenuItem);
|
menuHideItem(oldMenuItem);
|
||||||
|
|
Loading…
Reference in New Issue