fix radiateArray when focusing search with extra CMs around

This commit is contained in:
tophf 2020-10-28 11:34:35 +03:00
parent 74364b9d63
commit 4764f91453

View File

@ -902,7 +902,9 @@ onDOMready().then(() => {
// produces [i, i+1, i-1, i+2, i-2, i+3, i-3, ...] // produces [i, i+1, i-1, i+2, i-2, i+3, i-3, ...]
function radiateArray(arr, focalIndex) { function radiateArray(arr, focalIndex) {
const result = [arr[focalIndex]]; const focus = arr[focalIndex];
if (!focus) return arr;
const result = [focus];
const len = arr.length; const len = arr.length;
for (let i = 1; i < len; i++) { for (let i = 1; i < len; i++) {
if (focalIndex + i < len) { if (focalIndex + i < len) {