mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-11-03 21:00:14 +00:00 
			
		
		
		
	several fixes and tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									9a9fa74ecb
								
							
						
					
					
						commit
						7d928fd50c
					
				@ -431,7 +431,7 @@ function extendRibbon(left, right, ribbon, no_compensate_shift){
 | 
				
			|||||||
	l = isNaN(l) ? 0 : l
 | 
						l = isNaN(l) ? 0 : l
 | 
				
			||||||
	// compensate for left shift...
 | 
						// compensate for left shift...
 | 
				
			||||||
	if(!no_compensate_shift && left != 0){
 | 
						if(!no_compensate_shift && left != 0){
 | 
				
			||||||
		l -= left * images.outerWidth()
 | 
							l -= left * images.outerWidth(true)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ribbon.css({
 | 
							ribbon.css({
 | 
				
			||||||
			left: l,
 | 
								left: l,
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										14
									
								
								ui/data.js
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								ui/data.js
									
									
									
									
									
								
							@ -716,6 +716,7 @@ function convertDataGen1(data, cmp){
 | 
				
			|||||||
// NOTE: care must be taken to reset ALL attributes an image can have,
 | 
					// NOTE: care must be taken to reset ALL attributes an image can have,
 | 
				
			||||||
// 		a common bug if this is not done correctly, is that some settings
 | 
					// 		a common bug if this is not done correctly, is that some settings
 | 
				
			||||||
// 		may leak to newly loaded images...
 | 
					// 		may leak to newly loaded images...
 | 
				
			||||||
 | 
					// XXX do a pre-caching framework...
 | 
				
			||||||
function updateImage(image, gid, size){
 | 
					function updateImage(image, gid, size){
 | 
				
			||||||
	image = $(image)
 | 
						image = $(image)
 | 
				
			||||||
	var oldgid = getImageGID(image)
 | 
						var oldgid = getImageGID(image)
 | 
				
			||||||
@ -750,14 +751,23 @@ function updateImage(image, gid, size){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	// 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...
 | 
				
			||||||
 | 
						// XXX add a cache of the form:
 | 
				
			||||||
 | 
						// 			{
 | 
				
			||||||
 | 
						// 				[<gid>, <size>]: Image,
 | 
				
			||||||
 | 
						// 				...
 | 
				
			||||||
 | 
						// 			}
 | 
				
			||||||
 | 
						// 		- sort by use...
 | 
				
			||||||
 | 
						// 		- limit length...
 | 
				
			||||||
 | 
						//
 | 
				
			||||||
 | 
						// 		...might also be a good idea to split cache to sizes and have
 | 
				
			||||||
 | 
						// 		different  but as limits for different sizes, but as sizes 
 | 
				
			||||||
 | 
						// 		can differ between images this is not trivial...
 | 
				
			||||||
	var img = new Image()
 | 
						var img = new Image()
 | 
				
			||||||
	img.onload = function(){
 | 
						img.onload = function(){
 | 
				
			||||||
		image.css({
 | 
							image.css({
 | 
				
			||||||
				'background-image': 'url("'+ image.data().loading +'")',
 | 
									'background-image': 'url("'+ image.data().loading +'")',
 | 
				
			||||||
			})
 | 
								})
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// NOTE: this better be after the .onload declaration as in some cases
 | 
					 | 
				
			||||||
	// 		we can get a cached image load "too fast"...
 | 
					 | 
				
			||||||
	img.src = p_url
 | 
						img.src = p_url
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// main attrs...
 | 
						// main attrs...
 | 
				
			||||||
 | 
				
			|||||||
@ -86,7 +86,9 @@ function setupDataBindings(viewer){
 | 
				
			|||||||
					// also load if we run out of images in the current ribbon,
 | 
										// also load if we run out of images in the current ribbon,
 | 
				
			||||||
					// likely due to shifting...
 | 
										// likely due to shifting...
 | 
				
			||||||
					|| ( gr.length > l 
 | 
										|| ( gr.length > l 
 | 
				
			||||||
						&& l < screen_size * LOAD_SCREENS)){
 | 
											&& l < Math.round(screen_size * LOAD_SCREENS))){
 | 
				
			||||||
 | 
									// XXX in some cases this makes the current ribbon align 
 | 
				
			||||||
 | 
									// 		in a wrong way...
 | 
				
			||||||
				loadImages(gid, Math.round(screen_size * LOAD_SCREENS), ribbon)
 | 
									loadImages(gid, Math.round(screen_size * LOAD_SCREENS), ribbon)
 | 
				
			||||||
			} 
 | 
								} 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user