mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Fixed change detection for viewport (after recent spring change)
This commit is contained in:
parent
adbde4682f
commit
2b9a51036f
@ -132,6 +132,10 @@ $.Viewport = function( options ) {
|
|||||||
animationTime: this.animationTime
|
animationTime: this.animationTime
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this._oldCenterX = this.centerSpringX.current.value;
|
||||||
|
this._oldCenterY = this.centerSpringY.current.value;
|
||||||
|
this._oldZoom = this.zoomSpring.current.value;
|
||||||
|
|
||||||
if (this.contentSize) {
|
if (this.contentSize) {
|
||||||
this.resetContentSize( this.contentSize );
|
this.resetContentSize( this.contentSize );
|
||||||
} else {
|
} else {
|
||||||
@ -856,10 +860,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
|||||||
* @function
|
* @function
|
||||||
*/
|
*/
|
||||||
update: function() {
|
update: function() {
|
||||||
var oldCenterX = this.centerSpringX.current.value,
|
var oldZoomPixel,
|
||||||
oldCenterY = this.centerSpringY.current.value,
|
|
||||||
oldZoom = this.zoomSpring.current.value,
|
|
||||||
oldZoomPixel,
|
|
||||||
newZoomPixel,
|
newZoomPixel,
|
||||||
deltaZoomPixels,
|
deltaZoomPixels,
|
||||||
deltaZoomPoints;
|
deltaZoomPoints;
|
||||||
@ -870,7 +871,7 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
|||||||
|
|
||||||
this.zoomSpring.update();
|
this.zoomSpring.update();
|
||||||
|
|
||||||
if (this.zoomPoint && this.zoomSpring.current.value != oldZoom) {
|
if (this.zoomPoint && this.zoomSpring.current.value != this._oldZoom) {
|
||||||
newZoomPixel = this.pixelFromPoint( this.zoomPoint, true );
|
newZoomPixel = this.pixelFromPoint( this.zoomPoint, true );
|
||||||
deltaZoomPixels = newZoomPixel.minus( oldZoomPixel );
|
deltaZoomPixels = newZoomPixel.minus( oldZoomPixel );
|
||||||
deltaZoomPoints = this.deltaPointsFromPixels( deltaZoomPixels, true );
|
deltaZoomPoints = this.deltaPointsFromPixels( deltaZoomPixels, true );
|
||||||
@ -884,9 +885,15 @@ $.Viewport.prototype = /** @lends OpenSeadragon.Viewport.prototype */{
|
|||||||
this.centerSpringX.update();
|
this.centerSpringX.update();
|
||||||
this.centerSpringY.update();
|
this.centerSpringY.update();
|
||||||
|
|
||||||
return this.centerSpringX.current.value != oldCenterX ||
|
var changed = this.centerSpringX.current.value != this._oldCenterX ||
|
||||||
this.centerSpringY.current.value != oldCenterY ||
|
this.centerSpringY.current.value != this._oldCenterY ||
|
||||||
this.zoomSpring.current.value != oldZoom;
|
this.zoomSpring.current.value != this._oldZoom;
|
||||||
|
|
||||||
|
this._oldCenterX = this.centerSpringX.current.value;
|
||||||
|
this._oldCenterY = this.centerSpringY.current.value;
|
||||||
|
this._oldZoom = this.zoomSpring.current.value;
|
||||||
|
|
||||||
|
return changed;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user