mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	cleaned up the button controls...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									2c650da183
								
							
						
					
					
						commit
						bd729aa46b
					
				| @ -261,21 +261,7 @@ var FullScreenControllsActions = actions.Actions({ | |||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	toggleFullScreenControls: ['Interface/', | 	toggleFullScreenControls: ['Interface/', | ||||||
| 		toggler.Toggler(null, | 		widgets.makeButtonControlsToggler('fullscreen-controls')], | ||||||
| 			function(){  |  | ||||||
| 				return this.ribbons.viewer.find('.fullscreen-controls').length > 0 ? 'on' : 'off' }, |  | ||||||
| 			['off', 'on'], |  | ||||||
| 			function(state){ |  | ||||||
| 				if(state == 'on'){ |  | ||||||
| 					var config = this.config['fullscreen-controls'] |  | ||||||
| 
 |  | ||||||
| 					config |  | ||||||
| 						&& widgets.makeButtonControls(this, 'fullscreen-controls', config) |  | ||||||
| 
 |  | ||||||
| 				} else { |  | ||||||
| 					this.ribbons.viewer.find('.fullscreen-controls').remove() |  | ||||||
| 				} |  | ||||||
| 			})], |  | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| var FullScreenControlls =  | var FullScreenControlls =  | ||||||
|  | |||||||
| @ -42,12 +42,14 @@ var browseWalk = require('lib/widget/browse-walk') | |||||||
| var makeButtonControls = | var makeButtonControls = | ||||||
| module.makeButtonControls = | module.makeButtonControls = | ||||||
| function(context, cls, data){ | function(context, cls, data){ | ||||||
|  | 	cls = cls instanceof Array ? cls : cls.split(/\s+/g) | ||||||
|  | 
 | ||||||
| 	// remove old versions...
 | 	// remove old versions...
 | ||||||
| 	context.ribbons.viewer.find('.'+cls).remove() | 	context.ribbons.viewer.find('.'+ cls.join('.')).remove() | ||||||
| 
 | 
 | ||||||
| 	// make container...
 | 	// make container...
 | ||||||
| 	var controls = $('<div>') | 	var controls = $('<div>') | ||||||
| 		.addClass('buttons '+ cls) | 		.addClass('buttons '+ cls.join('.')) | ||||||
| 		.on('mouseover', function(){ | 		.on('mouseover', function(){ | ||||||
| 			var t = $(event.target) | 			var t = $(event.target) | ||||||
| 
 | 
 | ||||||
| @ -90,6 +92,30 @@ function(context, cls, data){ | |||||||
| 		.appendTo(context.ribbons.viewer) | 		.appendTo(context.ribbons.viewer) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | var makeButtonControlsToggler = | ||||||
|  | module.makeButtonControlsToggler = | ||||||
|  | function(cls, cfg){ | ||||||
|  | 	cls = cls instanceof Array ? cls : cls.split(/\s+/g) | ||||||
|  | 	cfg = cfg || cls[0] | ||||||
|  | 
 | ||||||
|  | 	return toggler.Toggler(null, | ||||||
|  | 		function(){  | ||||||
|  | 			return this.ribbons.viewer.find('.'+ cls.join('.')).length > 0 ? 'on' : 'off' }, | ||||||
|  | 		['off', 'on'], | ||||||
|  | 		function(state){ | ||||||
|  | 			if(state == 'on'){ | ||||||
|  | 				var config = this.config[cfg] | ||||||
|  | 
 | ||||||
|  | 				config  | ||||||
|  | 					&& makeButtonControls(this, cls, config) | ||||||
|  | 
 | ||||||
|  | 			} else { | ||||||
|  | 				this.ribbons.viewer.find('.'+ cls.join('.')).remove() | ||||||
|  | 			} | ||||||
|  | 		}) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| // XXX make the selector more accurate...
 | // XXX make the selector more accurate...
 | ||||||
| // 		...at this point this will select the first elem with text which
 | // 		...at this point this will select the first elem with text which
 | ||||||
| @ -1082,25 +1108,11 @@ var MainControlsActions = actions.Actions({ | |||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	toggleMainControls: ['Interface/', | 	toggleMainControls: ['Interface/', | ||||||
| 		toggler.Toggler(null, | 		makeButtonControlsToggler('main-controls')], | ||||||
| 			function(){  |  | ||||||
| 				return this.ribbons.viewer.find('.main-controls').length > 0 ? 'on' : 'off' }, |  | ||||||
| 			['off', 'on'], |  | ||||||
| 			function(state){ |  | ||||||
| 				if(state == 'on'){ |  | ||||||
| 					var config = this.config['main-controls'] |  | ||||||
| 
 |  | ||||||
| 					config  |  | ||||||
| 						&& makeButtonControls(this, 'main-controls', config) |  | ||||||
| 
 |  | ||||||
| 				} else { |  | ||||||
| 					this.ribbons.viewer.find('.main-controls').remove() |  | ||||||
| 				} |  | ||||||
| 			})], |  | ||||||
| }) | }) | ||||||
| 
 | 
 | ||||||
| var BrowseActions =  | var MainControls =  | ||||||
| module.BrowseActions = core.ImageGridFeatures.Feature({ | module.MainControls = core.ImageGridFeatures.Feature({ | ||||||
| 	title: '', | 	title: '', | ||||||
| 	doc: '', | 	doc: '', | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user