From 673912b219722075cff2e16bc4fa7f1a84b95ba0 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 22 Jul 2023 18:41:49 +0300 Subject: [PATCH] more tweaks... Signed-off-by: Alex A. Naanou --- grid-n-view.html | 3 +++ grid-n-view.js | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/grid-n-view.html b/grid-n-view.html index e5aafee..f945168 100644 --- a/grid-n-view.html +++ b/grid-n-view.html @@ -24,7 +24,10 @@ - Can we make this passive??? (i.e. CSS only) - Make more accurate -- align right side to pixel... - Gallery: Spacial navigation (up/down/left/right) + - option: .loop_images (in porgress) - Up/Down: might be a good idea to err slightly to the left +- Gallery: PageUp/PageDown, home/end + allow page navigation +- Gallery: focus nearest visible... - Gallery/Lightbox: Selection of images (space / ctrl-a / ctrl-d / ctrl-i) - Lightbox: show selection marker - Gallery: constructor (list of urls) diff --git a/grid-n-view.js b/grid-n-view.js index 044ed57..6278a76 100644 --- a/grid-n-view.js +++ b/grid-n-view.js @@ -145,6 +145,7 @@ var Gallery = { // options... // + loop_images: true, allow_row_expansion: true, click_to_select: true, @@ -202,6 +203,7 @@ var Gallery = { .replace(/\/[0-9]+px\//, '/') }) }, //*/ + // XXX add .loop_images support... getRow: function(img, direction='current'){ if(['above', 'current', 'below'].includes(img)){ direction = img @@ -252,6 +254,7 @@ var Gallery = { while(e && e.tagName != 'IMG'){ e = e.previousElementSibling } } return row }, + // XXX add .loop_images support... getImage: function(img, direction='current'){ if(['left', 'above', 'current', 'below', 'right'].includes(img)){ direction = img @@ -322,7 +325,9 @@ var Gallery = { var row = this.getRow(cur) var i = row.indexOf(cur) - 1 this.current = row[i < 0 ? - row.length-1 + (this.loop_images ? + row.length-1 + : 0) : i] return this }, right: function(){ @@ -330,7 +335,9 @@ var Gallery = { var row = this.getRow(cur) var i = row.indexOf(cur) + 1 this.current = row[i >= row.length ? - 0 + (this.loop_images ? + 0 + : row.length-1) : i] return this }, up: function(){