mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 11:20:09 +00:00 
			
		
		
		
	fixed an odd bug (attempt II)...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									c09cb28b99
								
							
						
					
					
						commit
						fbeea05cef
					
				| @ -121,6 +121,13 @@ Roadmap | |||||||
| 			|	also, there are times when the ribbon below is partially loaded  | 			|	also, there are times when the ribbon below is partially loaded  | ||||||
| 			|	or at it's edge when there are other images... | 			|	or at it's edge when there are other images... | ||||||
| 			|	NOTE: calling updateImages() will load the correct previews. | 			|	NOTE: calling updateImages() will load the correct previews. | ||||||
|  | 			| | ||||||
|  | 			| The mechanics of this bug: | ||||||
|  | 			| 	- sometimes the .onload handler gets the right image ref in  | ||||||
|  | 			| 	  the closue but a wrong p_url, how can this happen I do not | ||||||
|  | 			| 	  know. | ||||||
|  | 			| 	- slowing down the browser appears to make this happen  | ||||||
|  | 			| 	  less often, is this a race condition? | ||||||
| 		[_] 60% basic dialogs | 		[_] 60% basic dialogs | ||||||
| 			[_] select from list | 			[_] select from list | ||||||
| 			[X] alert | 			[X] alert | ||||||
|  | |||||||
| @ -738,7 +738,6 @@ function updateImage(image, gid, size){ | |||||||
| 	if(img_data == null){ | 	if(img_data == null){ | ||||||
| 		img_data = STUB_IMAGE_DATA | 		img_data = STUB_IMAGE_DATA | ||||||
| 	} | 	} | ||||||
| 	//var name = img_data.path.split('/').pop()
 |  | ||||||
| 
 | 
 | ||||||
| 	// preview...
 | 	// preview...
 | ||||||
| 	// NOTE: pre-caching the url directly instead of referencing it from
 | 	// NOTE: pre-caching the url directly instead of referencing it from
 | ||||||
| @ -747,13 +746,15 @@ function updateImage(image, gid, size){ | |||||||
| 	// 		that sometimes (can't reproduce in a simpler setting) resulted 
 | 	// 		that sometimes (can't reproduce in a simpler setting) resulted 
 | ||||||
| 	// 		in wrong images loading...
 | 	// 		in wrong images loading...
 | ||||||
| 	var p_url = getBestPreview(gid, size).url | 	var p_url = getBestPreview(gid, size).url | ||||||
|  | 	image.data().loading = p_url | ||||||
| 
 | 
 | ||||||
| 	// pre-cache and load image...
 | 	// pre-cache and load image...
 | ||||||
| 	// NOTE: this will make images load without a blackout...
 | 	// NOTE: this will make images load without a blackout...
 | ||||||
| 	var img = new Image() | 	var img = new Image() | ||||||
| 	img.onload = function(){ | 	img.onload = function(){ | ||||||
| 		image.css({ | 		image.css({ | ||||||
| 				'background-image': 'url("'+ p_url +'")', | 				//'background-image': 'url("'+ p_url +'")',
 | ||||||
|  | 				'background-image': 'url("'+ image.data().loading +'")', | ||||||
| 			}) | 			}) | ||||||
| 	} | 	} | ||||||
| 	// NOTE: this better be after the .onload declaration as in some cases
 | 	// NOTE: this better be after the .onload declaration as in some cases
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user