mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	minor tweaks to css + default direction handling...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									f0e0518883
								
							
						
					
					
						commit
						9d0679cda0
					
				| @ -487,6 +487,11 @@ button:hover { | |||||||
| 	opacity: 0.05; | 	opacity: 0.05; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* XXX not sure if this is the right way to go... */ | ||||||
|  | .slideshow-running .buttons { | ||||||
|  | 	opacity: 0; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| /********************************************************** Viewer ***/ | /********************************************************** Viewer ***/ | ||||||
|  | |||||||
| @ -62,8 +62,14 @@ actions.Actions({ | |||||||
| 		// XXX should this be here???
 | 		// XXX should this be here???
 | ||||||
| 		version: 'gen4', | 		version: 'gen4', | ||||||
| 
 | 
 | ||||||
|  | 		// Number of steps to change default direction...
 | ||||||
|  | 		//
 | ||||||
| 		// see .direction for details...
 | 		// see .direction for details...
 | ||||||
| 		'steps-to-change-direction': 3, | 		'steps-to-change-direction': 3, | ||||||
|  | 		// If true, shift up/down will count as a left/right move...
 | ||||||
|  | 		//
 | ||||||
|  | 		// see .direction for details...
 | ||||||
|  | 		'shifts-affect-direction': true, | ||||||
| 
 | 
 | ||||||
| 		// Determines the image selection mode when focusing or moving 
 | 		// Determines the image selection mode when focusing or moving 
 | ||||||
| 		// between ribbons...
 | 		// between ribbons...
 | ||||||
| @ -117,33 +123,52 @@ actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 	// Default direction...
 | 	// Default direction...
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// This can be 'left' or 'right', other values are ignored.
 | 	// The system delays inertial direction change -- after >N steps of 
 | ||||||
| 	//
 |  | ||||||
| 	// The system has inertial direction change, after >N steps of 
 |  | ||||||
| 	// movement in one direction it takes N steps to reverse the default
 | 	// movement in one direction it takes N steps to reverse the default
 | ||||||
| 	// direction.
 | 	// direction.
 | ||||||
| 	// The number of steps (N) is set in:
 |  | ||||||
| 	// 		.config['steps-to-change-direction']
 |  | ||||||
| 	//
 | 	//
 | ||||||
| 	// NOTE: to force direction change append a '!' to the direction.
 | 	// This can be 'left' or 'right', other values are ignored.
 | ||||||
| 	// 		e.g. X.direction = 'left!'
 | 	//
 | ||||||
|  | 	// Assigning '!' to this is the same as assigning (repeating) the 
 | ||||||
|  | 	// last assigned value again.
 | ||||||
|  | 	//
 | ||||||
|  | 	// Assigning 'left!' or 'right!' ('!' appended) will reset the counter
 | ||||||
|  | 	// and force direction change.
 | ||||||
|  | 	//
 | ||||||
|  | 	// Configuration (.config):
 | ||||||
|  | 	// 	'steps-to-change-direction' 	
 | ||||||
|  | 	// 		Sets the number of steps to change direction (N)
 | ||||||
|  | 	//
 | ||||||
|  | 	//	'shifts-affect-direction'
 | ||||||
|  | 	//		If true, add last direction change before vertical shift to 
 | ||||||
|  | 	//		direction counter (N)
 | ||||||
|  | 	//		This makes the direction change after several shifts up/down
 | ||||||
|  | 	//		"backwards" a bit faster.
 | ||||||
|  | 	//
 | ||||||
| 	get direction(){ | 	get direction(){ | ||||||
| 		return this._direction >= 0 ? 'right' | 		return this._direction >= 0 ? 'right' | ||||||
| 			: this._direction < 0 ? 'left' | 			: this._direction < 0 ? 'left' | ||||||
| 			: 'right' | 			: 'right' | ||||||
| 	}, | 	}, | ||||||
| 	set direction(value){ | 	set direction(value){ | ||||||
|  | 		// repeat last direction...
 | ||||||
|  | 		if(value == '!'){ | ||||||
|  | 			this.direction = this._direction_last || 'right' | ||||||
|  | 
 | ||||||
| 		// force direction change...
 | 		// force direction change...
 | ||||||
| 		if(value.slice(-1) == '!'){ | 		} else if(typeof(value) == typeof('str')  | ||||||
| 			this._direction = value == 'left!' ? -1 | 				&& value.slice(-1) == '!'){ | ||||||
|  | 			value = this._direction = value == 'left!' ? -1 | ||||||
| 				: value == 'right!' ? 0 | 				: value == 'right!' ? 0 | ||||||
| 				: this._direction | 				: this._direction | ||||||
|  | 			this._direction_last = value >= 0 ? 'right' : 'left' | ||||||
| 
 | 
 | ||||||
| 		// 'update' direction...
 | 		// 'update' direction...
 | ||||||
| 		} else { | 		} else { | ||||||
| 			value = value == 'left' ? -1  | 			value = value == 'left' ? -1  | ||||||
| 				: value == 'right' ? 1 | 				: value == 'right' ? 1 | ||||||
| 				: 0 | 				: 0 | ||||||
|  | 			this._direction_last = value >= 0 ? 'right' : 'left' | ||||||
| 			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'] | ||||||
| 			s = s < 1 ? 1 : s | 			s = s < 1 ? 1 : s | ||||||
| @ -424,6 +449,7 @@ actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 				this.data.shiftImageUp(cur) | 				this.data.shiftImageUp(cur) | ||||||
| 				this.focusImage(next) | 				this.focusImage(next) | ||||||
|  | 				this.config['shifts-affect-direction'] && (this.direction = '!') | ||||||
| 
 | 
 | ||||||
| 			// if a specific target is given, just shift it...
 | 			// if a specific target is given, just shift it...
 | ||||||
| 			} else { | 			} else { | ||||||
| @ -447,6 +473,7 @@ actions.Actions({ | |||||||
| 
 | 
 | ||||||
| 				this.data.shiftImageDown(cur) | 				this.data.shiftImageDown(cur) | ||||||
| 				this.focusImage(next) | 				this.focusImage(next) | ||||||
|  | 				this.config['shifts-affect-direction'] && (this.direction = '!') | ||||||
| 
 | 
 | ||||||
| 			// if a specific target is given, just shift it...
 | 			// if a specific target is given, just shift it...
 | ||||||
| 			} else { | 			} else { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user