mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 11:20:09 +00:00 
			
		
		
		
	added contexts to .getImageOrder(..)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									40aa86ff9f
								
							
						
					
					
						commit
						29bd430f54
					
				
							
								
								
									
										37
									
								
								ui/data4.js
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								ui/data4.js
									
									
									
									
									
								
							| @ -395,15 +395,36 @@ var DataPrototype = { | |||||||
| 		// target is either first or last...
 | 		// target is either first or last...
 | ||||||
| 		return null | 		return null | ||||||
| 	},	 | 	},	 | ||||||
| 	// same as .getImage(..) but return image order.
 | 
 | ||||||
|  | 	// Return image order...
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// XXX should be able to get order in the following contexts:
 | 	// This is similar to .getImage(..) but adds an optional context.
 | ||||||
| 	// 		- all (default)
 | 	//
 | ||||||
| 	// 		- loaded
 | 	// The context can be:
 | ||||||
| 	// 		- ribbon
 | 	//	'all' 		- global order (default)
 | ||||||
| 	// 		- list
 | 	// 	'loaded'	- order in loaded images
 | ||||||
| 	getImageOrder: function(target, mode, list){ | 	// 	'ribbon'	- order in ribbon
 | ||||||
| 		return this.order.indexOf(this.getImage(target, mode, list)) | 	//
 | ||||||
|  | 	// NOTE: acquiring the gid is exactly the same as with .getImage(..)
 | ||||||
|  | 	// 		next, that gid is used to get the order, in case of the 
 | ||||||
|  | 	// 		'ribbon' context, the order is relative to the ribbon where
 | ||||||
|  | 	// 		the image is located.
 | ||||||
|  | 	// 		To get the order of an image in a different ribbon, get an 
 | ||||||
|  | 	// 		appropriate before/after image in that ribbon and get it's 
 | ||||||
|  | 	// 		order.
 | ||||||
|  | 	getImageOrder: function(context, target, mode, list){ | ||||||
|  | 		if(context == 'loaded'){ | ||||||
|  | 			return this.getImages('loaded').indexOf(this.getImage(target, mode, list)) | ||||||
|  | 
 | ||||||
|  | 		} else if(context == 'ribbon'){ | ||||||
|  | 			var gid = this.getImage(target, mode, list) | ||||||
|  | 			return this.getImages(gid).indexOf(gid) | ||||||
|  | 
 | ||||||
|  | 		} else if(context == 'all'){ | ||||||
|  | 			return this.order.indexOf(this.getImage(target, mode, list)) | ||||||
|  | 		}  | ||||||
|  | 
 | ||||||
|  | 		return this.order.indexOf(this.getImage(context, target, mode)) | ||||||
| 	},	 | 	},	 | ||||||
| 
 | 
 | ||||||
| 	// Get a list of gids...
 | 	// Get a list of gids...
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user