mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 06:36:11 +03:00
Merge pull request #247 from jmnetus/master
Check that zoom reference point is valid before using it
This commit is contained in:
commit
45ee8236e3
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user