mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	fixed an old bug relating to image proportions, still need to smooth things out a bit...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									893436d9d4
								
							
						
					
					
						commit
						93ffb9bb21
					
				
							
								
								
									
										36
									
								
								ui/TODO.otl
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								ui/TODO.otl
									
									
									
									
									
								
							| @ -108,8 +108,34 @@ Roadmap | ||||
| 	 | ||||
| 
 | ||||
| 
 | ||||
| [_] 28% Gen 3 current todo | ||||
| 	[_] 57% High priority | ||||
| [_] 29% Gen 3 current todo | ||||
| 	[_] 58% High priority | ||||
| 		[_] BUG: zooming vertical images in single image view results in size jumping... | ||||
| 		| Reason: | ||||
| 		| 	This is due to the proportion ratio changing in one step... | ||||
| 		| | ||||
| 		| Solution: | ||||
| 		| 	Make the proportion transition smoothly, at least in two zoom-steps | ||||
| 		[X] BUG: jumping more than one image in single image view messes up scale... | ||||
| 		| | ||||
| 		| Procedure: | ||||
| 		| 	- load: file:///L:/mnt/hdd13 (photo)/NTFS2/media/img/my/work/- 20131122Y.001/DCIM/preview (RAW)/ | ||||
| 		| 	- go to single image mode | ||||
| 		| 	- press 2 | ||||
| 		| 	- go to end | ||||
| 		| 	- press [ until a long jump between vertical and horizontal pics | ||||
| 		| | ||||
| 		| Effect: | ||||
| 		| 	- the size of the images will change | ||||
| 		| | ||||
| 		| Solution: | ||||
| 		| 	moved the proportions mode switch to preFittingImages handler | ||||
| 		| | ||||
| 		| Side-effect: | ||||
| 		| 	vertical images, in horizontal viewer, and vice-versa jump  | ||||
| 		| 	in size a bit when zooming past the threshold... | ||||
| 		| 	the amount of "jump" depends on viewer proportions vs. image | ||||
| 		| 	proportions... | ||||
| 		[X] BUG: appear to be leaking memory on very large sets of images (>8K) | ||||
| 		| don't remember it before, so it might be due to the new  | ||||
| 		| loadImagesAround(..) | ||||
| @ -266,11 +292,11 @@ Roadmap | ||||
| 		| 	- open/history/... | ||||
| 		| 	- sort | ||||
| 		| 	- export | ||||
| 		[_] 50% mark-based operations | ||||
| 			[_] 50% cropping selection | ||||
| 		[_] 55% mark-based operations | ||||
| 			[_] 75% cropping selection | ||||
| 				[X] marked | ||||
| 				[X] ribbon | ||||
| 				[_] by tag/collection | ||||
| 				[X] by tag/collection | ||||
| 				[_] by group | ||||
| 			[X] shift up/down | ||||
| 			[X] tag | ||||
|  | ||||
							
								
								
									
										30
									
								
								ui/data.js
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								ui/data.js
									
									
									
									
									
								
							| @ -660,7 +660,6 @@ function makeGIDBeforeGetterFromList(get_list, restrict_to_ribbon){ | ||||
| 		if(list.length == 0){ | ||||
| 			return null | ||||
| 		} | ||||
| 		console.log('>>>>', ribbon) | ||||
| 		gid = gid == null ? getImageGID(null, ribbon) : gid | ||||
| 		var prev | ||||
| 
 | ||||
| @ -2100,6 +2099,17 @@ function setupData(viewer){ | ||||
| 			rollImages(gr.length, ribbon) | ||||
| 		}) | ||||
| 
 | ||||
| 		.on('preFittingImages', function(evt, n){ | ||||
| 			// update proportions...
 | ||||
| 			if(CONFIG.proportions_ratio_threshold != null  | ||||
| 					&& toggleSingleImageMode('?') == 'on'){ | ||||
| 				if(n <= CONFIG.proportions_ratio_threshold){ | ||||
| 					toggleImageProportions('fit-viewer') | ||||
| 				} else { | ||||
| 					toggleImageProportions('none') | ||||
| 				} | ||||
| 			} | ||||
| 		}) | ||||
| 		.on('fittingImages', function(evt, n){ | ||||
| 			//console.log('!!!! fittingImages')
 | ||||
| 			// load correct amount of images in each ribbon!!!
 | ||||
| @ -2137,24 +2147,6 @@ function setupData(viewer){ | ||||
| 				UI_STATE['ribbon-mode-screen-images'] = n | ||||
| 			} | ||||
| 
 | ||||
| 			// update proportions...
 | ||||
| 			if(CONFIG.proportions_ratio_threshold != null  | ||||
| 					&& toggleSingleImageMode('?') == 'on'){ | ||||
| 
 | ||||
| 				var h = getVisibleImageSize('height') | ||||
| 				var w = getVisibleImageSize('width') | ||||
| 				var H = $('.viewer').innerHeight() | ||||
| 				var W = $('.viewer').innerWidth() | ||||
| 
 | ||||
| 				var m = Math.min(W/w, H/h) | ||||
| 
 | ||||
| 				if(m < CONFIG.proportions_ratio_threshold){ | ||||
| 					toggleImageProportions('fit-viewer') | ||||
| 				} else { | ||||
| 					toggleImageProportions('none') | ||||
| 				} | ||||
| 			} | ||||
| 
 | ||||
| 			// update size classes...
 | ||||
| 			// XXX make thresholds global...
 | ||||
| 			if(n <= 2.5){ | ||||
|  | ||||
							
								
								
									
										83
									
								
								ui/modes.js
									
									
									
									
									
								
							
							
						
						
									
										83
									
								
								ui/modes.js
									
									
									
									
									
								
							| @ -325,28 +325,13 @@ var toggleInlineImageInfo = createCSSClassToggler( | ||||
| 		}) | ||||
| 
 | ||||
| 
 | ||||
| var toggleImageProportions = createCSSClassToggler( | ||||
| 		'.viewer', | ||||
| 		[ | ||||
| 			'none', | ||||
| 			'fit-viewer' | ||||
| 		], | ||||
| 		function(action){ | ||||
| 			// prevent reentering...
 | ||||
| 			if(action == toggleImageProportions('?')){ | ||||
| 				return false | ||||
| 			} | ||||
| 		}, | ||||
| 		function(action){ | ||||
| 			var image = $('.image') | ||||
| function setImageProportions(image, mode){ | ||||
| 	var h = image.outerHeight(true) | ||||
| 	var w = image.outerWidth(true) | ||||
| 	mode = mode == null ? toggleImageProportions('?') : 'square' | ||||
| 	mode = mode == 'fit-viewer' ? 'viewer' : 'squzre'  | ||||
| 
 | ||||
| 			// viewer proportions...
 | ||||
| 			// XXX going into here twice for a rotated 90/270 image will 
 | ||||
| 			// 		set it back to square...
 | ||||
| 			// 		...can't even begin to imagine what can affect this!
 | ||||
| 			if(action == 'fit-viewer'){ | ||||
| 	if(mode == 'viewer'){ | ||||
| 		var viewer = $('.viewer') | ||||
| 		var W = viewer.innerWidth() | ||||
| 		var H = viewer.innerHeight() | ||||
| @ -361,6 +346,66 @@ var toggleImageProportions = createCSSClassToggler( | ||||
| 		correctImageProportionsForRotation(image) | ||||
| 		centerView(null, 'css') | ||||
| 
 | ||||
| 	} else { | ||||
| 		var size = Math.min(w, h) | ||||
| 		image.css({ | ||||
| 			width: size, | ||||
| 			height: size | ||||
| 		}) | ||||
| 
 | ||||
| 		// account for rotation...
 | ||||
| 		correctImageProportionsForRotation(image) | ||||
| 		centerView(null, 'css') | ||||
| 	} | ||||
| 
 | ||||
| 	return image | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| var toggleImageProportions = createCSSClassToggler( | ||||
| 		'.viewer', | ||||
| 		[ | ||||
| 			'none', | ||||
| 			'fit-viewer' | ||||
| 		], | ||||
| 		/* XXX do we need this??? | ||||
| 		function(action){ | ||||
| 			// prevent reentering...
 | ||||
| 			if(action == toggleImageProportions('?')){ | ||||
| 				return false | ||||
| 			} | ||||
| 		}, | ||||
| 		*/ | ||||
| 		function(action){ | ||||
| 			var image = $('.image') | ||||
| 			var h = image.outerHeight(true) | ||||
| 			var w = image.outerWidth(true) | ||||
| 
 | ||||
| 			// viewer proportions...
 | ||||
| 			// XXX going into here twice for a rotated 90/270 image will 
 | ||||
| 			// 		set it back to square...
 | ||||
| 			// 		XXX can't reproduce this error...
 | ||||
| 			if(action == 'fit-viewer'){ | ||||
| 				var viewer = $('.viewer') | ||||
| 				var W = viewer.innerWidth() | ||||
| 				var H = viewer.innerHeight() | ||||
| 
 | ||||
| 				if(W > H){ | ||||
| 					image.css({ | ||||
| 						width: W * h/H, | ||||
| 						height: '', | ||||
| 					}) | ||||
| 				} else { | ||||
| 					image.css({ | ||||
| 						width: '', | ||||
| 						height: H * w/W, | ||||
| 					}) | ||||
| 				} | ||||
| 
 | ||||
| 				// account for rotation...
 | ||||
| 				correctImageProportionsForRotation(image) | ||||
| 				centerView(null, 'css') | ||||
| 
 | ||||
| 			// square proportions...
 | ||||
| 			} else { | ||||
| 				var size = Math.min(w, h) | ||||
|  | ||||
| @ -225,8 +225,8 @@ function getVisibleImageSize(dim){ | ||||
| 
 | ||||
| 
 | ||||
| // Return the number of images that can fit to viewer width...
 | ||||
| function getScreenWidthInImages(size){ | ||||
| 	size = size == null ? getVisibleImageSize() : size | ||||
| function getScreenWidthInImages(size, dim){ | ||||
| 	size = size == null ? getVisibleImageSize(dim) : size | ||||
| 	return $('.viewer').innerWidth() / size | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user