Skip to content

Commit

Permalink
Enhancement (keyboard): Support scrolling to beginning at end, and to…
Browse files Browse the repository at this point in the history
… end from beginning

This improves navigational flow as it should be in line with user expectation. The user should not have to press HOME or END keys to go back to the desired position in the document.

Add support for:
- RIGHT and DOWN arrow keys to go back to beginning when at end
- LEFT and UP arrow keys to go back to end when at beginning
  • Loading branch information
leojonathanoh committed Sep 11, 2021
1 parent d697a1e commit 044fa9a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ Keyboard shortcuts:
|---|---|
| LEFT | Previous image
| RIGHT | Next image
| UP | Previous image (of previous row in tiled view)
| DOWN | Next image (of next row in tiled view)
| UP | Previous image, or previous row in tile mode
| DOWN | Next image, or next row in tile mode
| ENTER | Expand image
| BACKSPACE | Back to tiled view
| BACKSPACE | Back to tile mode
| SPACE | Next image
| ESC | Escape from full screen, or back to tile mode
| `F` | Mode: Full screen
Expand Down
6 changes: 4 additions & 2 deletions webize
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ cat - >> "$indexHtm" <<'EOF'
var setPreviousImageAsActiveImage = function() {
if (activeImageIndex <= 0) {
setActiveImageIndex(0, true);
// Go to end
setActiveImageIndex(images.length - 1, true);
}else {
var imageholder = images[activeImageIndex].parentNode;
var idx = Array.from(imageholder.parentNode.children).indexOf(imageholder); // Wrapper
Expand All @@ -589,7 +590,8 @@ cat - >> "$indexHtm" <<'EOF'
var setNextImageAsActiveImage = function() {
if (activeImageIndex >= images.length - 1) {
setActiveImageIndex(images.length - 1, true);
// Go to start
setActiveImageIndex(0, true);
}else {
var imageholder = images[activeImageIndex].parentNode;
var idx = Array.from(imageholder.parentNode.children).indexOf(imageholder); // Wrapper
Expand Down

0 comments on commit 044fa9a

Please sign in to comment.