mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	refactored marks/kb...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									582c95d3d9
								
							
						
					
					
						commit
						fb0fed655d
					
				| @ -396,15 +396,17 @@ module.GLOBAL_KEYBOARD = { | |||||||
| 
 | 
 | ||||||
| 		// metadata...
 | 		// metadata...
 | ||||||
| 		I: 'showMetadata', | 		I: 'showMetadata', | ||||||
| 		ctrl_shift_I: 'showMetadata: "current" "full" -- Show full metadata', | 		//ctrl_shift_I: 'showMetadata: "current" "full" -- Show full metadata',
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 		// marking...
 | 		// marking...
 | ||||||
| 		M: 'toggleMark', | 		M: 'toggleMark', | ||||||
| 		ctrl_A: 'toggleMark!: "ribbon" "on" -- Mark all images in ribbon', | 		ctrl_A: 'markRibbon!', | ||||||
| 		ctrl_shift_A: 'toggleMarkBlock!', | 		ctrl_shift_A: 'markLoaded!', | ||||||
| 		ctrl_D: 'toggleMark!: "ribbon" "off" -- Unmark all images in ribbon', | 		ctrl_D: 'unmarkRibbon!', | ||||||
| 		ctrl_I: 'invertRibbonMarks', | 		ctrl_shift_D: 'unmarkLoaded!', | ||||||
|  | 		ctrl_I: 'toggleMarkRibbon!', | ||||||
|  | 		ctrl_shift_I: 'toggleMarkBlock!', | ||||||
| 		',': 'prevMarked', | 		',': 'prevMarked', | ||||||
| 		'.': 'nextMarked', | 		'.': 'nextMarked', | ||||||
| 		alt_M: 'browseActions: "/Mark/" -- Mark menu...', | 		alt_M: 'browseActions: "/Mark/" -- Mark menu...', | ||||||
|  | |||||||
| @ -88,21 +88,22 @@ function makeTagTogglerAction(tag){ | |||||||
| 			var on = [] | 			var on = [] | ||||||
| 			var off = [] | 			var off = [] | ||||||
| 			target = _getTarget.call(this, target) | 			target = _getTarget.call(this, target) | ||||||
| 			target.forEach(function(t){ | 			target | ||||||
| 				if((that.data.getTags(t).indexOf(tag) < 0)  | 				.forEach(function(gid){ | ||||||
| 						// invert check if action is '!'...
 | 					if((that.data.getTags(gid).indexOf(tag) < 0)  | ||||||
| 						+ (action == '!' ? -1 : 0)){ | 							// invert check if action is '!'...
 | ||||||
| 					on.push(tag) | 							+ (action == '!' ? -1 : 0)){ | ||||||
| 					res.push('on') | 						on.push(gid) | ||||||
|  | 						res.push('on') | ||||||
| 
 | 
 | ||||||
| 				} else { | 					} else { | ||||||
| 					off.push(tag) | 						off.push(gid) | ||||||
| 					res.push('off') | 						res.push('off') | ||||||
| 				} | 					} | ||||||
| 			}) | 				}) | ||||||
| 
 | 
 | ||||||
| 			that.tag(t, on) | 			that.tag(tag, on) | ||||||
| 			that.untag(t, off) | 			that.untag(tag, off) | ||||||
| 
 | 
 | ||||||
| 			return res.length == 1 ? res[0] : res | 			return res.length == 1 ? res[0] : res | ||||||
| 		} | 		} | ||||||
| @ -221,6 +222,11 @@ var ImageMarkActions = actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 	// a shorthand...
 | 	// a shorthand...
 | ||||||
| 	// NOTE: this will return a copy...
 | 	// NOTE: this will return a copy...
 | ||||||
|  | 	//
 | ||||||
|  | 	// XXX should we add a caching scheme here???
 | ||||||
|  | 	// 		...it would require invalidation on tagging...
 | ||||||
|  | 	// 		the problem is that on large sets this may take up quite a 
 | ||||||
|  | 	// 		chunk of memory...
 | ||||||
