mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	some refactoring + fixed ribbon-wide marking undo...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									c5997171e9
								
							
						
					
					
						commit
						2b0ae5c167
					
				| @ -13,6 +13,7 @@ var core = require('features/core') | |||||||
| require('features/base') | require('features/base') | ||||||
| require('features/sort') | require('features/sort') | ||||||
| require('features/tags') | require('features/tags') | ||||||
|  | require('features/marks') | ||||||
| require('features/location') | require('features/location') | ||||||
| require('features/recover') | require('features/recover') | ||||||
| require('features/history') | require('features/history') | ||||||
| @ -26,7 +27,6 @@ require('features/ui-chrome') | |||||||
| require('features/ui-progress') | require('features/ui-progress') | ||||||
| require('features/keyboard') | require('features/keyboard') | ||||||
| require('features/ui-status') | require('features/ui-status') | ||||||
| require('features/ui-marks') |  | ||||||
| require('features/ui-ranges') | require('features/ui-ranges') | ||||||
| require('features/ui-widgets') | require('features/ui-widgets') | ||||||
| require('features/ui-slideshow') | require('features/ui-slideshow') | ||||||
|  | |||||||
| @ -117,15 +117,32 @@ var undoTag = function(action){ | |||||||
| 		// introspection...
 | 		// introspection...
 | ||||||
| 		// XXX should this be a generic predicate???
 | 		// XXX should this be a generic predicate???
 | ||||||
| 		undoable: function(a){ | 		undoable: function(a){ | ||||||
|  | 			// handle ribbon-wide operations...
 | ||||||
|  | 			// NOTE: this is specific to .toggleMark(..)
 | ||||||
|  | 			if(a.args[0] == 'ribbon' && action == 'toggleMark'){ | ||||||
|  | 				a.state = this.markedInRibbon() | ||||||
|  | 				return true | ||||||
|  | 			} | ||||||
|  | 			// skip introspection...
 | ||||||
| 			return a.args.indexOf('?') < 0  | 			return a.args.indexOf('?') < 0  | ||||||
| 				&& a.args.indexOf('??') < 0 }, | 				&& a.args.indexOf('??') < 0 | ||||||
|  | 		}, | ||||||
| 		undo: function(a){ | 		undo: function(a){ | ||||||
|  | 			// restore state...
 | ||||||
|  | 			if(a.state){ | ||||||
|  | 				this[action]('ribbon', 'off') | ||||||
|  | 				this[action](a.state, 'on') | ||||||
|  | 
 | ||||||
|  | 			// reverse state...
 | ||||||
|  | 			} else { | ||||||
| 				this[action].apply(this,  | 				this[action].apply(this,  | ||||||
| 					// XXX is argument handling here too optimistic???
 | 					// XXX is argument handling here too optimistic???
 | ||||||
| 					a.args.map(function(e){  | 					a.args.map(function(e){  | ||||||
| 						return e == 'on' ? 'off'  | 						return e == 'on' ? 'off'  | ||||||
| 							: e == 'off' ? 'on' | 							: e == 'off' ? 'on' | ||||||
| 						: e })) }, | 							: e }))  | ||||||
|  | 			} | ||||||
|  | 		}, | ||||||
| 	} } | 	} } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -223,7 +240,6 @@ var ImageMarkActions = actions.Actions({ | |||||||
| 	// 	Invert marks on current ribbon
 | 	// 	Invert marks on current ribbon
 | ||||||
| 	// 	.toggleMark('ribbon')
 | 	// 	.toggleMark('ribbon')
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// 
 |  | ||||||
| 	toggleMark: ['Mark|Image/Image $mark', | 	toggleMark: ['Mark|Image/Image $mark', | ||||||
| 		undoTag('toggleMark'), | 		undoTag('toggleMark'), | ||||||
| 		makeTagTogglerAction('selected')], | 		makeTagTogglerAction('selected')], | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user