mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	removed legacy/stub code from crop.js...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									9b35627977
								
							
						
					
					
						commit
						655d3ec27c
					
				
							
								
								
									
										64
									
								
								ui/crop.js
									
									
									
									
									
								
							
							
						
						
									
										64
									
								
								ui/crop.js
									
									
									
									
									
								
							| @ -100,6 +100,8 @@ function cropDataTo(gids, keep_ribbons, keep_unloaded_gids){ | |||||||
| 	cur = cur == null ? DATA.ribbons[r][0] : cur | 	cur = cur == null ? DATA.ribbons[r][0] : cur | ||||||
| 	DATA.current = cur  | 	DATA.current = cur  | ||||||
| 
 | 
 | ||||||
|  | 	$('.viewer').addClass('cropped-view') | ||||||
|  | 
 | ||||||
| 	reloadViewer() | 	reloadViewer() | ||||||
| 	updateImages() | 	updateImages() | ||||||
| 
 | 
 | ||||||
| @ -123,6 +125,10 @@ function uncropData(){ | |||||||
| 		DATA.current = cur | 		DATA.current = cur | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	if(!isViewCropped()){ | ||||||
|  | 		$('.viewer').removeClass('cropped-view') | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	reloadViewer() | 	reloadViewer() | ||||||
| 	updateImages() | 	updateImages() | ||||||
| 
 | 
 | ||||||
| @ -144,6 +150,8 @@ function showAllData(){ | |||||||
| 		// keep the current position...
 | 		// keep the current position...
 | ||||||
| 		DATA.current = cur | 		DATA.current = cur | ||||||
| 
 | 
 | ||||||
|  | 		$('.viewer').removeClass('cropped-view') | ||||||
|  | 
 | ||||||
| 		reloadViewer() | 		reloadViewer() | ||||||
| 		updateImages() | 		updateImages() | ||||||
| 	} | 	} | ||||||
| @ -156,63 +164,25 @@ function showAllData(){ | |||||||
| 
 | 
 | ||||||
| // Make a generic crop mode toggler
 | // Make a generic crop mode toggler
 | ||||||
| //
 | //
 | ||||||
| // NOTE: This will add the toggler to CROP_MODES, for use by 
 |  | ||||||
| // 		uncropLastState(...)
 |  | ||||||
| // NOTE: crop modes are exclusive -- it is not possible to enter one crop
 | // NOTE: crop modes are exclusive -- it is not possible to enter one crop
 | ||||||
| // 		mode from a different crop mode
 | // 		mode from a different crop mode
 | ||||||
| //
 | function makeCropModeToggler(crop){ | ||||||
| // XXX add "exclusive" crop option -- prevent other crop modes to enter...
 |  | ||||||
| function makeCropModeToggler(cls, crop){ |  | ||||||
| 	var res = createCSSClassToggler( | 	var res = createCSSClassToggler( | ||||||
| 			'.viewer', | 			'.viewer', | ||||||
| 			//cls + ' cropped-mode',
 | 			'.cropped-view', | ||||||
| 			cls, |  | ||||||
| 			/* XXX make this an option... |  | ||||||
| 			function(action){ |  | ||||||
| 				// prevent mixing marked-only and single-ribbon modes...
 |  | ||||||
| 				if(action == 'on'  |  | ||||||
| 						&& isViewCropped() |  | ||||||
| 						&& res('?') != 'on'){ |  | ||||||
| 					return false |  | ||||||
| 				} |  | ||||||
| 			}, |  | ||||||
| 			*/ |  | ||||||
| 			function(action){ | 			function(action){ | ||||||
| 				if(action == 'on'){ | 				if(action == 'on'){ | ||||||
| 					showStatusQ('Cropping current ribbon...') | 					showStatusQ('Cropping ribbons...') | ||||||
| 					crop() | 					crop() | ||||||
| 				} else { | 				} else { | ||||||
| 					showStatusQ('Uncropping to all data...') | 					showStatusQ('Uncropping all...') | ||||||
| 					showAllData() | 					showAllData() | ||||||
| 				} | 				} | ||||||
| 			}) | 			}) | ||||||
| 	CROP_MODES.push(res) |  | ||||||
| 	return res | 	return res | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // Uncrop to last state and there is no states to uncrop then exit 
 |  | ||||||
| // cropped mode.
 |  | ||||||
| //
 |  | ||||||
| // NOTE: this will exit all crop modes when uncropping the last step.
 |  | ||||||
| function uncropLastState(){ |  | ||||||
| 	// do nothing if we aren't in a crop mode...
 |  | ||||||
| 	if(!isViewCropped()){ |  | ||||||
| 		return |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	// exit cropped all modes...
 |  | ||||||
| 	if(CROP_STACK.length == 1){ |  | ||||||
| 		$.each(CROP_MODES, function(_, e){ e('off') }) |  | ||||||
| 
 |  | ||||||
| 	// ucrop one state...
 |  | ||||||
| 	} else { |  | ||||||
| 		showStatusQ('Uncropping...') |  | ||||||
| 		uncropData() |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| /********************************************************************** | /********************************************************************** | ||||||
| * Modes...  | * Modes...  | ||||||
| @ -222,15 +192,13 @@ function uncropLastState(){ | |||||||
| // 		one single mode...
 | // 		one single mode...
 | ||||||
| // XXX is this a mode???
 | // XXX is this a mode???
 | ||||||
| var toggleSingleRibbonMode = makeCropModeToggler( | var toggleSingleRibbonMode = makeCropModeToggler( | ||||||
| 		'single-ribbon-mode', |  | ||||||
| 		function(){ | 		function(){ | ||||||
| 				cropDataTo(getRibbonGIDs()) | 				cropDataTo(getRibbonGIDs()) | ||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| function makeCurrenAndAboveModeToggler(name, keep_ribbons){ | function makeCurrenAndAboveModeToggler(keep_ribbons){ | ||||||
| 	return makeCropModeToggler( | 	return makeCropModeToggler( | ||||||
| 		name, |  | ||||||
| 		function(){ | 		function(){ | ||||||
| 				var gids = [] | 				var gids = [] | ||||||
| 				var c = getRibbonIndex() | 				var c = getRibbonIndex() | ||||||
| @ -246,10 +214,8 @@ function makeCurrenAndAboveModeToggler(name, keep_ribbons){ | |||||||
| 				cropDataTo(gids, keep_ribbons) | 				cropDataTo(gids, keep_ribbons) | ||||||
| 		}) | 		}) | ||||||
| } | } | ||||||
| var toggleCurrenAndAboveRibbonMode = makeCurrenAndAboveModeToggler( | var toggleCurrenAndAboveRibbonMode = makeCurrenAndAboveModeToggler() | ||||||
| 		'current-and-above-ribbon-mode') | var toggleCurrenAndAboveRibbonsMode = makeCurrenAndAboveModeToggler(true) | ||||||
| var toggleCurrenAndAboveRibbonsMode = makeCurrenAndAboveModeToggler( |  | ||||||
| 		'current-and-above-ribbons-mode', true) |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -273,13 +273,12 @@ var KEYBOARD_CONFIG = { | |||||||
| 			'single ribbon crop view press <b>F3</b> and to open the crop '+ | 			'single ribbon crop view press <b>F3</b> and to open the crop '+ | ||||||
| 			'dialog for more options press <b>C</b>.'+ | 			'dialog for more options press <b>C</b>.'+ | ||||||
| 			'<p>NOTE: toggling crop views is only possible from ribbon view.', | 			'<p>NOTE: toggling crop views is only possible from ribbon view.', | ||||||
| 		pattern: '.single-ribbon-mode:not(.single-image-mode), ' | 		pattern: '.cropped-view:not(.single-image-mode)', | ||||||
| 			+'.marked-only-view:not(.single-image-mode)', |  | ||||||
| 
 | 
 | ||||||
| 		Esc: { | 		Esc: { | ||||||
| 				default: doc('Uncrop to last state',  | 				default: doc('Uncrop to last state',  | ||||||
| 					function(){  | 					function(){  | ||||||
| 						uncropLastState() | 						uncropData() | ||||||
| 						return false | 						return false | ||||||
| 					}), | 					}), | ||||||
| 				shift: doc('Exit crop view',  | 				shift: doc('Exit crop view',  | ||||||
|  | |||||||
| @ -1113,7 +1113,7 @@ button:hover { | |||||||
| .single-image-mode.marks-visible.viewer .context-mode-indicators .current-image-marked:not(.shown):hover { | .single-image-mode.marks-visible.viewer .context-mode-indicators .current-image-marked:not(.shown):hover { | ||||||
|   opacity: 0.8; |   opacity: 0.8; | ||||||
| } | } | ||||||
| .single-ribbon-mode.viewer .global-mode-indicators .single-ribbon-mode { | .cropped-view.viewer .global-mode-indicators .cropped-view { | ||||||
|   color: gray; |   color: gray; | ||||||
|   display: inline-block; |   display: inline-block; | ||||||
| } | } | ||||||
|  | |||||||
| @ -1150,7 +1150,7 @@ button:hover { | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| .single-ribbon-mode.viewer .global-mode-indicators .single-ribbon-mode { | .cropped-view.viewer .global-mode-indicators .cropped-view { | ||||||
| 	color: gray; | 	color: gray; | ||||||
| 	display: inline-block; | 	display: inline-block; | ||||||
| } | } | ||||||
|  | |||||||
							
								
								
									
										6
									
								
								ui/ui.js
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								ui/ui.js
									
									
									
									
									
								
							| @ -97,10 +97,10 @@ function showCursor(elem){ | |||||||
| 
 | 
 | ||||||
| function setupIndicators(){ | function setupIndicators(){ | ||||||
| 	showGlobalIndicator( | 	showGlobalIndicator( | ||||||
| 			'single-ribbon-mode',  | 			'cropped-view',  | ||||||
| 			'Single ribbon mode (F3)') | 			'Cropped view (shift-F2/F3/C/F)') | ||||||
| 		.css('cursor', 'hand') | 		.css('cursor', 'hand') | ||||||
| 		.click(function(){ toggleSingleRibbonMode() }) | 		.click(function(){ uncropData() }) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user