more tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-07-22 18:41:49 +03:00
parent 3c7ed59b26
commit 673912b219
2 changed files with 12 additions and 2 deletions

View File

@ -24,7 +24,10 @@
- Can we make this passive??? (i.e. CSS only) - Can we make this passive??? (i.e. CSS only)
- <s>Make more accurate -- align right side to pixel...</s> - <s>Make more accurate -- align right side to pixel...</s>
- <s>Gallery: Spacial navigation (up/down/left/right)</s> - <s>Gallery: Spacial navigation (up/down/left/right)</s>
- <b>option: .loop_images (in porgress)</b>
- Up/Down: might be a good idea to err slightly to the left - 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...
- <s>Gallery/Lightbox: Selection of images (space / ctrl-a / ctrl-d / ctrl-i)</s> - <s>Gallery/Lightbox: Selection of images (space / ctrl-a / ctrl-d / ctrl-i)</s>
- <s>Lightbox: show selection marker</s> - <s>Lightbox: show selection marker</s>
- <b>Gallery: constructor (list of urls)</b> - <b>Gallery: constructor (list of urls)</b>

View File

@ -145,6 +145,7 @@ var Gallery = {
// options... // options...
// //
loop_images: true,
allow_row_expansion: true, allow_row_expansion: true,
click_to_select: true, click_to_select: true,
@ -202,6 +203,7 @@ var Gallery = {
.replace(/\/[0-9]+px\//, '/') }) }, .replace(/\/[0-9]+px\//, '/') }) },
//*/ //*/
// XXX add .loop_images support...
getRow: function(img, direction='current'){ getRow: function(img, direction='current'){
if(['above', 'current', 'below'].includes(img)){ if(['above', 'current', 'below'].includes(img)){
direction = img direction = img
@ -252,6 +254,7 @@ var Gallery = {
while(e && e.tagName != 'IMG'){ while(e && e.tagName != 'IMG'){
e = e.previousElementSibling } } e = e.previousElementSibling } }
return row }, return row },
// XXX add .loop_images support...
getImage: function(img, direction='current'){ getImage: function(img, direction='current'){
if(['left', 'above', 'current', 'below', 'right'].includes(img)){ if(['left', 'above', 'current', 'below', 'right'].includes(img)){
direction = img direction = img
@ -322,7 +325,9 @@ var Gallery = {
var row = this.getRow(cur) var row = this.getRow(cur)
var i = row.indexOf(cur) - 1 var i = row.indexOf(cur) - 1
this.current = row[i < 0 ? this.current = row[i < 0 ?
row.length-1 (this.loop_images ?
row.length-1
: 0)
: i] : i]
return this }, return this },
right: function(){ right: function(){
@ -330,7 +335,9 @@ var Gallery = {
var row = this.getRow(cur) var row = this.getRow(cur)
var i = row.indexOf(cur) + 1 var i = row.indexOf(cur) + 1
this.current = row[i >= row.length ? this.current = row[i >= row.length ?
0 (this.loop_images ?
0
: row.length-1)
: i] : i]
return this }, return this },
up: function(){ up: function(){