From fd85ee4f4e166add0a04b945533e263da5bfcaee Mon Sep 17 00:00:00 2001 From: Jonathan Nielsen Date: Fri, 4 Oct 2013 10:12:47 -0600 Subject: [PATCH 1/3] Check that zoom reference point is valid before using it --- src/viewport.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/viewport.js b/src/viewport.js index 691851c4..5c4c9f2d 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -551,7 +551,9 @@ $.Viewport.prototype = { */ zoomTo: function( zoom, refPoint, immediately ) { - this.zoomPoint = refPoint instanceof $.Point ? + this.zoomPoint = refPoint instanceof $.Point && + !isNaN(refPoint.x) && + !isNaN(refPoint.y) ? refPoint : null; From ae5acb65471d8c6cd77929e1ee684ec14d6a518c Mon Sep 17 00:00:00 2001 From: Jonathan Nielsen Date: Fri, 4 Oct 2013 13:06:25 -0600 Subject: [PATCH 2/3] Add similar refPoint validity check to zoomBy --- src/viewport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viewport.js b/src/viewport.js index 5c4c9f2d..3fa7077d 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -536,7 +536,7 @@ $.Viewport.prototype = { * @return {OpenSeadragon.Viewport} Chainable. */ zoomBy: function( factor, refPoint, immediately ) { - if( refPoint ) { + if (refPoint instanceof $.Point && !isNaN(refPoint.x) && !isNaN(refPoint.y)) { refPoint = refPoint.rotate( -this.degrees, new $.Point( this.centerSpringX.target.value, this.centerSpringY.target.value ) From c5ac5b6550a2b42ef0f62e7b132eb461319745d1 Mon Sep 17 00:00:00 2001 From: Jonathan Nielsen Date: Fri, 4 Oct 2013 13:09:58 -0600 Subject: [PATCH 3/3] whitespace formatting change --- src/viewport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viewport.js b/src/viewport.js index 3fa7077d..49f70478 100644 --- a/src/viewport.js +++ b/src/viewport.js @@ -536,7 +536,7 @@ $.Viewport.prototype = { * @return {OpenSeadragon.Viewport} Chainable. */ zoomBy: function( factor, refPoint, immediately ) { - if (refPoint instanceof $.Point && !isNaN(refPoint.x) && !isNaN(refPoint.y)) { + if( refPoint instanceof $.Point && !isNaN( refPoint.x ) && !isNaN( refPoint.y ) ) { refPoint = refPoint.rotate( -this.degrees, new $.Point( this.centerSpringX.target.value, this.centerSpringY.target.value )