mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	updated journalling -- needs testing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									d183e7621c
								
							
						
					
					
						commit
						0e14635281
					
				| @ -1802,6 +1802,7 @@ module.CropActions = actions.Actions({ | |||||||
| 	// 		...after we remove images from a crop we lose their containing 
 | 	// 		...after we remove images from a crop we lose their containing 
 | ||||||
| 	// 		ribbon information and the order might get messed up by 
 | 	// 		ribbon information and the order might get messed up by 
 | ||||||
| 	// 		horizontal shifting if not undone correctly...
 | 	// 		horizontal shifting if not undone correctly...
 | ||||||
|  | 	// 		...add a way to store additional info in the journal...
 | ||||||
| 	// XXX undo -- .removeFromCrop(..) but only the gids that were 
 | 	// XXX undo -- .removeFromCrop(..) but only the gids that were 
 | ||||||
| 	// 		actually added... (???)
 | 	// 		actually added... (???)
 | ||||||
| 	addToCrop: ['- Crop/', | 	addToCrop: ['- Crop/', | ||||||
| @ -1865,7 +1866,14 @@ module.CropActions = actions.Actions({ | |||||||
| 		}], | 		}], | ||||||
| 	// XXX undo -- need containing ribbon info per gid to undo correctly...
 | 	// XXX undo -- need containing ribbon info per gid to undo correctly...
 | ||||||
| 	removeFromCrop: ['Crop|Image/Remove from crop', | 	removeFromCrop: ['Crop|Image/Remove from crop', | ||||||
| 		{browseMode: 'uncrop'}, | 		core.doc` | ||||||
|  | 		`,
 | ||||||
|  | 		{ | ||||||
|  | 			browseMode: 'uncrop', | ||||||
|  | 			// XXX group gid - ribbon
 | ||||||
|  | 			//getUndoState: function(data){ },
 | ||||||
|  | 			//undo: function(data){},
 | ||||||
|  | 		}, | ||||||
| 		function(gids){ | 		function(gids){ | ||||||
| 			var that = this | 			var that = this | ||||||
| 			if(!this.cropped){ | 			if(!this.cropped){ | ||||||
|  | |||||||
| @ -620,6 +620,11 @@ module.Util = ImageGridFeatures.Feature({ | |||||||
| // XXX need to define a clear journaling strategy in the lines of:
 | // XXX need to define a clear journaling strategy in the lines of:
 | ||||||
| // 		- save state clears journal and adds a state load action
 | // 		- save state clears journal and adds a state load action
 | ||||||
| // 		- .load(..) clears journal
 | // 		- .load(..) clears journal
 | ||||||
|  | // XXX need a way to store additional info in the journal...
 | ||||||
|  | // 		can either be done as: 
 | ||||||
|  | // 			- a hook (action handler and/or attr)
 | ||||||
|  | // 			- inline code inside the action...
 | ||||||
|  | //		can't say I like #2 as it will mess the code up...
 | ||||||
| // XXX needs careful testing...
 | // XXX needs careful testing...
 | ||||||
| var JournalActions = actions.Actions({ | var JournalActions = actions.Actions({ | ||||||
| 
 | 
 | ||||||
| @ -638,6 +643,10 @@ var JournalActions = actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 	journalable: null, | 	journalable: null, | ||||||
| 
 | 
 | ||||||
|  | 	// XXX doc supported attrs:
 | ||||||
|  | 	// 		undo
 | ||||||
|  | 	// 		undoable
 | ||||||
|  | 	//		getUndoState
 | ||||||
| 	// XXX should the action have control over what gets journaled and how???
 | 	// XXX should the action have control over what gets journaled and how???
 | ||||||
| 	updateJournalableActions: ['System/Update list of journalable actions', | 	updateJournalableActions: ['System/Update list of journalable actions', | ||||||
| 		function(){ | 		function(){ | ||||||
| @ -665,6 +674,12 @@ var JournalActions = actions.Actions({ | |||||||
| 						return | 						return | ||||||
| 					} | 					} | ||||||
| 
 | 
 | ||||||
|  | 					// get additional undo state...
 | ||||||
|  | 					var update = that.getActionAttr(action, 'getUndoState') | ||||||
|  | 					update  | ||||||
|  | 						&& update instanceof Function | ||||||
|  | 						&& update.call(that, data) | ||||||
|  | 
 | ||||||
| 					// journal after the action is done...
 | 					// journal after the action is done...
 | ||||||
| 					return function(){ this.journalPush(data) } | 					return function(){ this.journalPush(data) } | ||||||
| 				} | 				} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user