Merge pull request #247 from jmnetus/master

Check that zoom reference point is valid before using it
This commit is contained in:
iangilman 2013-10-08 10:17:29 -07:00
commit 45ee8236e3

View File

@ -536,7 +536,7 @@ $.Viewport.prototype = {
* @return {OpenSeadragon.Viewport} Chainable. * @return {OpenSeadragon.Viewport} Chainable.
*/ */
zoomBy: function( factor, refPoint, immediately ) { zoomBy: function( factor, refPoint, immediately ) {
if( refPoint ) { if( refPoint instanceof $.Point && !isNaN( refPoint.x ) && !isNaN( refPoint.y ) ) {
refPoint = refPoint.rotate( refPoint = refPoint.rotate(
-this.degrees, -this.degrees,
new $.Point( this.centerSpringX.target.value, this.centerSpringY.target.value ) new $.Point( this.centerSpringX.target.value, this.centerSpringY.target.value )
@ -551,7 +551,9 @@ $.Viewport.prototype = {
*/ */
zoomTo: function( zoom, refPoint, immediately ) { zoomTo: function( zoom, refPoint, immediately ) {
this.zoomPoint = refPoint instanceof $.Point ? this.zoomPoint = refPoint instanceof $.Point &&
!isNaN(refPoint.x) &&
!isNaN(refPoint.y) ?
refPoint : refPoint :
null; null;