mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	moved the hidden ribbon skip code from a high level event handler to low level centerRibbons(..)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									ec82d1985c
								
							
						
					
					
						commit
						e20e457061
					
				| @ -703,17 +703,38 @@ function centerRibbon(ribbon, image, mode){ | ||||
| 
 | ||||
| 
 | ||||
| // a shorthand...
 | ||||
| function centerRibbons(mode, no_skip_current){ | ||||
| function centerRibbons(mode, no_skip_current, no_skip_hidden){ | ||||
| 	var R = $('.viewer').height()/2 | ||||
| 	var cur = getImage() | ||||
| 	var h = cur.height() | ||||
| 
 | ||||
| 	return $('.ribbon') | ||||
| 		.each(function(){  | ||||
| 			var ribbon = $(this) | ||||
| 
 | ||||
| //			// skip empty ribbons...
 | ||||
| //			if($(this).find('.image').length == 0){
 | ||||
| //				return
 | ||||
| //			}
 | ||||
| 			if(no_skip_current == true && $(this).find('.current.image').length > 0){ | ||||
| 
 | ||||
| 			// skip ribbon containing current image...
 | ||||
| 			if(no_skip_current == true && ribbon.find('.current.image').length > 0){ | ||||
| 				return | ||||
| 			} | ||||
| 			centerRibbon($(this), null, mode)  | ||||
| 
 | ||||
| 			// skip ribbons outside of the viewer...
 | ||||
| 			// NOTE: we are accounting for position relative to image... 
 | ||||
| 			// NOTE: we need to factor in image height as the distance is 
 | ||||
| 			// 		between cleanly ribbon centers will mean that half 
 | ||||
| 			// 		hidden ribbons will not get updated...
 | ||||
| 			if(no_skip_hidden != true){ | ||||
| 				var d = Math.abs(getRelativeVisualPosition(cur, ribbon).top) | ||||
| 				if( d - h/2 >= R ){ | ||||
| 					return | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
| 			centerRibbon(ribbon, null, mode)  | ||||
| 		}) | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -95,16 +95,17 @@ function setupDataBindings(viewer){ | ||||
| 				return  | ||||
| 			} | ||||
| 
 | ||||
| 			/* NOTE: this is not really needed as we are skipping this stuff  | ||||
| 			// 		in centerRibbons(...)
 | ||||
| 			// skip the whole thing if the ribbon is not visible, i.e. outside
 | ||||
| 			// of viewer area...
 | ||||
| 			// NOTE: we are accounting for position relative to image... 
 | ||||
| 			// NOTE: we do not need to account for image height because 
 | ||||
| 			// 		of origin and vertical-align... (check)
 | ||||
| 			var R = $('.viewer').height()/2 | ||||
| 			var h = image.height() | ||||
| 			var d = Math.abs(getRelativeVisualPosition(image, ribbon).top) | ||||
| 			if( d >= R ){ | ||||
| 			if( d - h/2 >= R ){ | ||||
| 				return | ||||
| 			} | ||||
| 			*/ | ||||
| 
 | ||||
| 			/* NOTE: this is commented out as it is not really needed now | ||||
| 			 * 		uncomment if a need arises... | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user