Combine logic for forward and backward shift-selects.

master
voussoir 2018-10-20 16:18:02 -07:00
parent 70d0e64309
commit b6890bfd2c
1 changed files with 3 additions and 5 deletions

View File

@ -127,13 +127,11 @@ function on_photo_select(event)
{ {
slice = [current_photo_div]; slice = [current_photo_div];
} }
else if (previous_index < current_index)
{
slice = photo_divs.slice(previous_index, current_index + 1);
}
else else
{ {
slice = photo_divs.slice(current_index, previous_index + 1); var left = Math.min(previous_index, current_index);
var right = Math.max(previous_index, current_index);
slice = photo_divs.slice(left, right + 1);
} }
slice.forEach(action); slice.forEach(action);