mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	some cleanup and minor stuff...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									f0a3aa3d20
								
							
						
					
					
						commit
						d3dc661868
					
				| @ -209,6 +209,7 @@ function relativeVisualPosition(outer, inner){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // This appears to work well with scaling... | // This appears to work well with scaling... | ||||||
|  | // XXX make this more configurable... | ||||||
| function centerImage(image, mode){ | function centerImage(image, mode){ | ||||||
| 	if(mode == null){ | 	if(mode == null){ | ||||||
| 		//mode = 'css' | 		//mode = 'css' | ||||||
| @ -218,14 +219,15 @@ function centerImage(image, mode){ | |||||||
| 		image = $('.current.image') | 		image = $('.current.image') | ||||||
| 	} | 	} | ||||||
| 	var viewer = $('.viewer') | 	var viewer = $('.viewer') | ||||||
|  | 	// XXX should these be "inner"??? | ||||||
| 	var W = viewer.innerWidth() | 	var W = viewer.innerWidth() | ||||||
| 	var H = viewer.innerHeight() | 	var H = viewer.innerHeight() | ||||||
| 
 | 
 | ||||||
| 	var ribbons = $('.ribbon-set') | 	var ribbons = $('.ribbon-set') | ||||||
| 	var scale = getElementScale(ribbons) | 	var scale = getElementScale(ribbons) | ||||||
| 	// NOTE: these are scalable, this need to get normalized... | 	// NOTE: these are scalable, this need to get normalized... | ||||||
| 	var w = image.width()*scale | 	var w = image.outerWidth()*scale | ||||||
| 	var h = image.height()*scale | 	var h = image.outerHeight()*scale | ||||||
| 
 | 
 | ||||||
| 	var pos = relativeVisualPosition(viewer, image) | 	var pos = relativeVisualPosition(viewer, image) | ||||||
| 
 | 
 | ||||||
| @ -242,6 +244,20 @@ function centerImage(image, mode){ | |||||||
| 	}) | 	}) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | function fitNImages(n){ | ||||||
|  | 	var image = $('.current.image') | ||||||
|  | 	var size = image.outerHeight(true) | ||||||
|  | 
 | ||||||
|  | 	var viewer = $('.viewer') | ||||||
|  | 	var W = viewer.innerWidth() | ||||||
|  | 	var H = viewer.innerHeight() | ||||||
|  | 
 | ||||||
|  | 	var scale = Math.min(W / (size * n), H / size) | ||||||
|  | 
 | ||||||
|  | 	setElementScale($('.ribbon-set'), scale) | ||||||
|  | 	centerImage(image, 'css') | ||||||
|  | } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -253,6 +269,9 @@ function clickHandler(evt){ | |||||||
| 		focusImage(img)) | 		focusImage(img)) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| // setup... | // setup... | ||||||
| $(function(){ | $(function(){ | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user