| 	get marked(){ | 	get marked(){ | ||||||
| 		if(this.data == null  | 		if(this.data == null  | ||||||
| 				|| this.data.tags == null | 				|| this.data.tags == null | ||||||
| @ -315,7 +321,7 @@ var ImageMarkEditActions = actions.Actions({ | |||||||
| 	toggleMark: ['Mark|Image/Image $mark', | 	toggleMark: ['Mark|Image/Image $mark', | ||||||
| 		undoTag('toggleMark'), | 		undoTag('toggleMark'), | ||||||
| 		makeTagTogglerAction('selected')], | 		makeTagTogglerAction('selected')], | ||||||
| 	toggleMarkBlock: ['Mark/Mark $block', | 	toggleMarkBlock: ['Mark/Invert $block marks', | ||||||
| 		core.doc`A block is a set of adjacent images either marked on unmarked
 | 		core.doc`A block is a set of adjacent images either marked on unmarked
 | ||||||
| 		in the same way | 		in the same way | ||||||
| 		`,
 | 		`,
 | ||||||
| @ -355,18 +361,15 @@ var ImageMarkEditActions = actions.Actions({ | |||||||
| 			// do the marking...
 | 			// do the marking...
 | ||||||
| 			return this.toggleMark(block, state ? 'off' : 'on') | 			return this.toggleMark(block, state ? 'off' : 'on') | ||||||
| 		}], | 		}], | ||||||
|  | 	toggleMarkRibbon: ['Mark/$Invert ribbon marks',  | ||||||
|  | 		'toggleMark: "ribbon" ...' ], | ||||||
|  | 	toggleMarkLoaded: ['Mark/Invert marks',  | ||||||
|  | 		'toggleMark: "loaded" ...' ], | ||||||
| 
 | 
 | ||||||
| 	// shorthands...
 | 	markRibbon: ['Mark/Mark $ribbon',  | ||||||
| 	invertRibbonMarks: ['Mark/$Invert marks in ribbon', | 		'toggleMark: "ribbon" "on"' ], | ||||||
| 		{browseMode: 'cropMarked'}, | 	markLoaded: ['Mark/Mark $all',  | ||||||
| 		'toggleMark: "ribbon"'], | 		'toggleMark: "loaded" "on"' ], | ||||||
| 	invertLoadedMarks: ['Mark/$Invert marks', |  | ||||||
| 		{browseMode: 'cropMarked'}, |  | ||||||
| 		'toggleMark: "loaded"'], |  | ||||||
| 
 |  | ||||||
| 	unmarkAll: ['Mark/$Unmark all', |  | ||||||
| 		{browseMode: 'cropMarked'}, |  | ||||||
| 		function(){ this.toggleMark(this.marked) }], |  | ||||||
| 
 | 
 | ||||||
| 	markTagged: ['- Mark/Mark images by tags', | 	markTagged: ['- Mark/Mark images by tags', | ||||||
| 		function(tags, mode){ | 		function(tags, mode){ | ||||||
| @ -378,7 +381,7 @@ var ImageMarkEditActions = actions.Actions({ | |||||||
| 			}) | 			}) | ||||||
| 		}], | 		}], | ||||||
| 
 | 
 | ||||||
| 	shiftMarkedUp: ['Mark/Shift marked $up', | 	shiftMarkedUp: ['Mark/Shift marked u$p', | ||||||
| 		{undo: undoShift('shiftMarkedDown'), | 		{undo: undoShift('shiftMarkedDown'), | ||||||
| 			browseMode: 'cropMarked'}, | 			browseMode: 'cropMarked'}, | ||||||
| 		shiftMarked('up')], | 		shiftMarked('up')], | ||||||
| @ -397,6 +400,13 @@ var ImageMarkEditActions = actions.Actions({ | |||||||
| 		{browseMode: 'cropMarked'}, | 		{browseMode: 'cropMarked'}, | ||||||
| 		function(target){ | 		function(target){ | ||||||
| 			this.shiftImageTo(this.marked, target || 'current', 'before') }], | 			this.shiftImageTo(this.marked, target || 'current', 'before') }], | ||||||
|  | 
 | ||||||
|  | 	unmarkRibbon: ['Mark/Unmark ribbon', | ||||||
|  | 		{browseMode: 'cropMarked'}, | ||||||
|  | 		'toggleMark: "ribbon" "off"'], | ||||||
|  | 	unmarkLoaded: ['Mark/$Unmark all', | ||||||
|  | 		{browseMode: 'cropMarked'}, | ||||||
|  | 		'toggleMark: "loaded" "off"'], | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| var ImageEditMarks =  | var ImageEditMarks =  | ||||||
| @ -489,7 +499,13 @@ module.ImageMarksUI = core.ImageGridFeatures.Feature({ | |||||||
| var ImageBookmarkActions = actions.Actions({ | var ImageBookmarkActions = actions.Actions({ | ||||||
| 
 | 
 | ||||||
| 	// a shorthand...
 | 	// a shorthand...
 | ||||||
|  | 	//
 | ||||||
| 	// NOTE: this will return a copy...
 | 	// NOTE: this will return a copy...
 | ||||||
|  | 	//
 | ||||||
|  | 	// XXX should we add a caching scheme here???
 | ||||||
|  | 	// 		...it would require invalidation on tagging...
 | ||||||
|  | 	// 		the problem is that on large sets this may take up quite a 
 | ||||||
|  | 	// 		chunk of memory...
 | ||||||
| 	get bookmarked(){ | 	get bookmarked(){ | ||||||
| 		if(this.data == null  | 		if(this.data == null  | ||||||
| 				|| this.data.tags == null | 				|| this.data.tags == null | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user