mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 11:20:09 +00:00 
			
		
		
		
	some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									af839977ba
								
							
						
					
					
						commit
						a731a64346
					
				
							
								
								
									
										45
									
								
								ui/base.js
									
									
									
									
									
								
							
							
						
						
									
										45
									
								
								ui/base.js
									
									
									
									
									
								
							| @ -406,51 +406,6 @@ function rollRibbon(n, ribbon, extend, no_compensate_shift){ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /********************************************************************** |  | ||||||
| * Modes |  | ||||||
| */ |  | ||||||
| 
 |  | ||||||
| // XXX add ability to take all marked images and open them in a separate view...
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| // XXX should we use the createCSSClassToggler for this?
 |  | ||||||
| // XXX revise: does extra stuff...
 |  | ||||||
| function toggleImageProportions(mode){ |  | ||||||
| 	var image = $('.image') |  | ||||||
| 	var h = image.outerHeight(true) |  | ||||||
| 	var w = image.outerWidth(true) |  | ||||||
| 
 |  | ||||||
| 	if(mode == '?'){ |  | ||||||
| 		return h != w ? 'viewer' : 'square' |  | ||||||
| 
 |  | ||||||
| 	// square...
 |  | ||||||
| 	} else if(h != w || mode == 'square'){ |  | ||||||
| 		var size = Math.min(w, h) |  | ||||||
| 		image.css({ |  | ||||||
| 			width: size, |  | ||||||
| 			height: size |  | ||||||
| 		}) |  | ||||||
| 		centerView(null, 'css') |  | ||||||
| 		return 'square' |  | ||||||
| 
 |  | ||||||
| 	// viewer size...
 |  | ||||||
| 	} else { |  | ||||||
| 		var viewer = $('.viewer') |  | ||||||
| 		var W = viewer.innerWidth() |  | ||||||
| 		var H = viewer.innerHeight() |  | ||||||
| 
 |  | ||||||
| 		if(W > H){ |  | ||||||
| 			image.css('width', W * h/H) |  | ||||||
| 		} else { |  | ||||||
| 			image.css('height', H * w/W) |  | ||||||
| 		} |  | ||||||
| 		centerView(null, 'css') |  | ||||||
| 		return 'viewer' |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| /********************************************************************** | /********************************************************************** | ||||||
| * Layout | * Layout | ||||||
| */ | */ | ||||||
|  | |||||||
| @ -314,7 +314,7 @@ body { | |||||||
| // setup... | // setup... | ||||||
| $(function(){ | $(function(){ | ||||||
| 
 | 
 | ||||||
| 	toggleTheme('light') | 	toggleTheme('gray') | ||||||
| 
 | 
 | ||||||
| 	//setElementOrigin($('.ribbon-set'), 'top', 'left') | 	//setElementOrigin($('.ribbon-set'), 'top', 'left') | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										15
									
								
								ui/marks.js
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								ui/marks.js
									
									
									
									
									
								
							| @ -9,7 +9,7 @@ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /********************************************************************** | /********************************************************************** | ||||||
| * Modes | * helpers... | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| function loadMarkedOnlyData(cmp){ | function loadMarkedOnlyData(cmp){ | ||||||
| @ -42,7 +42,13 @@ function loadAllImages(){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| var toggleMarkedOnlyView = createCSSClassToggler('.viewer', 'marked-only-view', | 
 | ||||||
|  | /********************************************************************** | ||||||
|  | * Modes | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | var toggleMarkedOnlyView = createCSSClassToggler('.viewer',  | ||||||
|  | 		'marked-only-view', | ||||||
| 		function(action){ | 		function(action){ | ||||||
| 			if(action == 'on'){ | 			if(action == 'on'){ | ||||||
| 				loadMarkedOnlyData() | 				loadMarkedOnlyData() | ||||||
| @ -52,9 +58,6 @@ var toggleMarkedOnlyView = createCSSClassToggler('.viewer', 'marked-only-view', | |||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| // XXX shifting images and unmarking in this mode do not work correctly...
 | // XXX shifting images and unmarking in this mode do not work correctly...
 | ||||||
| var toggleMarkesView = createCSSClassToggler('.viewer', 'marks-visible', | var toggleMarkesView = createCSSClassToggler('.viewer', 'marks-visible', | ||||||
| 	function(){ | 	function(){ | ||||||
| @ -84,8 +87,6 @@ var toggleMarkesView = createCSSClassToggler('.viewer', 'marks-visible', | |||||||
| * Actions | * Actions | ||||||
| */ | */ | ||||||
| 
 | 
 | ||||||
| // XXX if this unmarks an image in marked-only mode no visible image is 
 |  | ||||||
| // 		going to be current...
 |  | ||||||
| var toggleImageMark = createCSSClassToggler('.current.image', 'marked', | var toggleImageMark = createCSSClassToggler('.current.image', 'marked', | ||||||
| 	function(action){ | 	function(action){ | ||||||
| 		toggleMarkesView('on') | 		toggleMarkesView('on') | ||||||
|  | |||||||
							
								
								
									
										42
									
								
								ui/modes.js
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								ui/modes.js
									
									
									
									
									
								
							| @ -26,12 +26,52 @@ var toggleSingleImageMode = createCSSClassToggler('.viewer', | |||||||
| 
 | 
 | ||||||
| var toggleTheme = createCSSClassToggler('.viewer', | var toggleTheme = createCSSClassToggler('.viewer', | ||||||
| 		[ | 		[ | ||||||
| 			'dark', |  | ||||||
| 			'gray', | 			'gray', | ||||||
|  | 			'dark', | ||||||
| 			'light' | 			'light' | ||||||
| 		]) | 		]) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | // NOTE: this confirmsto the css toggler protocol, but is not implemented 
 | ||||||
|  | // 		via createCSSClassToggler as we do not need to set any classes,
 | ||||||
|  | // 		al least at this point...
 | ||||||
|  | // XXX should we use the createCSSClassToggler for this?
 | ||||||
|  | // XXX revise: does extra stuff...
 | ||||||
|  | function toggleImageProportions(mode){ | ||||||
|  | 	var image = $('.image') | ||||||
|  | 	var h = image.outerHeight(true) | ||||||
|  | 	var w = image.outerWidth(true) | ||||||
|  | 
 | ||||||
|  | 	if(mode == '?'){ | ||||||
|  | 		return h != w ? 'viewer' : 'square' | ||||||
|  | 
 | ||||||
|  | 	// square...
 | ||||||
|  | 	} else if(h != w || mode == 'square'){ | ||||||
|  | 		var size = Math.min(w, h) | ||||||
|  | 		image.css({ | ||||||
|  | 			width: size, | ||||||
|  | 			height: size | ||||||
|  | 		}) | ||||||
|  | 		centerView(null, 'css') | ||||||
|  | 		return 'square' | ||||||
|  | 
 | ||||||
|  | 	// viewer size...
 | ||||||
|  | 	} else { | ||||||
|  | 		var viewer = $('.viewer') | ||||||
|  | 		var W = viewer.innerWidth() | ||||||
|  | 		var H = viewer.innerHeight() | ||||||
|  | 
 | ||||||
|  | 		if(W > H){ | ||||||
|  | 			image.css('width', W * h/H) | ||||||
|  | 		} else { | ||||||
|  | 			image.css('height', H * w/W) | ||||||
|  | 		} | ||||||
|  | 		centerView(null, 'css') | ||||||
|  | 		return 'viewer' | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| /********************************************************************** | /********************************************************************** | ||||||
| * vim:set ts=4 sw=4 :                                                */ | * vim:set ts=4 sw=4 :                                                */ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user