mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	some minor cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									8dd8f29c82
								
							
						
					
					
						commit
						06eb2f2f1e
					
				| @ -29,14 +29,18 @@ var Client = | |||||||
| module.Client =  | module.Client =  | ||||||
| actions.Actions({ | actions.Actions({ | ||||||
| 
 | 
 | ||||||
|  | 	// XXX should this be here???
 | ||||||
| 	config: { | 	config: { | ||||||
| 		'steps-to-change-direction': 3, | 		'steps-to-change-direction': 3, | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| 	// basic state...
 | 	// basic state...
 | ||||||
| 	// NOTE: the setters in the following use the appropriate actions
 | 	// NOTE: the setters in the following use the appropriate actions
 | ||||||
| 	// 		so to avoid recursion do not use these in the specific 
 | 	// 		so to avoid recursion do not use these in the specific 
 | ||||||
| 	// 		actions...
 | 	// 		actions...
 | ||||||
|  | 
 | ||||||
|  | 	// Base ribbon...
 | ||||||
| 	get base(){ | 	get base(){ | ||||||
| 		return this.data == null ? null : this.data.base | 		return this.data == null ? null : this.data.base | ||||||
| 	}, | 	}, | ||||||
| @ -44,6 +48,7 @@ actions.Actions({ | |||||||
| 		this.setBaseRibbon(value) | 		this.setBaseRibbon(value) | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
|  | 	// Current image...
 | ||||||
| 	get current(){ | 	get current(){ | ||||||
| 		return this.data == null ? null : this.data.current | 		return this.data == null ? null : this.data.current | ||||||
| 	}, | 	}, | ||||||
| @ -51,6 +56,7 @@ actions.Actions({ | |||||||
| 		this.focusImage(value) | 		this.focusImage(value) | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
|  | 	// Current ribbon...
 | ||||||
| 	get currentRibbon(){ | 	get currentRibbon(){ | ||||||
| 		return this.data == null ? null : this.data.getRibbon() | 		return this.data == null ? null : this.data.getRibbon() | ||||||
| 	}, | 	}, | ||||||
| @ -58,15 +64,18 @@ actions.Actions({ | |||||||
| 		this.focusRibbon(value) | 		this.focusRibbon(value) | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	// default direction
 | 	// Default direction...
 | ||||||
|  | 	//
 | ||||||
|  | 	// This can be 'left' or 'right', other values are ignored.
 | ||||||
|  | 	//
 | ||||||
|  | 	// The system has inertial direction change, after >N steps of 
 | ||||||
|  | 	// movement in one direction it takes N steps to reverse the default
 | ||||||
|  | 	// direction.
 | ||||||
|  | 	// The number of steps (N) is set in:
 | ||||||
|  | 	// 		.config['steps-to-change-direction']
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// NOTE: the system has inertial direction change, after >N steps of 
 |  | ||||||
| 	// 		movement in one direction it takes N steps to reverse the
 |  | ||||||
| 	// 		default direction.
 |  | ||||||
| 	// 		the number of steps (N) is set in:
 |  | ||||||
| 	// 			.config['steps-to-change-direction']
 |  | ||||||
| 	// NOTE: to force direction change append a '!' to the direction.
 | 	// NOTE: to force direction change append a '!' to the direction.
 | ||||||
| 	// NOTE: values other than 'left'/'right' are ignored...
 | 	// 		e.g. X.direction = 'left!'
 | ||||||
| 	get direction(){ | 	get direction(){ | ||||||
| 		return this._direction >= 0 ? 'right' | 		return this._direction >= 0 ? 'right' | ||||||
| 			: this._direction < 0 ? 'left' | 			: this._direction < 0 ? 'left' | ||||||
| @ -76,13 +85,13 @@ actions.Actions({ | |||||||
| 		// force direction change...
 | 		// force direction change...
 | ||||||
| 		if(value.slice(-1) == '!'){ | 		if(value.slice(-1) == '!'){ | ||||||
| 			this._direction = value == 'left!' ? -1 | 			this._direction = value == 'left!' ? -1 | ||||||
| 				: value == 'right!' : 0 | 				: value == 'right!' ? 0 | ||||||
| 				: this._direction | 				: this._direction | ||||||
| 
 | 
 | ||||||
| 		// 'update' direction...
 | 		// 'update' direction...
 | ||||||
| 		} else { | 		} else { | ||||||
| 			value = value == 'left' ? -1  | 			value = value == 'left' ? -1  | ||||||
| 				: value == 'right' : 1 | 				: value == 'right' ? 1 | ||||||
| 				: 0 | 				: 0 | ||||||
| 			var d = (this._direction || 0) + value | 			var d = (this._direction || 0) + value | ||||||
| 			var s = this.config['steps-to-change-direction'] | 			var s = this.config['steps-to-change-direction'] | ||||||
| @ -94,10 +103,11 @@ actions.Actions({ | |||||||
| 			d = d < -s ? -s : d | 			d = d < -s ? -s : d | ||||||
| 			this._direction = d | 			this._direction = d | ||||||
| 		} | 		} | ||||||
| 	} | 	}, | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	// basic life-cycle actions...
 | 	// basic life-cycle actions...
 | ||||||
|  | 	//
 | ||||||
| 	ready: [ | 	ready: [ | ||||||
| 		function(){ | 		function(){ | ||||||
| 			// XXX setup empty state...
 | 			// XXX setup empty state...
 | ||||||
| @ -113,6 +123,7 @@ actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	// basic navigation...
 | 	// basic navigation...
 | ||||||
|  | 	//
 | ||||||
| 	focusImage: ['Focus image', | 	focusImage: ['Focus image', | ||||||
| 		function(img){ | 		function(img){ | ||||||
| 			this.data.focusImage(img) | 			this.data.focusImage(img) | ||||||
| @ -186,6 +197,9 @@ actions.Actions({ | |||||||
| 			} | 			} | ||||||
| 		}], | 		}], | ||||||
| 	shiftImageDown: ['Shift image down', | 	shiftImageDown: ['Shift image down', | ||||||
|  | 		'If implicitly shifting current image (i.e. no arguments), focus ' | ||||||
|  | 			+'will shift to the next or previous image in the current ' | ||||||
|  | 			+'ribbon depending on current direction.', | ||||||
| 		function(target){  | 		function(target){  | ||||||
| 			// by default we need to update the current position...
 | 			// by default we need to update the current position...
 | ||||||
| 			if(target == null){ | 			if(target == null){ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user