fix for #1210 (Dinamically show ReferenceStrip) additional changes

This commit is contained in:
Robert Saric 2017-06-24 17:58:19 +02:00
parent a783edc76f
commit ec7e5e5419

View File

@ -504,10 +504,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
} }
if (this.sequenceMode && $.isArray(tileSources)) { if (this.sequenceMode && $.isArray(tileSources)) {
if (this.referenceStrip) { this.removeReferenceStrip();
this.referenceStrip.destroy();
this.referenceStrip = null;
}
if (typeof initialPage != 'undefined' && !isNaN(initialPage)) { if (typeof initialPage != 'undefined' && !isNaN(initialPage)) {
this.initialPage = initialPage; this.initialPage = initialPage;
@ -519,19 +516,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
this.open(this.tileSources[this._sequenceIndex]); this.open(this.tileSources[this._sequenceIndex]);
if ( this.showReferenceStrip ){ if ( this.showReferenceStrip ){
this.referenceStrip = new $.ReferenceStrip({ this.addReferenceStrip();
id: this.referenceStripElement,
position: this.referenceStripPosition,
sizeRatio: this.referenceStripSizeRatio,
scroll: this.referenceStripScroll,
height: this.referenceStripHeight,
width: this.referenceStripWidth,
tileSources: this.tileSources,
prefixUrl: this.prefixUrl,
viewer: this
});
this.referenceStrip.setFocus( this._sequenceIndex );
} }
} }
@ -2136,20 +2121,18 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
/** /**
* Remove the reference strip. * Remove the reference strip.
* @param {Boolean} hide - Disables automatic showing of the reference strip in the future until manually re-enabled.
* @function * @function
* @return {OpenSeadragon.Viewer} Chainable.
*/ */
removeReferenceStrip: function() { removeReferenceStrip: function(hide) {
this.showReferenceStrip = false; if (hide) {
this.showReferenceStrip = false;
if (this.sequenceMode) {
if (this.referenceStrip) {
this.referenceStrip.destroy();
this.referenceStrip = null;
}
} }
return this; if (this.referenceStrip) {
this.referenceStrip.destroy();
this.referenceStrip = null;
}
}, },
/** /**
@ -2162,8 +2145,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
if (this.sequenceMode) { if (this.sequenceMode) {
if (this.referenceStrip) { if (this.referenceStrip) {
this.referenceStrip.destroy(); return this;
this.referenceStrip = null;
} }
if (this.tileSources.length && this.tileSources.length > 1) { if (this.tileSources.length && this.tileSources.length > 1) {