mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-29 18:30:09 +00:00 
			
		
		
		
	some refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									7cdf21c2e3
								
							
						
					
					
						commit
						d2362bd116
					
				| @ -804,9 +804,11 @@ function exportImageTo(gid, path, im_name, size){ | ||||
| 	return (function(src, dest){ | ||||
| 		return copyFile(src, dest) | ||||
| 			.done(function(){ | ||||
| 				// XXX do we actually need this???
 | ||||
| 				console.log(src, 'done.') | ||||
| 			}) | ||||
| 			.fail(function(err){ | ||||
| 				// XXX do we actually need this???
 | ||||
| 				console.warn(src, 'err:', err) | ||||
| 			}) | ||||
| 	})(src, dest) | ||||
| @ -824,8 +826,7 @@ function exportImagesTo(path, im_name, dir_name, size){ | ||||
| 	dir_name = dir_name == null ? 'fav' : dir_name | ||||
| 	size = size == null ? 1000 : size | ||||
| 
 | ||||
| 	// starting point...
 | ||||
| 	//var deferred = $.Deferred().resolve()
 | ||||
| 	var res = $.Deferred() | ||||
| 
 | ||||
| 	var base_path = path | ||||
| 	path = normalizePath(path) | ||||
| @ -842,7 +843,6 @@ function exportImagesTo(path, im_name, dir_name, size){ | ||||
| 	selection.sort(imageOrderCmp) | ||||
| 	var z = (('10e' + (selection.length + '').length) * 1 + '').slice(2) | ||||
| 
 | ||||
| 	var res = $.Deferred() | ||||
| 	var pool = makeDefferedPool() | ||||
| 		.depleted(function(){ | ||||
| 			showStatusQ('Export: done.') | ||||
| @ -865,7 +865,6 @@ function exportImagesTo(path, im_name, dir_name, size){ | ||||
| 			var o = selection.indexOf(gid) + '' | ||||
| 			dest = dest.replace('%i', (z + o).slice(o.length)) | ||||
| 
 | ||||
| 			//exportImageTo(gid, path, dest, size)
 | ||||
| 			pool.enqueue(null, exportImageTo, [gid, path, dest, size]) | ||||
| 		} | ||||
| 
 | ||||
|  | ||||
| @ -11,6 +11,14 @@ | ||||
| 
 | ||||
| var POOL_SIZE = 64 | ||||
| 
 | ||||
| var DEFAULT_TRANSITION_DURATION = 200 | ||||
| 
 | ||||
| // XXX this affects only the innertial part, not setCurrentPage...
 | ||||
| var USE_TRANSITIONS_FOR_ANIMATION = false | ||||
| 
 | ||||
| var USE_TRANSFORM = true | ||||
| var USE_3D_TRANSFORM = true | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /*********************************************************************/ | ||||
| @ -326,8 +334,6 @@ var getElementShift = makeCSSVendorAttrGetter( | ||||
| 		}) | ||||
| 
 | ||||
| 
 | ||||
| var DEFAULT_TRANSITION_DURATION = 200 | ||||
| 
 | ||||
| var getElementTransitionDuration = makeCSSVendorAttrGetter( | ||||
| 		'transitionDuration',  | ||||
| 		DEFAULT_TRANSITION_DURATION,  | ||||
| @ -335,9 +341,6 @@ var getElementTransitionDuration = makeCSSVendorAttrGetter( | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| var USE_TRANSFORM = true | ||||
| var USE_3D_TRANSFORM = true | ||||
| 
 | ||||
| // NOTE: at this point this works only on the X axis...
 | ||||
| function setElementTransform(elem, offset, scale, duration){ | ||||
| 	elem = $(elem) | ||||
| @ -398,9 +401,6 @@ function setElementTransform(elem, offset, scale, duration){ | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| // XXX this affects only the innertial part, not setCurrentPage...
 | ||||
| var USE_TRANSITIONS_FOR_ANIMATION = false | ||||
| 
 | ||||
| // XXX make this a drop-in replacement for setElementTransform...
 | ||||
| // XXX cleanup, still flacky...
 | ||||
| function animateElementTo(elem, to, duration, easing, speed, use_transitions){ | ||||
| @ -462,12 +462,12 @@ function animateElementTo(elem, to, duration, easing, speed, use_transitions){ | ||||
| 			} | ||||
| 
 | ||||
| 			// do an intermediate step...
 | ||||
| 			// XXX do propper easing...
 | ||||
| 			// XXX do proper easing...
 | ||||
| 			// XXX sometimes results in jumping around...
 | ||||
| 			// 		...result of jumping over the to position...
 | ||||
| 			if(speed != null){ | ||||
| 
 | ||||
| 				// XXX the folowing two blocks are the same...
 | ||||
| 				// XXX the following two blocks are the same...
 | ||||
| 				// XXX looks a bit too complex, revise...
 | ||||
| 				if(Math.abs(dist.top) >= 1){ | ||||
| 					dy = ((t - start) * speed.y) | ||||
| @ -498,7 +498,7 @@ function animateElementTo(elem, to, duration, easing, speed, use_transitions){ | ||||
| 					} | ||||
| 				} | ||||
| 
 | ||||
| 			// XXX this is a staright forward linear function...
 | ||||
| 			// XXX this is a straight forward linear function...
 | ||||
| 			} else { | ||||
| 				var r = (t - start) / duration | ||||
| 				cur.top = Math.round(from.top + (dist.top * r)) | ||||
| @ -743,6 +743,8 @@ function makeDeferredsQ(first){ | ||||
| // 			Drop the queued workers.
 | ||||
| // 			NOTE: this will not stop the already running workers.
 | ||||
| //
 | ||||
| // 		.isRunning()
 | ||||
| //
 | ||||
| // 		.progress(func)
 | ||||
| // 			Register a progress handler.
 | ||||
| // 			The handler is called after each worker is done and will get
 | ||||
| @ -880,6 +882,10 @@ function makeDefferedPool(size){ | ||||
| 		this.queue.splice(0, this.queue.length) | ||||
| 	} | ||||
| 
 | ||||
| 	Pool.isRunning = function(){ | ||||
| 		return this.pool.len() > 0 | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	// Register a queue depleted handler...
 | ||||
| 	//
 | ||||
| @ -979,13 +985,13 @@ Object.get = function(obj, name, dfl){ | ||||
| 	return val | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| // like .length but for sparse arrays will return the element count...
 | ||||
| Array.prototype.len = function(){ | ||||
| 	return this.filter(function(){ return true }).length | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| // convert JS arguments to Array...
 | ||||
| function args2array(args){ | ||||
| 	return Array.apply(null, args) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user