mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-30 19:00:09 +00:00 
			
		
		
		
	added getDPI() function -- not yet sure if it should be as it is...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									147a28ed27
								
							
						
					
					
						commit
						3a96a5a08a
					
				| @ -728,6 +728,39 @@ function makeDeferredsQ(first){ | |||||||
| 
 | 
 | ||||||
| /**************************************************** JS utilities ***/ | /**************************************************** JS utilities ***/ | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | // Get screen dpi...
 | ||||||
|  | //
 | ||||||
|  | // This will calculate the value and save it to screen.dpi
 | ||||||
|  | //
 | ||||||
|  | // if force is true this will re-calculate the value.
 | ||||||
|  | //
 | ||||||
|  | // NOTE: this needs the body loaded to work...
 | ||||||
|  | // NOTE: this may depend on page zoom...
 | ||||||
|  | // NOTE: yes, this is a hack, but since we have no other reliable way to
 | ||||||
|  | // 		do this...
 | ||||||
|  | function getDPI(force){ | ||||||
|  | 	if(screen.dpi == null || force){ | ||||||
|  | 		var e = $('<div id="inch">') | ||||||
|  | 			.css({ | ||||||
|  | 				position: 'absolute', | ||||||
|  | 				width: '1in', | ||||||
|  | 				left: '-100%', | ||||||
|  | 				top: '-100%' | ||||||
|  | 			}) | ||||||
|  | 			.appendTo($('body')) | ||||||
|  | 		var res = e.width() | ||||||
|  | 		e.remove() | ||||||
|  | 		screen.dpi = res | ||||||
|  | 		return res	 | ||||||
|  | 	} else { | ||||||
|  | 		return screen.dpi | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | // XXX is this correct???
 | ||||||
|  | $(getDPI) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| // return 1, -1, or 0 depending on sign of x
 | // return 1, -1, or 0 depending on sign of x
 | ||||||
| function sign(x){ | function sign(x){ | ||||||
| 	return (x > 0) - (x < 0) | 	return (x > 0) - (x < 0) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user