Merge pull request #1330 from ncmikkelsen/master

Fix for #1085 - goToPage : event sent before updating the index
This commit is contained in:
Ian Gilman 2017-10-30 09:17:42 -07:00 committed by GitHub
commit 854086a62f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1835,6 +1835,16 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
*/ */
goToPage: function( page ){ goToPage: function( page ){
if( this.tileSources && page >= 0 && page < this.tileSources.length ){ if( this.tileSources && page >= 0 && page < this.tileSources.length ){
this._sequenceIndex = page;
this._updateSequenceButtons( page );
this.open( this.tileSources[ page ] );
if( this.referenceStrip ){
this.referenceStrip.setFocus( page );
}
/** /**
* Raised when the page is changed on a viewer configured with multiple image sources (see {@link OpenSeadragon.Viewer#goToPage}). * Raised when the page is changed on a viewer configured with multiple image sources (see {@link OpenSeadragon.Viewer#goToPage}).
* *
@ -1846,16 +1856,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
* @property {?Object} userData - Arbitrary subscriber-defined object. * @property {?Object} userData - Arbitrary subscriber-defined object.
*/ */
this.raiseEvent( 'page', { page: page } ); this.raiseEvent( 'page', { page: page } );
this._sequenceIndex = page;
this._updateSequenceButtons( page );
this.open( this.tileSources[ page ] );
if( this.referenceStrip ){
this.referenceStrip.setFocus( page );
}
} }
return this; return this;