mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-31 23:21:42 +03:00
Restore applyConstraints to avoid panning when clicking at max zoom.
This commit is contained in:
parent
0c398eacdb
commit
07d66ce655
@ -474,6 +474,13 @@ $.Viewport.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// private
|
||||||
|
_applyZoomConstraints: function(zoom) {
|
||||||
|
return Math.max(
|
||||||
|
Math.min(zoom, this.getMaxZoom()),
|
||||||
|
this.getMinZoom());
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function
|
* @function
|
||||||
* @private
|
* @private
|
||||||
@ -563,7 +570,23 @@ $.Viewport.prototype = {
|
|||||||
* @fires OpenSeadragon.Viewer.event:constrain
|
* @fires OpenSeadragon.Viewer.event:constrain
|
||||||
*/
|
*/
|
||||||
applyConstraints: function(immediately) {
|
applyConstraints: function(immediately) {
|
||||||
this.fitBoundsWithConstraints(this.getBounds(), immediately);
|
var actualZoom = this.getZoom();
|
||||||
|
var constrainedZoom = this._applyZoomConstraints(actualZoom);
|
||||||
|
|
||||||
|
if (actualZoom !== constrainedZoom) {
|
||||||
|
this.zoomTo(constrainedZoom, this.zoomPoint, immediately);
|
||||||
|
}
|
||||||
|
|
||||||
|
var bounds = this.getBoundsNoRotate();
|
||||||
|
var constrainedBounds = this._applyBoundaryConstraints(
|
||||||
|
bounds, immediately);
|
||||||
|
|
||||||
|
if (bounds.x !== constrainedBounds.x ||
|
||||||
|
bounds.y !== constrainedBounds.y ||
|
||||||
|
immediately) {
|
||||||
|
this.fitBounds(constrainedBounds.rotate(this.getRotation()),
|
||||||
|
immediately);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -615,10 +638,7 @@ $.Viewport.prototype = {
|
|||||||
|
|
||||||
if (constraints) {
|
if (constraints) {
|
||||||
var newBoundsAspectRatio = newBounds.getAspectRatio();
|
var newBoundsAspectRatio = newBounds.getAspectRatio();
|
||||||
var newConstrainedZoom = Math.max(
|
var newConstrainedZoom = this._applyZoomConstraints(newZoom);
|
||||||
Math.min(newZoom, this.getMaxZoom()),
|
|
||||||
this.getMinZoom()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (newZoom !== newConstrainedZoom) {
|
if (newZoom !== newConstrainedZoom) {
|
||||||
newZoom = newConstrainedZoom;
|
newZoom = newConstrainedZoom;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user