Merge pull request #1213 from VipSaran/master

fix for #1210 (Dinamically show ReferenceStrip)
This commit is contained in:
Ian Gilman 2017-07-05 09:38:29 -07:00 committed by GitHub
commit 818d445ec9

View File

@ -519,19 +519,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
this.open(this.tileSources[this._sequenceIndex]);
if ( this.showReferenceStrip ){
this.referenceStrip = new $.ReferenceStrip({
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 );
this.addReferenceStrip();
}
}
@ -2155,6 +2143,51 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
*/
_cancelPendingImages: function() {
this._loadQueue = [];
},
/**
* Removes the reference strip and disables displaying it.
* @function
*/
removeReferenceStrip: function() {
this.showReferenceStrip = false;
if (this.referenceStrip) {
this.referenceStrip.destroy();
this.referenceStrip = null;
}
},
/**
* Enables and displays the reference strip based on the currently set tileSources.
* @function
*/
addReferenceStrip: function() {
this.showReferenceStrip = true;
if (this.sequenceMode) {
if (this.referenceStrip) {
return;
}
if (this.tileSources.length && this.tileSources.length > 1) {
this.referenceStrip = new $.ReferenceStrip({
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 );
}
} else {
$.console.warn('Attempting to display a reference strip while "sequenceMode" is off.');
}
}
});