mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-21 20:56:09 +03:00
ReferenceStrip fixes
This commit is contained in:
parent
4bd4dd5618
commit
0e31b67ca5
@ -289,6 +289,13 @@ $.extend( $.ReferenceStrip.prototype, $.EventSource.prototype, $.Viewer.prototyp
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
// Overrides Viewer.destroy
|
||||
destroy: function() {
|
||||
if (this.element) {
|
||||
this.element.parentNode.removeChild(this.element);
|
||||
}
|
||||
}
|
||||
|
||||
} );
|
||||
@ -467,7 +474,7 @@ function loadPanels( strip, viewerSize, scroll ) {
|
||||
*/
|
||||
function onStripEnter( event ) {
|
||||
var element = event.eventSource.element;
|
||||
|
||||
|
||||
//$.setElementOpacity(element, 0.8);
|
||||
|
||||
//element.style.border = '1px solid #555';
|
||||
@ -495,7 +502,7 @@ function onStripEnter( event ) {
|
||||
*/
|
||||
function onStripExit( event ) {
|
||||
var element = event.eventSource.element;
|
||||
|
||||
|
||||
if ( 'horizontal' == this.scroll ) {
|
||||
|
||||
//element.style.paddingTop = "10px";
|
||||
|
@ -487,39 +487,14 @@ $.Viewer = function( options ) {
|
||||
});
|
||||
}
|
||||
|
||||
//Instantiate a referencestrip if configured
|
||||
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,
|
||||
tileHost: this.tileHost,
|
||||
prefixUrl: this.prefixUrl,
|
||||
viewer: this
|
||||
});
|
||||
}
|
||||
|
||||
// Sequence mode
|
||||
if (this.sequenceMode) {
|
||||
if (this.tileSources && this.tileSources.length) {
|
||||
this._sequenceIndex = Math.max(0, Math.min(this.tileSources.length - 1, this.initialPage));
|
||||
}
|
||||
|
||||
this.bindSequenceControls();
|
||||
}
|
||||
|
||||
// Open initial tilesources
|
||||
if ( this.tileSources && this.tileSources.length) {
|
||||
if (this.sequenceMode) {
|
||||
this.open(this.tileSources[this._sequenceIndex]);
|
||||
this._updateSequenceButtons( this._sequenceIndex );
|
||||
} else {
|
||||
this.open( this.tileSources );
|
||||
}
|
||||
this.open( this.tileSources );
|
||||
}
|
||||
|
||||
// Add custom controls
|
||||
@ -582,10 +557,30 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
}
|
||||
|
||||
if (this.sequenceMode && $.isArray(tileSources)) {
|
||||
if (this.referenceStrip) {
|
||||
this.referenceStrip.destroy();
|
||||
this.referenceStrip = null;
|
||||
}
|
||||
|
||||
this.tileSources = tileSources;
|
||||
this._sequenceIndex = 0;
|
||||
if (tileSources.length) {
|
||||
this.open(tileSources[0]);
|
||||
this._sequenceIndex = Math.max(0, Math.min(this.tileSources.length - 1, this.initialPage));
|
||||
if (this.tileSources.length) {
|
||||
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,
|
||||
tileHost: this.tileHost,
|
||||
prefixUrl: this.prefixUrl,
|
||||
viewer: this
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this._updateSequenceButtons( this._sequenceIndex );
|
||||
@ -772,6 +767,11 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
||||
//this.unbindSequenceControls()
|
||||
//this.unbindStandardControls()
|
||||
|
||||
if (this.referenceStrip) {
|
||||
this.referenceStrip.destroy();
|
||||
this.referenceStrip = null;
|
||||
}
|
||||
|
||||
if ( this._updateRequestId !== null ) {
|
||||
$.cancelAnimationFrame( this._updateRequestId );
|
||||
this._updateRequestId = null;
|
||||
|
@ -6,7 +6,7 @@
|
||||
init: function() {
|
||||
var self = this;
|
||||
|
||||
var testInitialOpen = true;
|
||||
var testInitialOpen = false;
|
||||
var testOverlays = false;
|
||||
var testMargins = false;
|
||||
var testNavigator = false;
|
||||
@ -106,8 +106,9 @@
|
||||
});
|
||||
}
|
||||
|
||||
// this.crossTest2();
|
||||
// this.collectionTest();
|
||||
if (!testInitialOpen) {
|
||||
this.collectionTest();
|
||||
}
|
||||
},
|
||||
|
||||
// ----------
|
||||
|
Loading…
Reference in New Issue
Block a user