mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	fixed a load problem -- ribbons.getVisibleImageSize(..) returned Infinity when no images loaded which resulted in loading EVERYTHING at once and then trimming...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									6c1c9b6e58
								
							
						
					
					
						commit
						f1c9bdce93
					
				| @ -140,8 +140,10 @@ dev: css | |||||||
| chrome-app: $(APP_ZIP) $(CHROME_APP_BUILD_DIR) | chrome-app: $(APP_ZIP) $(CHROME_APP_BUILD_DIR) | ||||||
| 	unzip -u $(APP_ZIP) -d $(CHROME_APP_BUILD_DIR) | 	unzip -u $(APP_ZIP) -d $(CHROME_APP_BUILD_DIR) | ||||||
| 	cp manifest.json $(CHROME_APP_BUILD_DIR) | 	cp manifest.json $(CHROME_APP_BUILD_DIR) | ||||||
|  | 	cp -R images $(CHROME_APP_BUILD_DIR) | ||||||
| 	rm -rf $(CHROME_APP_BUILD_DIR)/node_modules/ | 	rm -rf $(CHROME_APP_BUILD_DIR)/node_modules/ | ||||||
| 	#chrome --pack-extension=$(CHROME_APP_BUILD_DIR) --pack-extension-key=$(CHROME_APP_KEY) | 	# this needs to be OS independent... | ||||||
|  | 	chrome --pack-extension=$(CHROME_APP_BUILD_DIR) --pack-extension-key=$(CHROME_APP_KEY) | ||||||
| 
 | 
 | ||||||
| # node-webkit win32
 | # node-webkit win32
 | ||||||
| win32: $(APP_ZIP) $(WIN_BUILD_DIR) | win32: $(APP_ZIP) $(WIN_BUILD_DIR) | ||||||
|  | |||||||
| @ -212,18 +212,41 @@ module.RibbonsPrototype = { | |||||||
| 	// 		gets the visible size of the image tile in pixels.
 | 	// 		gets the visible size of the image tile in pixels.
 | ||||||
| 	//
 | 	//
 | ||||||
| 	// XXX try and make image size the product of vmin and scale...
 | 	// XXX try and make image size the product of vmin and scale...
 | ||||||
|  | 	// XXX this might break when no images are loaded and proportions 
 | ||||||
|  | 	// 		are not square...
 | ||||||
| 	getVisibleImageSize: function(dim, scale){ | 	getVisibleImageSize: function(dim, scale){ | ||||||
| 		scale = scale || this.getScale() | 		scale = scale || this.getScale() | ||||||
| 		dim = dim == null ? 'width' : dim | 		dim = dim == null ? 'width' : dim | ||||||
| 		var img = this.viewer.find(IMAGE) | 		var img = this.viewer.find(IMAGE) | ||||||
|  | 		var tmp | ||||||
| 
 | 
 | ||||||
| 		return dim == 'height' ? img.outerHeight(true) * scale | 		// if no images are loaded create one temporarily....
 | ||||||
|  | 		if(img.length == 0){ | ||||||
|  | 			img = tmp = this.createImage('__tmp_image__') | ||||||
|  | 				.css({ | ||||||
|  | 					position: 'absolute', | ||||||
|  | 					visibility: 'hidden', | ||||||
|  | 					top: '-200%', | ||||||
|  | 					left: '-200%', | ||||||
|  | 				}) | ||||||
|  | 				.appendTo(this.viewer) | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		// do the calc...
 | ||||||
|  | 		var res = dim == 'height' ? img.outerHeight(true) * scale | ||||||
| 			: dim == 'width' ? img.outerWidth(true) * scale | 			: dim == 'width' ? img.outerWidth(true) * scale | ||||||
| 			: dim == 'max' ? | 			: dim == 'max' ? | ||||||
| 				Math.max(img.outerHeight(true), img.outerWidth(true)) * scale | 				Math.max(img.outerHeight(true), img.outerWidth(true)) * scale | ||||||
| 			: dim == 'min' ? | 			: dim == 'min' ? | ||||||
| 				Math.min(img.outerHeight(true), img.outerWidth(true)) * scale | 				Math.min(img.outerHeight(true), img.outerWidth(true)) * scale | ||||||
| 			: null | 			: null | ||||||
|  | 
 | ||||||
|  | 		// remove the tmp image we created...
 | ||||||
|  | 		if(tmp != null){ | ||||||
|  | 			tmp.remove() | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
|  | 		return res | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	getScreenWidthImages: function(scale, min){ | 	getScreenWidthImages: function(scale, min){ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user