mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	brute-force killed a bug with toggleImageProportions(...), fixed a trailing '//////' explosion in BASE_URL, minor tweaks and fixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									6bd8782a21
								
							
						
					
					
						commit
						8159a27407
					
				
							
								
								
									
										16
									
								
								ui/TODO.otl
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								ui/TODO.otl
									
									
									
									
									
								
							| @ -90,8 +90,11 @@ Roadmap | |||||||
| 	 | 	 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| [_] 24% Gen 3 current todo | [_] 26% Gen 3 current todo | ||||||
| 	[_] 49% High priority | 	[_] 53% High priority | ||||||
|  | 		BUG: scaling is again broken with rotated images | ||||||
|  | 		| - rotate an image | ||||||
|  | 		| - scale it to 1 (press 1) | ||||||
| 		[_] ASAP: directory selector UI... | 		[_] ASAP: directory selector UI... | ||||||
| 		[_] usable empty view -- w.o. data... | 		[_] usable empty view -- w.o. data... | ||||||
| 		[_] 0% Tablet UI | 		[_] 0% Tablet UI | ||||||
| @ -218,9 +221,6 @@ Roadmap | |||||||
| 			[X] image info | 			[X] image info | ||||||
| 			[X] stub info dialog | 			[X] stub info dialog | ||||||
| 			[_] detailed image info | 			[_] detailed image info | ||||||
| 		[_] 0% gesture support |  | ||||||
| 			[_] up/down - shift |  | ||||||
| 			[_] left/right - navigate |  | ||||||
| 		[_] 0% CSS | 		[_] 0% CSS | ||||||
| 			[_] cleanup | 			[_] cleanup | ||||||
| 			[_] split themes and layout | 			[_] split themes and layout | ||||||
| @ -236,9 +236,11 @@ Roadmap | |||||||
| 			[_] caching config | 			[_] caching config | ||||||
| 		[_] BUG: jumping screen images does not load the adjacent ribbons... | 		[_] BUG: jumping screen images does not load the adjacent ribbons... | ||||||
| 		| positioning is OK but ribbons are not fully visible... | 		| positioning is OK but ribbons are not fully visible... | ||||||
| 		[_] BUG: BASE_URL seems to gain a new trailing '/' on each save... | 		[X] BUG: BASE_URL seems to gain a new trailing '/' on each save... | ||||||
| 		| low priority as this does not affect anything... | 		| low priority as this does not affect anything... | ||||||
| 		[_] start/stop gif animations... | 		[X] 100% gesture support | ||||||
|  | 			[X] up/down - navigate | ||||||
|  | 			[X] left/right - navigate | ||||||
| 		[X] make the marks in single image mode show in corner of viewer, not image | 		[X] make the marks in single image mode show in corner of viewer, not image | ||||||
| 		| and think of a uniform indicator position... | 		| and think of a uniform indicator position... | ||||||
| 		| | 		| | ||||||
|  | |||||||
| @ -982,11 +982,14 @@ function resetToOriginalImage(image){ | |||||||
| /********************************************************* Zooming ***/ | /********************************************************* Zooming ***/ | ||||||
| 
 | 
 | ||||||
| function fitNImages(n, fixed_proportions){ | function fitNImages(n, fixed_proportions){ | ||||||
|  | 	var viewer = $('.viewer') | ||||||
|  | 
 | ||||||
|  | 	viewer.trigger('preFittingImages', [n]) | ||||||
|  | 
 | ||||||
| 	var image = getImage() | 	var image = getImage() | ||||||
| 	var w = image.outerWidth(true) | 	var w = image.outerWidth(true) | ||||||
| 	var h = image.outerHeight(true) | 	var h = image.outerHeight(true) | ||||||
| 
 | 
 | ||||||
| 	var viewer = $('.viewer') |  | ||||||
| 	var W = viewer.innerWidth() | 	var W = viewer.innerWidth() | ||||||
| 	var H = viewer.innerHeight() | 	var H = viewer.innerHeight() | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -401,6 +401,7 @@ Array.prototype.binSearch = function(target, cmp, get){ | |||||||
| // NOTE: changing a base URL will trigger a baseURLChanged event...
 | // NOTE: changing a base URL will trigger a baseURLChanged event...
 | ||||||
| function setBaseURL(url){ | function setBaseURL(url){ | ||||||
| 	var old_url = BASE_URL | 	var old_url = BASE_URL | ||||||
|  | 	url = url.replace(/\/*$/, '/') | ||||||
| 	BASE_URL = url | 	BASE_URL = url | ||||||
| 	$('.viewer').trigger('baseURLChanged', [old_url, url]) | 	$('.viewer').trigger('baseURLChanged', [old_url, url]) | ||||||
| } | } | ||||||
|  | |||||||
| @ -424,6 +424,8 @@ var KEYBOARD_CONFIG = { | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 		// zooming...
 | 		// zooming...
 | ||||||
|  | 		'#1': doc('Fit image', function(){ fitNImages(1) }), | ||||||
|  | 
 | ||||||
| 		'-': doc('Zoom in', function(){ zoomOut() }), | 		'-': doc('Zoom in', function(){ zoomOut() }), | ||||||
| 		'=': doc('Zoom out', function(){ zoomIn() }), | 		'=': doc('Zoom out', function(){ zoomIn() }), | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -104,6 +104,7 @@ function saveLocalStorageSettings(attr){ | |||||||
| function loadLocalStorage(attr){ | function loadLocalStorage(attr){ | ||||||
| 	attr = attr == null ? DATA_ATTR : attr | 	attr = attr == null ? DATA_ATTR : attr | ||||||
| 	var d = loadLocalStorageData(attr) | 	var d = loadLocalStorageData(attr) | ||||||
|  | 	loadLocalStorageBaseURLHistory(attr) | ||||||
| 	setBaseURL(d.base_url) | 	setBaseURL(d.base_url) | ||||||
| 	DATA = d.data | 	DATA = d.data | ||||||
| 	IMAGES = loadLocalStorageImages(attr) | 	IMAGES = loadLocalStorageImages(attr) | ||||||
| @ -113,6 +114,7 @@ function saveLocalStorage(attr){ | |||||||
| 	attr = attr == null ? DATA_ATTR : attr | 	attr = attr == null ? DATA_ATTR : attr | ||||||
| 	saveLocalStorageData(attr) | 	saveLocalStorageData(attr) | ||||||
| 	saveLocalStorageImages(attr) | 	saveLocalStorageImages(attr) | ||||||
|  | 	saveLocalStorageBaseURLHistory() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										11
									
								
								ui/modes.js
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								ui/modes.js
									
									
									
									
									
								
							| @ -120,7 +120,7 @@ var toggleSingleImageMode = createCSSClassToggler( | |||||||
| 		'.viewer',  | 		'.viewer',  | ||||||
| 		'single-image-mode', | 		'single-image-mode', | ||||||
| 		function(action){ | 		function(action){ | ||||||
| 			// prevent reiniting...
 | 			// prevent reentering...
 | ||||||
| 			if(action == toggleSingleImageMode('?')){ | 			if(action == toggleSingleImageMode('?')){ | ||||||
| 				return false | 				return false | ||||||
| 			} | 			} | ||||||
| @ -265,12 +265,21 @@ var toggleImageProportions = createCSSClassToggler( | |||||||
| 			'none', | 			'none', | ||||||
| 			'fit-viewer' | 			'fit-viewer' | ||||||
| 		], | 		], | ||||||
|  | 		function(action){ | ||||||
|  | 			// prevent reentering...
 | ||||||
|  | 			if(action == toggleImageProportions('?')){ | ||||||
|  | 				return false | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
| 		function(action){ | 		function(action){ | ||||||
| 			var image = $('.image') | 			var image = $('.image') | ||||||
| 			var h = image.outerHeight(true) | 			var h = image.outerHeight(true) | ||||||
| 			var w = image.outerWidth(true) | 			var w = image.outerWidth(true) | ||||||
| 
 | 
 | ||||||
| 			// viewer proportions...
 | 			// 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(action == 'fit-viewer'){ | ||||||
| 				var viewer = $('.viewer') | 				var viewer = $('.viewer') | ||||||
| 				var W = viewer.innerWidth() | 				var W = viewer.innerWidth() | ||||||
|  | |||||||
							
								
								
									
										17
									
								
								ui/setup.js
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								ui/setup.js
									
									
									
									
									
								
							| @ -149,7 +149,6 @@ function setupDataBindings(viewer){ | |||||||
| 			rollImages(gr.length, ribbon) | 			rollImages(gr.length, ribbon) | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 		.on('fittingImages', function(evt, n){ | 		.on('fittingImages', function(evt, n){ | ||||||
| 			// load correct amount of images in each ribbon!!!
 | 			// load correct amount of images in each ribbon!!!
 | ||||||
| 			var screen_size = getScreenWidthInImages() | 			var screen_size = getScreenWidthInImages() | ||||||
| @ -168,16 +167,18 @@ function setupDataBindings(viewer){ | |||||||
| 			} | 			} | ||||||
| 
 | 
 | ||||||
| 			// update proportions...
 | 			// update proportions...
 | ||||||
|  | 			// XXX for some magical reason this is stable for un-rotated 
 | ||||||
|  | 			// 		images and does mad things for rotate 90/270 images...
 | ||||||
|  | 			//		...the only thing that is 	
 | ||||||
| 			if(window.PROPORTIONS_RATIO_THRESHOLD != null  | 			if(window.PROPORTIONS_RATIO_THRESHOLD != null  | ||||||
| 					&& toggleSingleImageMode('?') == 'on'){ | 					&& toggleSingleImageMode('?') == 'on'){ | ||||||
| 				var viewer = $('.viewer') |  | ||||||
| 				//var w = getVisibleImageSize('width')
 |  | ||||||
| 				var h = getVisibleImageSize('height') |  | ||||||
| 				//var W = viewer.innerWidth()
 |  | ||||||
| 				var H = viewer.innerHeight() |  | ||||||
| 
 | 
 | ||||||
| 				//var m = Math.min(W/w, H/h)
 | 				var h = getVisibleImageSize('height') | ||||||
| 				var m = H/h | 				var w = getVisibleImageSize('width') | ||||||
|  | 				var H = $('.viewer').innerHeight() | ||||||
|  | 				var W = $('.viewer').innerWidth() | ||||||
|  | 
 | ||||||
|  | 				var m = Math.min(W/w, H/h) | ||||||
| 
 | 
 | ||||||
| 				if(m < PROPORTIONS_RATIO_THRESHOLD){ | 				if(m < PROPORTIONS_RATIO_THRESHOLD){ | ||||||
| 					toggleImageProportions('fit-viewer') | 					toggleImageProportions('fit-viewer') | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user