mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 10:50:08 +00:00 
			
		
		
		
	now keyboard handler calls actions directly and the config is serialiable...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									fc84b5a1cf
								
							
						
					
					
						commit
						98350a576b
					
				| @ -242,6 +242,8 @@ function Action(name, doc, ldoc, func){ | |||||||
| 
 | 
 | ||||||
| 	return meth | 	return meth | ||||||
| } | } | ||||||
|  | // this will make action instances behave like real functions...
 | ||||||
|  | Action.prototype.__proto__ = Function | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // A base action-set object...
 | // A base action-set object...
 | ||||||
|  | |||||||
| @ -110,66 +110,66 @@ module.GLOBAL_KEYBOARD = { | |||||||
| 		}, | 		}, | ||||||
| 
 | 
 | ||||||
| 		// XXX testing...
 | 		// XXX testing...
 | ||||||
| 		Home: function(){ a.firstImage() }, | 		Home: 'firstImage', | ||||||
| 		End: function(){ a.lastImage() }, | 		End: 'lastImage', | ||||||
| 		Left: { | 		Left: { | ||||||
| 			default: function(){ a.prevImage() }, | 			default: 'prevImage', | ||||||
| 			alt: function(){  | 			alt: 'shiftImageLeft!', | ||||||
| 				event.preventDefault() | 			ctrl: 'prevScreen', | ||||||
| 				a.shiftImageLeft()  |  | ||||||
| 			}, |  | ||||||
| 			ctrl: function(){ a.prevScreen() }, |  | ||||||
| 		}, | 		}, | ||||||
| 		Right: { | 		Right: { | ||||||
| 			default: function(){ a.nextImage() }, | 			default: 'nextImage', | ||||||
| 			alt: function(){  | 			alt: 'shiftImageRight!', | ||||||
| 				event.preventDefault() | 			ctrl: 'nextScreen', | ||||||
| 				a.shiftImageRight()  |  | ||||||
| 		}, | 		}, | ||||||
| 			ctrl: function(){ a.nextScreen() }, | 		'(': 'prevImageInOrder', | ||||||
| 		}, | 		')': 'nextImageInOrder', | ||||||
| 		'(': function(){ a.prevImageInOrder() }, |  | ||||||
| 		')': function(){ a.nextImageInOrder() }, |  | ||||||
| 		Up: { | 		Up: { | ||||||
| 			default: function(){ a.prevRibbon() }, | 			default: 'prevRibbon', | ||||||
| 			shift: function(){ a.shiftImageUp() }, | 			shift: 'shiftImageUp', | ||||||
| 			'ctrl+shift': function(){ a.shiftImageUpNewRibbon() }, | 			'ctrl+shift': 'shiftImageUpNewRibbon', | ||||||
| 		}, | 		}, | ||||||
| 		Down: { | 		Down: { | ||||||
| 			default: function(){ a.nextRibbon() }, | 			default: 'nextRibbon', | ||||||
| 			shift: function(){ a.shiftImageDown() }, | 			shift: 'shiftImageDown', | ||||||
| 			'ctrl+shift': function(){ a.shiftImageDownNewRibbon() }, | 			'ctrl+shift': 'shiftImageDownNewRibbon', | ||||||
| 		}, | 		}, | ||||||
| 		'#0': function(){ a.fitMax() }, | 		'#0': 'fitMax', | ||||||
| 		'#1': { | 		'#1': { | ||||||
| 			default: function(){ a.fitImage() }, | 			default: 'fitImage', | ||||||
| 			ctrl: function(){  | 			ctrl: 'fitOrig!', | ||||||
| 				event.preventDefault() |  | ||||||
| 				a.fitOrig()  |  | ||||||
| 		}, | 		}, | ||||||
| 		}, | 		'#2': 'fitTwo', | ||||||
| 		'#2': function(){ a.fitTwo() }, | 		'#3': 'fitThree', | ||||||
| 		'#3': function(){ a.fitThree() }, | 		'#4': 'fitFour', | ||||||
| 		'#4': function(){ a.fitFour() }, | 		'#5': 'fitFive', | ||||||
| 		'#5': function(){ a.fitFive() }, | 		'#6': 'fitSix', | ||||||
| 		'#6': function(){ a.fitSix() }, | 		'#7': 'fitSeven', | ||||||
| 		'#7': function(){ a.fitSeven() }, | 		'#8': 'fitEight', | ||||||
| 		'#8': function(){ a.fitEight() }, | 		'#9': 'fitNine', | ||||||
| 		'#9': function(){ a.fitNine() }, |  | ||||||
| 		 | 		 | ||||||
| 		'+': function(){ a.zoomIn() }, | 		'+': 'zoomIn', | ||||||
| 		'=': '+', | 		'=': '+', | ||||||
| 		'-': function(){ a.zoomOut() }, | 		'-': 'zoomOut', | ||||||
| 		 |  | ||||||
| 		 | 		 | ||||||
| 	}, | 	}, | ||||||
| }	 | }	 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| /*********************************************************************/ | /*********************************************************************/ | ||||||
| 
 | 
 | ||||||
| $(function(){ | $(function(){ | ||||||
|  | 
 | ||||||
|  | 	window.a = testing.setupActions() | ||||||
|  | 
 | ||||||
|  | 	viewer.Animation.setup(a) | ||||||
|  | 
 | ||||||
|  | 	// this publishes all the actions...
 | ||||||
|  | 	//module.GLOBAL_KEYBOARD.__proto__ = a
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 	// setup base keyboard for devel, in case something breaks...
 | 	// setup base keyboard for devel, in case something breaks...
 | ||||||
| 	$(document) | 	$(document) | ||||||
| 		.keydown( | 		.keydown( | ||||||
| @ -177,11 +177,8 @@ $(function(){ | |||||||
| 				module.GLOBAL_KEYBOARD, | 				module.GLOBAL_KEYBOARD, | ||||||
| 				function(k){ | 				function(k){ | ||||||
| 					window.DEBUG && console.log(k) | 					window.DEBUG && console.log(k) | ||||||
| 				})) | 				},  | ||||||
| 
 | 				a)) | ||||||
| 	window.a = testing.setupActions() |  | ||||||
| 
 |  | ||||||
| 	viewer.Animation.setup(a) |  | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user