From 04d8f9ea8de1ab593804887ec763f12eeb05e190 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 25 Jul 2023 21:57:18 +0300 Subject: [PATCH] better navigation (testing) + image number indicator in lightbox... Signed-off-by: Alex A. Naanou --- grid-n-view.html | 19 +++++++++------ grid-n-view.js | 63 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/grid-n-view.html b/grid-n-view.html index 80bcd80..9419283 100644 --- a/grid-n-view.html +++ b/grid-n-view.html @@ -20,19 +20,22 @@

ToDo

+- Lightbox: indicators: 
+	- start/end (a-la ImageGrid.Viewer)
+	- next/prev
+	- count
+	- selection
 - Gallery: Adaptable image justification in grid
 	- Can we make this passive??? (i.e. CSS only)
 	- Make more accurate -- align right side to pixel...
 - Gallery: Spacial navigation (up/down/left/right)
-	- do auto focus current image iff the gallery is visible
-		- handle focus (???)
-	- option: .loop_images (in porgress)
-	- non-looping: indicate start/end (a-la ImageGrid.Viewer)
-	- Up/Down: might be a good idea to err slightly to the left
-	- might be a good idea to select an image based on longest border 
-	  instead of closest center (current)...
+	- auto focus current image iff the gallery is visible
+		- handle focus / tabindex (???)
+	- option: .loop_images
+	- Up/Down: might be a good idea to select an image based on 
+	  longest border instead of closest center (current)...
 - Gallery: PageUp/PageDown, home/end + allow page navigation
-- Gallery: focus visible (if no current)...
+- Gallery: focus visible (if no current and partially scrolled)...
 - 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 5559064..6ad42c7 100644
--- a/grid-n-view.js
+++ b/grid-n-view.js
@@ -166,6 +166,34 @@ var Gallery = {
 
 	click_to_select: true,
 
+	// Mode to select the above/below image...
+	//
+	// 					 	   	   
+	// 		     - -----+-------------+
+	// 					|	   .	  |
+	// 					|   current	  |
+	// 					|	   .	  |
+	// 		- --+-------+---.---+--.--+
+	// 			|		.	    |  .  |			
+	// 			|	    B	    |  A  |			
+	// 			|		.	    |  .  |			
+	// 		- --+---------------+-----+
+	// 			 		^   ^      ^
+	// 			 		c   i      c   			
+	//
+	// Here, A has the closest center (c) to current but B has the closest 
+	// center of intersection (i), thus the two approaches will yield 
+	// different results, moving down from current:
+	// 		current ----(center)----> A
+	// 		current -(intersection)-> B
+	//
+	// can be:
+	// 	'intersection'	- closest center of intersecting part to center 
+	// 						of current image.
+	// 	'center'		- closest center of image to current image center
+	// XXX remove this when/if the selected options feels natural...
+	vertical_navigate_mode: 'intersection',
+
 
 	code: `