mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-24 22:26:10 +03:00
Added viewport-change event; fixed spring reset
This commit is contained in:
parent
732cd87a10
commit
897a237807
@ -44,6 +44,8 @@ OPENSEADRAGON CHANGELOG
|
||||
* Added union() to OpenSeadragon.Rect
|
||||
* Fixed an error in fitBounds if the new and old bounds were extremely close in size
|
||||
* 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)
|
||||
|
||||
1.2.1: (in progress)
|
||||
|
||||
|
@ -117,10 +117,8 @@ $.Spring.prototype = /** @lends OpenSeadragon.Spring.prototype */{
|
||||
* @param {Number} target
|
||||
*/
|
||||
resetTo: function( target ) {
|
||||
this.target.value = target;
|
||||
this.target.time = this.current.time;
|
||||
this.start.value = this.target.value;
|
||||
this.start.time = this.target.time;
|
||||
this.start.value = this.target.value = this.current.value = target;
|
||||
this.start.time = this.target.time = this.current.time = $.now();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -409,8 +409,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
||||
|
||||
this._xSpring.resetTo(position.x);
|
||||
this._ySpring.resetTo(position.y);
|
||||
this._xSpring.update();
|
||||
this._ySpring.update();
|
||||
} else {
|
||||
if (sameTarget) {
|
||||
return;
|
||||
@ -454,7 +452,6 @@ $.extend($.TiledImage.prototype, $.EventSource.prototype, /** @lends OpenSeadrag
|
||||
}
|
||||
|
||||
this._scaleSpring.resetTo(scale);
|
||||
this._scaleSpring.update();
|
||||
this._updateForScale();
|
||||
} else {
|
||||
if (sameTarget) {
|
||||
|
@ -2798,13 +2798,10 @@ function updateMulti( viewer ) {
|
||||
|
||||
function updateOnce( viewer ) {
|
||||
|
||||
var containerSize,
|
||||
animated;
|
||||
|
||||
//viewer.profiler.beginUpdate();
|
||||
|
||||
if ( viewer.autoResize ) {
|
||||
containerSize = _getSafeElemSize( viewer.container );
|
||||
var containerSize = _getSafeElemSize( viewer.container );
|
||||
if ( !containerSize.equals( THIS[ viewer.hash ].prevContainerSize ) ) {
|
||||
// maintain image position
|
||||
var oldBounds = viewer.viewport.getBounds();
|
||||
@ -2815,8 +2812,22 @@ function updateOnce( viewer ) {
|
||||
}
|
||||
}
|
||||
|
||||
animated = viewer.viewport.update();
|
||||
animated = viewer.world.update() || animated;
|
||||
var viewportChange = viewer.viewport.update();
|
||||
var animated = viewer.world.update() || viewportChange;
|
||||
|
||||
if (viewportChange) {
|
||||
/**
|
||||
* Raised when any spring animation update occurs (zoom, pan, etc.),
|
||||
* before the viewer has drawn the new location.
|
||||
*
|
||||
* @event viewport-change
|
||||
* @memberof OpenSeadragon.Viewer
|
||||
* @type {object}
|
||||
* @property {OpenSeadragon.Viewer} eventSource - A reference to the Viewer which raised this event.
|
||||
* @property {?Object} userData - Arbitrary subscriber-defined object.
|
||||
*/
|
||||
viewer.raiseEvent('viewport-change');
|
||||
}
|
||||
|
||||
if( viewer.referenceStrip ){
|
||||
animated = viewer.referenceStrip.update( viewer.viewport ) || animated;
|
||||
@ -2847,7 +2858,8 @@ function updateOnce( viewer ) {
|
||||
|
||||
if (animated) {
|
||||
/**
|
||||
* Raised when any spring animation update occurs (zoom, pan, etc.).
|
||||
* Raised when any spring animation update occurs (zoom, pan, etc.),
|
||||
* after the viewer has drawn the new location.
|
||||
*
|
||||
* @event animation
|
||||
* @memberof OpenSeadragon.Viewer
|
||||
|
Loading…
Reference in New Issue
Block a user