Skip to content

Commit d7509b5

Browse files
authored
Add haptic feedback conditionally for menu navigation
1 parent 1cac14a commit d7509b5

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

apps/clock_info/lib.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -294,15 +294,15 @@ exports.addInteractive = function(menu, options) {
294294
var oldMenuItem;
295295
if (ud) {
296296
if (menu[options.menuA].items.length==1) return; // 1 item - can't move
297-
Bangle.buzz(30);
297+
if(settings.haptics) Bangle.buzz(30);
298298
oldMenuItem = menu[options.menuA].items[options.menuB];
299299
options.menuB += ud;
300300
if (options.menuB<0) options.menuB = menu[options.menuA].items.length-1;
301301
if (options.menuB>=menu[options.menuA].items.length) options.menuB = 0;
302302
} else if (lr) {
303303
if (menu.length==1) return; // 1 item - can't move
304304
oldMenuItem = menu[options.menuA].items[options.menuB];
305-
Bangle.buzz(44);
305+
if(settings.haptics) Bangle.buzz(44);
306306
do {
307307
options.menuA += lr;
308308
if (options.menuA<0) options.menuA = menu.length-1;
@@ -320,11 +320,7 @@ exports.addInteractive = function(menu, options) {
320320
if (oldMenuItem) {
321321
menuHideItem(oldMenuItem);
322322
oldMenuItem.removeAllListeners("draw");
323-
let name=menu[options.menuA].name;
324-
let formattedName=name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
325-
let menuItem=menu[options.menuA].items[options.menuB]
326-
menuShowItem(menuItem);
327-
// On 2v18+ firmware we can stop other event handlers from being executed since we handled this
323+
menuShowItem(menu[options.menuA].items[options.menuB]);
328324
}
329325
E.stopEventPropagation&&E.stopEventPropagation();
330326
}

0 commit comments

Comments
 (0)