* Fixed an error in fitBounds that occurred sometimes with immediately = true

This commit is contained in:
Ian Gilman 2015-01-20 17:19:13 -08:00
parent ec2e4a4e8f
commit 2172da6aaa
2 changed files with 8 additions and 1 deletions

View File

@ -46,6 +46,7 @@ OPENSEADRAGON CHANGELOG
* Added ajaxWithCredentials option (#543)
* Added viewport-change event for after the viewport changes but before it's drawn
* A spring's current value is now updated immediately on reset (#524)
* Fixed an error in fitBounds that occurred sometimes with immediately = true
1.2.1: (in progress)

View File

@ -588,11 +588,17 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
}
newBounds = this._applyBoundaryConstraints( newBounds, immediately );
center = newBounds.getCenter();
}
if (immediately) {
this.panTo( center, true );
return this.zoomTo(newZoom, null, true);
}
if (Math.abs(newZoom - oldZoom) < 0.00000000001 ||
Math.abs(newBounds.width - oldBounds.width) < 0.00000000001) {
return this.panTo( constraints ? newBounds.getCenter() : center, immediately );
return this.panTo( center, immediately );
}
referencePoint = oldBounds.getTopLeft().times(