mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	more cleaning...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									8ffb7f49ea
								
							
						
					
					
						commit
						2c684e6640
					
				
							
								
								
									
										15
									
								
								ui/base.js
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								ui/base.js
									
									
									
									
									
								
							| @ -109,8 +109,11 @@ function getImageGID(image){ | ||||
| 
 | ||||
| // Calculate relative position between two elements
 | ||||
| //
 | ||||
| // ...tried to make this as brain-dead-stupidly-simple as possible...
 | ||||
| // NOTE: tried to make this as brain-dead-stupidly-simple as possible...
 | ||||
| //		...looks spectacular comparing to either gen2 or gen1 ;)
 | ||||
| // NOTE: if used during an animation/transition this will give the 
 | ||||
| // 		position at the exact frame of the animation, this might not be
 | ||||
| // 		the desired "final" data...
 | ||||
| function getRelativeVisualPosition(outer, inner){ | ||||
| 	outer = $(outer).offset() | ||||
| 	inner = $(inner).offset() | ||||
| @ -177,7 +180,7 @@ function shiftTo(image, ribbon){ | ||||
| 	// if removing last image out of a ribbon, remove the ribbon....
 | ||||
| 	if(cur_ribbon.find('.image').length == 0){ | ||||
| 		// XXX check if the ribbon outside the loaded area is empty...
 | ||||
| 		// 		...do we need this check? it might be interresting to
 | ||||
| 		// 		...do we need this check? it might be interesting to
 | ||||
| 		// 		"collapse" disjoint, empty areas...
 | ||||
| 		// 		......if so, will also need to do this in DATA...
 | ||||
| 		removeRibbon(cur_ribbon) | ||||
| @ -188,12 +191,7 @@ function shiftTo(image, ribbon){ | ||||
| 
 | ||||
| 
 | ||||
| function shiftImage(direction, image, force_create_ribbon){ | ||||
| 	if(image == null){ | ||||
| 		// XXX need to make this context specific...
 | ||||
| 		image = $('.current.image') | ||||
| 	} else { | ||||
| 		image = $(image) | ||||
| 	} | ||||
| 	image = image == null ? $('.current.image') : $(image) | ||||
| 	var old_ribbon = getRibbon(image) | ||||
| 	var ribbon = old_ribbon[direction]('.ribbon') | ||||
| 
 | ||||
| @ -222,6 +220,7 @@ function shiftImage(direction, image, force_create_ribbon){ | ||||
| // NOTE: this will not attach the created images.
 | ||||
| function createImage(n, force_create_new){ | ||||
| 	if(n == null){ | ||||
| 		// XXX do we need this?
 | ||||
| 		if(window._n == null){ | ||||
| 			window._n = 0 | ||||
| 		} | ||||
|  | ||||
							
								
								
									
										19
									
								
								ui/data.js
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								ui/data.js
									
									
									
									
									
								
							| @ -1,6 +1,7 @@ | ||||
| /********************************************************************** | ||||
| *  | ||||
| * | ||||
| * TODO move DATA to a more logical context avoiding the global vars... | ||||
| * | ||||
| **********************************************************************/ | ||||
| 
 | ||||
| @ -23,7 +24,6 @@ var STUB_IMAGE_DATA = { | ||||
| 	classes: '', | ||||
| } | ||||
| 
 | ||||
| // XXX STUB
 | ||||
| // Data format...
 | ||||
| var DATA = { | ||||
| 	varsion: '2.0', | ||||
| @ -207,7 +207,6 @@ function getImageGIDs(from, count, ribbon, inclusive){ | ||||
| 		var start = ribbon.indexOf(from) + c | ||||
| 		return ribbon.slice(start, start + count) | ||||
| 	} else { | ||||
| 		// XXX
 | ||||
| 		var c = inclusive == null ? 0 : 1 | ||||
| 		var end = ribbon.indexOf(from) | ||||
| 		return ribbon.slice((Math.abs(count) >= end ? 0 : end + count + c), end + c) | ||||
| @ -341,22 +340,18 @@ function loadImages(ref_gid, count, ribbon){ | ||||
| 
 | ||||
| 	var size = getVisibleImageSize() | ||||
| 
 | ||||
| 	// XXX the next section might need some simplification -- fells bulky...
 | ||||
| 	// XXX the next section might need some simplification -- feels bulky...
 | ||||
| 	// check if we have a common section at all / full reload...
 | ||||
| 	if(head == 0 && tail == 0){ | ||||
| 		if(gids.indexOf(old_gids[0]) == -1){ | ||||
| 			window.DEBUG && console.log('>>> (ribbon:', ribbon_i, ') FULL RELOAD --', gids.length) | ||||
| 			// XXX do we need to think about alining here???
 | ||||
| 			extendRibbon(0, gids.length - old_gids.length, ribbon) | ||||
| 
 | ||||
| 			var images = ribbon | ||||
| 				.find('.image') | ||||
| 					.each(function(i, e){ | ||||
| 						updateImage(e, gids[i], size) | ||||
| 					}) | ||||
| 
 | ||||
| 			$('.viewer').trigger('reloadedRibbon', [ribbon]) | ||||
| 
 | ||||
| 			return images | ||||
| 
 | ||||
| 
 | ||||
| @ -383,9 +378,7 @@ function loadImages(ref_gid, count, ribbon){ | ||||
| 		res.right.each(function(i, e){ | ||||
| 			updateImage(e, gids[i + gids.length - tail], size) | ||||
| 		}) | ||||
| 
 | ||||
| 		$('.viewer').trigger('updatedRibbon', [ribbon]) | ||||
| 
 | ||||
| 		return ribbon.find('.image') | ||||
| 	} | ||||
| } | ||||
| @ -520,6 +513,7 @@ function loadLocalStorage(attr){ | ||||
| 	return loadData(JSON.parse(localStorage[attr])) | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| function saveLocalStorage(attr){ | ||||
| 	attr = attr == null ? 'DATA' : attr | ||||
| 	localStorage[attr] = JSON.stringify(DATA) | ||||
| @ -527,7 +521,6 @@ function saveLocalStorage(attr){ | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /********************************************************************** | ||||
| * Image caching... | ||||
| */ | ||||
| @ -556,6 +549,7 @@ function preCacheRibbonImages(ribbon){ | ||||
| 	return cache | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| function preCacheAllRibbons(){ | ||||
| 	$('.ribbon').each(function(){ | ||||
| 		preCacheRibbonImages($(this)) | ||||
| @ -565,7 +559,6 @@ function preCacheAllRibbons(){ | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /********************************************************************** | ||||
| * Setup | ||||
| */ | ||||
| @ -582,8 +575,6 @@ function preCacheAllRibbons(){ | ||||
| // 		- shifting (expand/contract)
 | ||||
| // 		- zooming (expand/contract)
 | ||||
| //
 | ||||
| //
 | ||||
| // XXX this is causing lots of errors, rethink...
 | ||||
| function setupDataBindings(viewer){ | ||||
| 	viewer = viewer == null ? $('.viewer') : viewer | ||||
| 	viewer | ||||
| @ -619,8 +610,6 @@ function setupDataBindings(viewer){ | ||||
| 
 | ||||
| 			// NOTE: if this is greater than the number of images currently 
 | ||||
| 			//		loaded, it might lead to odd effects...
 | ||||
| 			//		XXX need to load additional images and keep track of the 
 | ||||
| 			//			loaded chunk size...
 | ||||
| 			var frame_size = (screen_size * LOAD_SCREENS) / 2 | ||||
| 			var threshold = screen_size * LOAD_THRESHOLD | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user