Skip to content

Commit d9313a3

Browse files
committed
Another bugfix for arrow keys
Issue #6
1 parent eb6902f commit d9313a3

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

InteractiveHtmlBom/ibom.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ function populateBomHeader() {
207207

208208
function populateBomBody() {
209209
highlightHandlers = [];
210+
currentHighlightedRowId = null;
210211
var first = true;
211212
switch (canvaslayout) {
212213
case 'F':
@@ -283,16 +284,16 @@ function populateBomBody() {
283284
function highlightPreviousRow() {
284285
if (!currentHighlightedRowId) {
285286
highlightHandlers[highlightHandlers.length - 1].handler();
286-
return;
287-
}
288-
if (highlightHandlers.length > 1 &&
289-
highlightHandlers[0].id == currentHighlightedRowId) {
290-
highlightHandlers[highlightHandlers.length - 1].handler();
291287
} else {
292-
for (var i = 0; i < highlightHandlers.length - 1; i++) {
293-
if (highlightHandlers[i + 1].id == currentHighlightedRowId) {
294-
highlightHandlers[i].handler();
295-
break;
288+
if (highlightHandlers.length > 1 &&
289+
highlightHandlers[0].id == currentHighlightedRowId) {
290+
highlightHandlers[highlightHandlers.length - 1].handler();
291+
} else {
292+
for (var i = 0; i < highlightHandlers.length - 1; i++) {
293+
if (highlightHandlers[i + 1].id == currentHighlightedRowId) {
294+
highlightHandlers[i].handler();
295+
break;
296+
}
296297
}
297298
}
298299
}
@@ -306,16 +307,16 @@ function highlightPreviousRow() {
306307
function highlightNextRow() {
307308
if (!currentHighlightedRowId) {
308309
highlightHandlers[0].handler();
309-
return;
310-
}
311-
if (highlightHandlers.length > 1 &&
312-
highlightHandlers[highlightHandlers.length - 1].id == currentHighlightedRowId) {
313-
highlightHandlers[0].handler();
314310
} else {
315-
for (var i = 1; i < highlightHandlers.length; i++) {
316-
if (highlightHandlers[i - 1].id == currentHighlightedRowId) {
317-
highlightHandlers[i].handler();
318-
break;
311+
if (highlightHandlers.length > 1 &&
312+
highlightHandlers[highlightHandlers.length - 1].id == currentHighlightedRowId) {
313+
highlightHandlers[0].handler();
314+
} else {
315+
for (var i = 1; i < highlightHandlers.length; i++) {
316+
if (highlightHandlers[i - 1].id == currentHighlightedRowId) {
317+
highlightHandlers[i].handler();
318+
break;
319+
}
319320
}
320321
}
321322
}

0 commit comments

Comments
 (0)