mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									fdb75bf3f7
								
							
						
					
					
						commit
						cf4cfa706e
					
				| @ -18,18 +18,11 @@ var base = require('features/base') | |||||||
| 
 | 
 | ||||||
| /*********************************************************************/ | /*********************************************************************/ | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| var AppControlActions = actions.Actions({ | var AppControlActions = actions.Actions({ | ||||||
| 	config: { | 	config: { | ||||||
| 		'application-window': null, | 		'application-window': null, | ||||||
| 
 | 
 | ||||||
| 		'window-title': 'ImageGrid.Viewer (${VERSION}): ${FILENAME}', | 		'window-title': 'ImageGrid.Viewer (${VERSION}): ${FILENAME}', | ||||||
| 
 |  | ||||||
| 		// XXX
 |  | ||||||
| 		'ui-scale-modes': { |  | ||||||
| 			desktop: 0, |  | ||||||
| 			touch: 3, |  | ||||||
| 		}, |  | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	// XXX revise these...
 | 	// XXX revise these...
 | ||||||
| @ -131,25 +124,6 @@ var AppControlActions = actions.Actions({ | |||||||
| 				that.ribbons.viewer[0].style.visibility = '' | 				that.ribbons.viewer[0].style.visibility = '' | ||||||
| 			}, 0) | 			}, 0) | ||||||
| 		}], | 		}], | ||||||
| 	// XXX need to account for scale in PartialRibbons
 |  | ||||||
| 	// XXX should this be browser API???
 |  | ||||||
| 	toggleInterfaceScale: ['Interface/Toggle interface modes', |  | ||||||
| 		base.makeConfigToggler('ui-scale-mode',  |  | ||||||
| 			function(){ return Object.keys(this.config['ui-scale-modes']) }, |  | ||||||
| 			function(state){  |  | ||||||
| 				var gui = requirejs('nw.gui') |  | ||||||
| 				var win = gui.Window.get() |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 				this.ribbons.preventTransitions() |  | ||||||
| 
 |  | ||||||
| 				var w = this.screenwidth |  | ||||||
| 				win.zoomLevel = this.config['ui-scale-modes'][state] || 0 |  | ||||||
| 				this.screenwidth = w |  | ||||||
| 				this.centerViewer() |  | ||||||
| 
 |  | ||||||
| 				this.ribbons.restoreTransitions() |  | ||||||
| 			})], |  | ||||||
| 	showDevTools: ['Interface|Development/Show Dev Tools', | 	showDevTools: ['Interface|Development/Show Dev Tools', | ||||||
| 		function(){ | 		function(){ | ||||||
| 			if(window.showDevTools != null){ | 			if(window.showDevTools != null){ | ||||||
|  | |||||||
| @ -93,6 +93,7 @@ core.ImageGridFeatures.Feature('viewer-testing', [ | |||||||
| 	'ui-external-editor', | 	'ui-external-editor', | ||||||
| 
 | 
 | ||||||
| 	// chrome...
 | 	// chrome...
 | ||||||
|  | 	'ui-scale', | ||||||
| 	'ui-animation', | 	'ui-animation', | ||||||
| 	'ui-bounds-indicators', | 	'ui-bounds-indicators', | ||||||
| 	'ui-current-image-indicator', | 	'ui-current-image-indicator', | ||||||
|  | |||||||
| @ -3131,6 +3131,80 @@ module.URLHash = core.ImageGridFeatures.Feature({ | |||||||
| 
 | 
 | ||||||
| //---------------------------------------------------------------------
 | //---------------------------------------------------------------------
 | ||||||
| 
 | 
 | ||||||
|  | // XXX make this work in browser
 | ||||||
|  | var UIScaleActions = actions.Actions({ | ||||||
|  | 	config: { | ||||||
|  | 		// XXX
 | ||||||
|  | 		'ui-scale-modes': { | ||||||
|  | 			desktop: 0, | ||||||
|  | 			touch: 3, | ||||||
|  | 		}, | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
|  | 	// XXX need to account for scale in PartialRibbons
 | ||||||
|  | 	// XXX should this be browser API???
 | ||||||
|  | 	toggleInterfaceScale: ['Interface/Toggle interface modes', | ||||||
|  | 		base.makeConfigToggler('ui-scale-mode',  | ||||||
|  | 			function(){ return Object.keys(this.config['ui-scale-modes']) }, | ||||||
|  | 			function(state){  | ||||||
|  | 				var gui = requirejs('nw.gui') | ||||||
|  | 				var win = gui.Window.get() | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 				this.ribbons.preventTransitions() | ||||||
|  | 
 | ||||||
|  | 				var w = this.screenwidth | ||||||
|  | 
 | ||||||
|  | 				// XXX need to compensate for external size change...
 | ||||||
|  | 				//this.ribbons.viewer[0].style.transform = 'scale('
 | ||||||
|  | 				//	+ (this.config['ui-scale-modes'][state] || 1) 
 | ||||||
|  | 				//	+')'
 | ||||||
|  | 				win.zoomLevel = this.config['ui-scale-modes'][state] || 0 | ||||||
|  | 
 | ||||||
|  | 				this.screenwidth = w | ||||||
|  | 				this.centerViewer() | ||||||
|  | 
 | ||||||
|  | 				this.ribbons.restoreTransitions() | ||||||
|  | 			})], | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | // XXX enable scale loading...
 | ||||||
|  | // 		...need to make this play nice with restoring scale on startup...
 | ||||||
|  | var UIScale =  | ||||||
|  | module.UIScale = core.ImageGridFeatures.Feature({ | ||||||
|  | 	title: '', | ||||||
|  | 	doc: '', | ||||||
|  | 
 | ||||||
|  | 	tag: 'ui-scale', | ||||||
|  | 	depends: [ | ||||||
|  | 		'ui', | ||||||
|  | 	], | ||||||
|  | 
 | ||||||
|  | 	actions: UIScaleActions, | ||||||
|  | 
 | ||||||
|  | 	// XXX test if in:
 | ||||||
|  | 	// 	- chrome app
 | ||||||
|  | 	// 	- nw
 | ||||||
|  | 	// 	- mobile
 | ||||||
|  | 	isApplicable: function(){ return this.runtime == 'nw' }, | ||||||
|  | 
 | ||||||
|  | 	// XXX show main window...
 | ||||||
|  | 	handlers: [ | ||||||
|  | 		['start', | ||||||
|  | 			function(){  | ||||||
|  | 				// XXX this messes up ribbon scale...
 | ||||||
|  | 				// 		...too close/fast?
 | ||||||
|  | 				//this.toggleInterfaceScale('!')
 | ||||||
|  | 			}], | ||||||
|  | 	], | ||||||
|  | }) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | //---------------------------------------------------------------------
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| // XXX console / log / status bar
 | // XXX console / log / status bar
 | ||||||
| // XXX title bar (???)
 | // XXX title bar (???)
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user