mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	fixed a bug (see todo)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									84e345882c
								
							
						
					
					
						commit
						b2259e221b
					
				
							
								
								
									
										31
									
								
								ui/TODO.otl
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								ui/TODO.otl
									
									
									
									
									
								
							| @ -111,13 +111,34 @@ Roadmap | |||||||
| [_] 32% Gen 3 current todo | [_] 32% Gen 3 current todo | ||||||
| 	[_] 64% High priority | 	[_] 64% High priority | ||||||
| 		[_] ASAP: Need visual indicators for long operations... | 		[_] ASAP: Need visual indicators for long operations... | ||||||
| 		[_] BUG: (phantom) in single image mode shifting first image up to new ribbon errs... | 		[X] BUG: shifting around images in very short ribbons produces lots of errors | ||||||
| 		| error location/reason: | 		| Procedure: | ||||||
| 		| 	getImageGid(..) got something odd in the image gid attribute... | 		| 	- crop a ribbon of two-three images | ||||||
|  | 		| 	- start shifting | ||||||
| 		| | 		| | ||||||
| 		| Race condition?? | 		| Problems: | ||||||
|  | 		| 	- wrong alignment | ||||||
|  | 		| 	- sometimes by shifting an image up the focus shifts to the  | ||||||
|  | 		| 	  upper ribbon | ||||||
| 		| | 		| | ||||||
| 		| Can't reproduce this... need to test on a faster machine... | 		| The direct cause of the problem: | ||||||
|  | 		| 	- errors: | ||||||
|  | 		| 		- SyntaxError - likely the JSON parser in getImageGID() | ||||||
|  | 		| 		- TypeError - property of null | ||||||
|  | 		| | ||||||
|  | 		| Likely causes: | ||||||
|  | 		| 	- we access images BEFORE they are initialized properly... | ||||||
|  | 		| | ||||||
|  | 		| Solution strategy: | ||||||
|  | 		| 	- make aligning independent of DOM state where possible... | ||||||
|  | 		| 	- make parts of the code wait for updates to finish... | ||||||
|  | 		| | ||||||
|  | 		| | ||||||
|  | 		| Actual case: | ||||||
|  | 		| 	- this was not a problem with race conditions... | ||||||
|  | 		| 	- essentially all this took is a careful look at event and  | ||||||
|  | 		| 	  action ordering, and a forgotten filter... | ||||||
|  | 		| 	  (filtering for images is a possible bug class) | ||||||
| 		[_] 66% Bookmarks | 		[_] 66% Bookmarks | ||||||
| 			[X] toggle | 			[X] toggle | ||||||
| 			[X] save/load | 			[X] save/load | ||||||
|  | |||||||
| @ -2380,7 +2380,6 @@ function setupData(viewer){ | |||||||
| 			from = getRibbonIndex(from) | 			from = getRibbonIndex(from) | ||||||
| 			//var ribbon = to
 | 			//var ribbon = to
 | ||||||
| 			to = getRibbonIndex(to) | 			to = getRibbonIndex(to) | ||||||
| 
 |  | ||||||
| 			var gid = getImageGID(image) | 			var gid = getImageGID(image) | ||||||
| 			var after = getGIDBefore(gid, to) | 			var after = getGIDBefore(gid, to) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -305,8 +305,11 @@ var saveFileData = makeFileSaver( | |||||||
| 		}) | 		}) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | // NOTE: this will set the updated flag ONLY of out of cropped mode...
 | ||||||
| function dataUpdated(){ | function dataUpdated(){ | ||||||
|  | 	if(!isViewCropped()){ | ||||||
| 		fileUpdated('Data') | 		fileUpdated('Data') | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -128,7 +128,7 @@ function getImageGID(image){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // Get marks associated with image...
 | // Get mark elements associated with image...
 | ||||||
| //
 | //
 | ||||||
| // img can be:
 | // img can be:
 | ||||||
| // 	- literal gid
 | // 	- literal gid
 | ||||||
| @ -256,6 +256,9 @@ function getImageBefore(image, ribbon){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | // NOTE: this just shifts the image, it does not care about either 
 | ||||||
|  | // 		aligning nor focus...
 | ||||||
|  | // NOTE: the shiftedImage event is fired BEFORE any ribbons are removed...
 | ||||||
| function shiftTo(image, ribbon){ | function shiftTo(image, ribbon){ | ||||||
| 	var target = getImageBefore(image, ribbon) | 	var target = getImageBefore(image, ribbon) | ||||||
| 	var cur_ribbon = getRibbon(image) | 	var cur_ribbon = getRibbon(image) | ||||||
| @ -265,6 +268,9 @@ function shiftTo(image, ribbon){ | |||||||
| 	if(target.length == 0){ | 	if(target.length == 0){ | ||||||
| 		image.prependTo($(ribbon)) | 		image.prependTo($(ribbon)) | ||||||
| 
 | 
 | ||||||
|  | 	// insert the image...
 | ||||||
|  | 	// NOTE: we need to take care to insert the image not just after the
 | ||||||
|  | 	// 		target, but also after the target's marks...
 | ||||||
| 	} else { | 	} else { | ||||||
| 		var target_marks = getImageMarks(target).last() | 		var target_marks = getImageMarks(target).last() | ||||||
| 		image.insertAfter( | 		image.insertAfter( | ||||||
| @ -277,6 +283,7 @@ function shiftTo(image, ribbon){ | |||||||
| 	// move the marks...
 | 	// move the marks...
 | ||||||
| 	image.after(marks) | 	image.after(marks) | ||||||
| 
 | 
 | ||||||
|  | 	// NOTE: this is intentionally fired BEFORE removing a ribbon...
 | ||||||
| 	$('.viewer').trigger('shiftedImage', [image, cur_ribbon, ribbon]) | 	$('.viewer').trigger('shiftedImage', [image, cur_ribbon, ribbon]) | ||||||
| 
 | 
 | ||||||
| 	// if removing last image out of a ribbon, remove the ribbon....
 | 	// if removing last image out of a ribbon, remove the ribbon....
 | ||||||
| @ -1176,13 +1183,10 @@ function shiftImageTo(image, direction, moving, force_create_ribbon){ | |||||||
| 	var b = moving == 'prev' ? 'nextAll' : 'prevAll'  | 	var b = moving == 'prev' ? 'nextAll' : 'prevAll'  | ||||||
| 	var target = image[a]('.image').first() | 	var target = image[a]('.image').first() | ||||||
| 
 | 
 | ||||||
| 	target = target.length == 0 ? image[b]().first() : target | 	target = target.length == 0 ? image[b]('.image').first() : target | ||||||
| 
 |  | ||||||
| 	// XXX should this be in here or coupled later via an event???
 |  | ||||||
| 	//flashIndicator(direction)
 |  | ||||||
| 
 | 
 | ||||||
| 	shiftImage(direction, image, force_create_ribbon) | 	shiftImage(direction, image, force_create_ribbon) | ||||||
| 	// XXX does this need to be animated???
 | 
 | ||||||
| 	return centerView(focusImage(target), 'css') | 	return centerView(focusImage(target), 'css') | ||||||
| } | } | ||||||
| function shiftImageUp(image, moving){ | function shiftImageUp(image, moving){ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user