Merge pull request #1572 from jesstelford/zoom-content-size
More natural zooming on block level elements
This commit is contained in:
		| @@ -11,7 +11,17 @@ | |||||||
| 		if( event[ modifier ] && isEnabled ) { | 		if( event[ modifier ] && isEnabled ) { | ||||||
| 			event.preventDefault(); | 			event.preventDefault(); | ||||||
|  |  | ||||||
| 			var bounds = event.target.getBoundingClientRect(); | 			var bounds; | ||||||
|  | 			var originalDisplay = event.target.style.display; | ||||||
|  |  | ||||||
|  | 			// Get the bounding rect of the contents, not the containing box | ||||||
|  | 			if (window.getComputedStyle(event.target).display === 'block') { | ||||||
|  | 				event.target.style.display = 'inline-block'; | ||||||
|  | 				bounds = event.target.getBoundingClientRect(); | ||||||
|  | 				event.target.style.display = originalDisplay; | ||||||
|  | 			} else { | ||||||
|  | 				bounds = event.target.getBoundingClientRect(); | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 			zoom.to({ | 			zoom.to({ | ||||||
| 				x: ( bounds.left * revealScale ) - zoomPadding, | 				x: ( bounds.left * revealScale ) - zoomPadding, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user