mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-22 01:33:14 +03:00
better lazy loading for image reference strip and more options for managing additional html content that is available in full page mode and normal mode
This commit is contained in:
parent
bebc7a64ff
commit
8fab8b5051
@ -6,7 +6,7 @@
|
|||||||
PROJECT: openseadragon
|
PROJECT: openseadragon
|
||||||
BUILD_MAJOR: 0
|
BUILD_MAJOR: 0
|
||||||
BUILD_MINOR: 9
|
BUILD_MINOR: 9
|
||||||
BUILD_ID: 76
|
BUILD_ID: 80
|
||||||
BUILD: ${PROJECT}.${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
|
BUILD: ${PROJECT}.${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
|
||||||
VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
|
VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
|
||||||
|
|
||||||
|
141
openseadragon.js
141
openseadragon.js
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @version OpenSeadragon 0.9.76
|
* @version OpenSeadragon 0.9.80
|
||||||
*
|
*
|
||||||
* @fileOverview
|
* @fileOverview
|
||||||
* <h2>
|
* <h2>
|
||||||
@ -3849,7 +3849,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
*/
|
*/
|
||||||
isFullPage: function () {
|
isFullPage: function () {
|
||||||
return this.container.parentNode == document.body;
|
return this.element.parentNode == document.body;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@ -3866,7 +3866,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
var body = document.body,
|
var body = document.body,
|
||||||
bodyStyle = body.style,
|
bodyStyle = body.style,
|
||||||
docStyle = document.documentElement.style,
|
docStyle = document.documentElement.style,
|
||||||
containerStyle = this.container.style,
|
containerStyle = this.element.style,
|
||||||
canvasStyle = this.canvas.style,
|
canvasStyle = this.canvas.style,
|
||||||
oldBounds,
|
oldBounds,
|
||||||
newBounds,
|
newBounds,
|
||||||
@ -3895,7 +3895,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
canvasStyle.backgroundColor = "black";
|
canvasStyle.backgroundColor = "black";
|
||||||
canvasStyle.color = "white";
|
canvasStyle.color = "white";
|
||||||
|
|
||||||
containerStyle.position = "fixed";
|
//containerStyle.position = "fixed";
|
||||||
|
|
||||||
//when entering full screen on the ipad it wasnt sufficient to leave
|
//when entering full screen on the ipad it wasnt sufficient to leave
|
||||||
//the body intact as only only the top half of the screen would
|
//the body intact as only only the top half of the screen would
|
||||||
@ -3903,6 +3903,9 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
//them as touch events on the document body. Thus we remove and store
|
//them as touch events on the document body. Thus we remove and store
|
||||||
//the bodies elements and replace them when we leave full screen.
|
//the bodies elements and replace them when we leave full screen.
|
||||||
this.previousBody = [];
|
this.previousBody = [];
|
||||||
|
THIS[ this.hash ].prevElementParent = this.element.parentNode;
|
||||||
|
THIS[ this.hash ].prevNextSibling = this.element.prevNextSibling;
|
||||||
|
THIS[ this.hash ].prevElementSize = $.getElementSize( this.element );
|
||||||
nodes = body.childNodes.length;
|
nodes = body.childNodes.length;
|
||||||
for ( i = 0; i < nodes; i ++ ){
|
for ( i = 0; i < nodes; i ++ ){
|
||||||
this.previousBody.push( body.childNodes[ 0 ] );
|
this.previousBody.push( body.childNodes[ 0 ] );
|
||||||
@ -3924,14 +3927,21 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
'class',
|
'class',
|
||||||
this.toolbar.element.className +" fullpage"
|
this.toolbar.element.className +" fullpage"
|
||||||
);
|
);
|
||||||
this.toolbar.element.style.position = 'fixed';
|
//this.toolbar.element.style.position = 'fixed';
|
||||||
|
|
||||||
this.container.style.top = $.getElementSize(
|
//this.container.style.top = $.getElementSize(
|
||||||
this.toolbar.element
|
// this.toolbar.element
|
||||||
).y + 'px';
|
//).y + 'px';
|
||||||
}
|
}
|
||||||
body.appendChild( this.container );
|
body.appendChild( this.element );
|
||||||
THIS[ this.hash ].prevContainerSize = $.getWindowSize();
|
if( this.toolbar && this.toolbar.element ){
|
||||||
|
this.element.style.height = (
|
||||||
|
$.getWindowSize().y - $.getElementSize( this.toolbar.element ).y
|
||||||
|
) + 'px';
|
||||||
|
}else{
|
||||||
|
this.element.style.height = $.getWindowSize().y + 'px';
|
||||||
|
}
|
||||||
|
this.element.style.width = $.getWindowSize().x + 'px';
|
||||||
|
|
||||||
// mouse will be inside container now
|
// mouse will be inside container now
|
||||||
$.delegate( this, onContainerEnter )();
|
$.delegate( this, onContainerEnter )();
|
||||||
@ -3948,9 +3958,19 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
canvasStyle.backgroundColor = "";
|
canvasStyle.backgroundColor = "";
|
||||||
canvasStyle.color = "";
|
canvasStyle.color = "";
|
||||||
|
|
||||||
containerStyle.position = "relative";
|
//containerStyle.position = "relative";
|
||||||
containerStyle.zIndex = "";
|
//containerStyle.zIndex = "";
|
||||||
|
|
||||||
|
body.removeChild( this.element );
|
||||||
|
nodes = this.previousBody.length;
|
||||||
|
for ( i = 0; i < nodes; i++ ){
|
||||||
|
body.appendChild( this.previousBody.shift() );
|
||||||
|
}
|
||||||
|
THIS[ this.hash ].prevElementParent.insertBefore(
|
||||||
|
this.element,
|
||||||
|
THIS[ this.hash ].prevNextSibling
|
||||||
|
);
|
||||||
|
|
||||||
//If we've got a toolbar, we need to enable the user to use css to
|
//If we've got a toolbar, we need to enable the user to use css to
|
||||||
//reset it to its original state
|
//reset it to its original state
|
||||||
if( this.toolbar && this.toolbar.element ){
|
if( this.toolbar && this.toolbar.element ){
|
||||||
@ -3962,7 +3982,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
'class',
|
'class',
|
||||||
this.toolbar.element.className.replace('fullpage','')
|
this.toolbar.element.className.replace('fullpage','')
|
||||||
);
|
);
|
||||||
this.toolbar.element.style.position = 'relative';
|
//this.toolbar.element.style.position = 'relative';
|
||||||
this.toolbar.parentNode.insertBefore(
|
this.toolbar.parentNode.insertBefore(
|
||||||
this.toolbar.element,
|
this.toolbar.element,
|
||||||
this.toolbar.nextSibling
|
this.toolbar.nextSibling
|
||||||
@ -3970,17 +3990,12 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
delete this.toolbar.parentNode;
|
delete this.toolbar.parentNode;
|
||||||
delete this.toolbar.nextSibling;
|
delete this.toolbar.nextSibling;
|
||||||
|
|
||||||
this.container.style.top = 'auto';
|
//this.container.style.top = 'auto';
|
||||||
}
|
}
|
||||||
|
|
||||||
body.removeChild( this.container );
|
this.element.style.height = THIS[ this.hash ].prevElementSize.y + 'px';
|
||||||
nodes = this.previousBody.length;
|
this.element.style.width = THIS[ this.hash ].prevElementSize.x + 'px';
|
||||||
for ( i = 0; i < nodes; i++ ){
|
|
||||||
body.appendChild( this.previousBody.shift() );
|
|
||||||
}
|
|
||||||
this.element.appendChild( this.container );
|
|
||||||
THIS[ this.hash ].prevContainerSize = $.getElementSize( this.element );
|
|
||||||
|
|
||||||
// mouse will likely be outside now
|
// mouse will likely be outside now
|
||||||
$.delegate( this, onContainerExit )();
|
$.delegate( this, onContainerExit )();
|
||||||
|
|
||||||
@ -4113,7 +4128,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
|
|
||||||
if( this.toolbar ){
|
if( this.toolbar ){
|
||||||
this.toolbar.addControl(
|
this.toolbar.addControl(
|
||||||
this.navControl,
|
this.pagingControl,
|
||||||
$.ControlAnchor.BOTTOM_RIGHT
|
$.ControlAnchor.BOTTOM_RIGHT
|
||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
@ -4275,6 +4290,9 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
viewer: this
|
viewer: this
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if( this.referenceStrip ){
|
||||||
|
this.referenceStrip.setFocus( page );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -4495,7 +4513,7 @@ function updateOnce( viewer ) {
|
|||||||
if( viewer.referenceStrip ){
|
if( viewer.referenceStrip ){
|
||||||
animated = viewer.referenceStrip.update( viewer.viewport ) || animated;
|
animated = viewer.referenceStrip.update( viewer.viewport ) || animated;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !THIS[ viewer.hash ].animating && animated ) {
|
if ( !THIS[ viewer.hash ].animating && animated ) {
|
||||||
viewer.raiseEvent( "animationstart" );
|
viewer.raiseEvent( "animationstart" );
|
||||||
abortControlsAutoHide( viewer );
|
abortControlsAutoHide( viewer );
|
||||||
@ -6916,15 +6934,7 @@ $.ReferenceStrip = function( options ){
|
|||||||
tracker.dragging &&
|
tracker.dragging &&
|
||||||
( now - tracker.dragging ) < tracker.clickTimeThreshold ){
|
( now - tracker.dragging ) < tracker.clickTimeThreshold ){
|
||||||
tracker.dragging = null;
|
tracker.dragging = null;
|
||||||
if ( _this.currentSelected !== tracker.element ){
|
viewer.goToPage( page );
|
||||||
if(_this.currentSelected){
|
|
||||||
_this.currentSelected.style.background = '#000';
|
|
||||||
}
|
|
||||||
_this.currentSelected = tracker.element;
|
|
||||||
_this.currentSelected.style.background = '#999';
|
|
||||||
viewer.goToPage( page );
|
|
||||||
$.getElement( tracker.element.id + '-displayregion' ).focus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).setTracking( true );
|
}).setTracking( true );
|
||||||
@ -6937,11 +6947,61 @@ $.ReferenceStrip = function( options ){
|
|||||||
|
|
||||||
}
|
}
|
||||||
loadPanels( this, this.scroll == 'vertical' ? viewerSize.y : viewerSize.y, 0);
|
loadPanels( this, this.scroll == 'vertical' ? viewerSize.y : viewerSize.y, 0);
|
||||||
|
this.setFocus( 0 );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend( $.ReferenceStrip.prototype, $.EventHandler.prototype, $.Viewer.prototype, {
|
$.extend( $.ReferenceStrip.prototype, $.EventHandler.prototype, $.Viewer.prototype, {
|
||||||
|
|
||||||
|
setFocus: function( page ){
|
||||||
|
var element = $.getElement( this.element.id + '-' + page ),
|
||||||
|
viewerSize = $.getElementSize( this.viewer.canvas ),
|
||||||
|
scrollWidth = Number(this.element.style.width.replace('px','')),
|
||||||
|
scrollHeight = Number(this.element.style.height.replace('px','')),
|
||||||
|
offsetLeft = -Number(this.element.style.marginLeft.replace('px','')),
|
||||||
|
offsetTop = -Number(this.element.style.marginTop.replace('px','')),
|
||||||
|
offset;
|
||||||
|
|
||||||
|
if ( this.currentSelected !== element ){
|
||||||
|
if( this.currentSelected ){
|
||||||
|
this.currentSelected.style.background = '#000';
|
||||||
|
}
|
||||||
|
this.currentSelected = element;
|
||||||
|
this.currentSelected.style.background = '#999';
|
||||||
|
$.getElement( element.id + '-displayregion' ).focus();
|
||||||
|
|
||||||
|
if( 'horizontal' == this.scroll ){
|
||||||
|
//right left
|
||||||
|
offset = (Number(page)) * this.panelWidth;
|
||||||
|
if( offset > offsetLeft + viewerSize.x - this.panelWidth){
|
||||||
|
offset = Math.min(offset, (scrollWidth - viewerSize.x));
|
||||||
|
this.element.style.marginLeft = -offset + 'px';
|
||||||
|
loadPanels( this, viewerSize.x, -offset );
|
||||||
|
}else if( offset < offsetLeft ){
|
||||||
|
offset = Math.max(0, offset - viewerSize.x / 2);
|
||||||
|
this.element.style.marginLeft = -offset + 'px';
|
||||||
|
loadPanels( this, viewerSize.x, -offset );
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
offset = (Number(page) ) * this.panelHeight;
|
||||||
|
if( offset > offsetTop + viewerSize.y - this.panelHeight){
|
||||||
|
offset = Math.min(offset, (scrollHeight - viewerSize.y));
|
||||||
|
this.element.style.marginTop = -offset + 'px';
|
||||||
|
loadPanels( this, viewerSize.y, -offset );
|
||||||
|
}else if( offset < offsetTop ){
|
||||||
|
offset = Math.max(0, offset - viewerSize.y / 2);
|
||||||
|
this.element.style.marginTop = -offset + 'px';
|
||||||
|
loadPanels( this, viewerSize.y, -offset );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.currentPage = page;
|
||||||
|
onStripEnter.call( this, this.innerTracker );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isVisibleInReferenceStrip: function( page ){
|
||||||
|
return true;
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* @function
|
* @function
|
||||||
* @name OpenSeadragon.Navigator.prototype.update
|
* @name OpenSeadragon.Navigator.prototype.update
|
||||||
@ -7056,7 +7116,8 @@ function onStripScroll( tracker, position, scroll, shift ) {
|
|||||||
|
|
||||||
function loadPanels(strip, viewerSize, scroll){
|
function loadPanels(strip, viewerSize, scroll){
|
||||||
var panelSize,
|
var panelSize,
|
||||||
activePanels,
|
activePanelsStart,
|
||||||
|
activePanelsEnd,
|
||||||
miniViewer,
|
miniViewer,
|
||||||
i;
|
i;
|
||||||
if( 'horizontal' == strip.scroll ){
|
if( 'horizontal' == strip.scroll ){
|
||||||
@ -7064,9 +7125,12 @@ function loadPanels(strip, viewerSize, scroll){
|
|||||||
}else{
|
}else{
|
||||||
panelSize = strip.panelHeight;
|
panelSize = strip.panelHeight;
|
||||||
}
|
}
|
||||||
activePanels = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1;
|
activePanelsStart = Math.ceil( viewerSize / panelSize ) - 1;
|
||||||
|
activePanelsEnd = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1;
|
||||||
|
activePanelsStart = activePanelsEnd - activePanelsEnd;
|
||||||
|
activePanelsStart = activePanelsStart < 0 ? 0 : activePanelsStart;
|
||||||
|
|
||||||
for( i = 0; i < activePanels && i < strip.panels.length; i++ ){
|
for( i = activePanelsStart; i < activePanelsEnd && i < strip.panels.length; i++ ){
|
||||||
element = strip.panels[ i ];
|
element = strip.panels[ i ];
|
||||||
if ( !element.activePanel ){
|
if ( !element.activePanel ){
|
||||||
miniViewer = new $.Viewer( {
|
miniViewer = new $.Viewer( {
|
||||||
@ -7154,15 +7218,16 @@ function onStripExit( tracker ) {
|
|||||||
//tracker.element.style.border = 'none';
|
//tracker.element.style.border = 'none';
|
||||||
//tracker.element.style.background = '#fff';
|
//tracker.element.style.background = '#fff';
|
||||||
|
|
||||||
|
|
||||||
if( 'horizontal' == this.scroll ){
|
if( 'horizontal' == this.scroll ){
|
||||||
|
|
||||||
//tracker.element.style.paddingTop = "10px";
|
//tracker.element.style.paddingTop = "10px";
|
||||||
tracker.element.style.marginBottom = "-" + ( Math.floor(viewerSize.y*this.sizeRatio)*0.8 ) + "px";
|
tracker.element.style.marginBottom = "-" + ( $.getElementSize( tracker.element ).y / 2 ) + "px";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//tracker.element.style.paddingRight = "10px";
|
//tracker.element.style.paddingRight = "10px";
|
||||||
tracker.element.style.marginLeft = "-" + ( Math.floor(viewerSize.x*this.sizeRatio)*0.8 )+ "px";
|
tracker.element.style.marginLeft = "-" + ( $.getElementSize( tracker.element ).x / 2 )+ "px";
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -174,15 +174,7 @@ $.ReferenceStrip = function( options ){
|
|||||||
tracker.dragging &&
|
tracker.dragging &&
|
||||||
( now - tracker.dragging ) < tracker.clickTimeThreshold ){
|
( now - tracker.dragging ) < tracker.clickTimeThreshold ){
|
||||||
tracker.dragging = null;
|
tracker.dragging = null;
|
||||||
if ( _this.currentSelected !== tracker.element ){
|
viewer.goToPage( page );
|
||||||
if(_this.currentSelected){
|
|
||||||
_this.currentSelected.style.background = '#000';
|
|
||||||
}
|
|
||||||
_this.currentSelected = tracker.element;
|
|
||||||
_this.currentSelected.style.background = '#999';
|
|
||||||
viewer.goToPage( page );
|
|
||||||
$.getElement( tracker.element.id + '-displayregion' ).focus();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).setTracking( true );
|
}).setTracking( true );
|
||||||
@ -195,11 +187,61 @@ $.ReferenceStrip = function( options ){
|
|||||||
|
|
||||||
}
|
}
|
||||||
loadPanels( this, this.scroll == 'vertical' ? viewerSize.y : viewerSize.y, 0);
|
loadPanels( this, this.scroll == 'vertical' ? viewerSize.y : viewerSize.y, 0);
|
||||||
|
this.setFocus( 0 );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$.extend( $.ReferenceStrip.prototype, $.EventHandler.prototype, $.Viewer.prototype, {
|
$.extend( $.ReferenceStrip.prototype, $.EventHandler.prototype, $.Viewer.prototype, {
|
||||||
|
|
||||||
|
setFocus: function( page ){
|
||||||
|
var element = $.getElement( this.element.id + '-' + page ),
|
||||||
|
viewerSize = $.getElementSize( this.viewer.canvas ),
|
||||||
|
scrollWidth = Number(this.element.style.width.replace('px','')),
|
||||||
|
scrollHeight = Number(this.element.style.height.replace('px','')),
|
||||||
|
offsetLeft = -Number(this.element.style.marginLeft.replace('px','')),
|
||||||
|
offsetTop = -Number(this.element.style.marginTop.replace('px','')),
|
||||||
|
offset;
|
||||||
|
|
||||||
|
if ( this.currentSelected !== element ){
|
||||||
|
if( this.currentSelected ){
|
||||||
|
this.currentSelected.style.background = '#000';
|
||||||
|
}
|
||||||
|
this.currentSelected = element;
|
||||||
|
this.currentSelected.style.background = '#999';
|
||||||
|
$.getElement( element.id + '-displayregion' ).focus();
|
||||||
|
|
||||||
|
if( 'horizontal' == this.scroll ){
|
||||||
|
//right left
|
||||||
|
offset = (Number(page)) * this.panelWidth;
|
||||||
|
if( offset > offsetLeft + viewerSize.x - this.panelWidth){
|
||||||
|
offset = Math.min(offset, (scrollWidth - viewerSize.x));
|
||||||
|
this.element.style.marginLeft = -offset + 'px';
|
||||||
|
loadPanels( this, viewerSize.x, -offset );
|
||||||
|
}else if( offset < offsetLeft ){
|
||||||
|
offset = Math.max(0, offset - viewerSize.x / 2);
|
||||||
|
this.element.style.marginLeft = -offset + 'px';
|
||||||
|
loadPanels( this, viewerSize.x, -offset );
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
offset = (Number(page) ) * this.panelHeight;
|
||||||
|
if( offset > offsetTop + viewerSize.y - this.panelHeight){
|
||||||
|
offset = Math.min(offset, (scrollHeight - viewerSize.y));
|
||||||
|
this.element.style.marginTop = -offset + 'px';
|
||||||
|
loadPanels( this, viewerSize.y, -offset );
|
||||||
|
}else if( offset < offsetTop ){
|
||||||
|
offset = Math.max(0, offset - viewerSize.y / 2);
|
||||||
|
this.element.style.marginTop = -offset + 'px';
|
||||||
|
loadPanels( this, viewerSize.y, -offset );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.currentPage = page;
|
||||||
|
onStripEnter.call( this, this.innerTracker );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isVisibleInReferenceStrip: function( page ){
|
||||||
|
return true;
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* @function
|
* @function
|
||||||
* @name OpenSeadragon.Navigator.prototype.update
|
* @name OpenSeadragon.Navigator.prototype.update
|
||||||
@ -314,7 +356,8 @@ function onStripScroll( tracker, position, scroll, shift ) {
|
|||||||
|
|
||||||
function loadPanels(strip, viewerSize, scroll){
|
function loadPanels(strip, viewerSize, scroll){
|
||||||
var panelSize,
|
var panelSize,
|
||||||
activePanels,
|
activePanelsStart,
|
||||||
|
activePanelsEnd,
|
||||||
miniViewer,
|
miniViewer,
|
||||||
i;
|
i;
|
||||||
if( 'horizontal' == strip.scroll ){
|
if( 'horizontal' == strip.scroll ){
|
||||||
@ -322,9 +365,12 @@ function loadPanels(strip, viewerSize, scroll){
|
|||||||
}else{
|
}else{
|
||||||
panelSize = strip.panelHeight;
|
panelSize = strip.panelHeight;
|
||||||
}
|
}
|
||||||
activePanels = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1;
|
activePanelsStart = Math.ceil( viewerSize / panelSize ) - 1;
|
||||||
|
activePanelsEnd = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1;
|
||||||
|
activePanelsStart = activePanelsEnd - activePanelsEnd;
|
||||||
|
activePanelsStart = activePanelsStart < 0 ? 0 : activePanelsStart;
|
||||||
|
|
||||||
for( i = 0; i < activePanels && i < strip.panels.length; i++ ){
|
for( i = activePanelsStart; i < activePanelsEnd && i < strip.panels.length; i++ ){
|
||||||
element = strip.panels[ i ];
|
element = strip.panels[ i ];
|
||||||
if ( !element.activePanel ){
|
if ( !element.activePanel ){
|
||||||
miniViewer = new $.Viewer( {
|
miniViewer = new $.Viewer( {
|
||||||
@ -412,15 +458,16 @@ function onStripExit( tracker ) {
|
|||||||
//tracker.element.style.border = 'none';
|
//tracker.element.style.border = 'none';
|
||||||
//tracker.element.style.background = '#fff';
|
//tracker.element.style.background = '#fff';
|
||||||
|
|
||||||
|
|
||||||
if( 'horizontal' == this.scroll ){
|
if( 'horizontal' == this.scroll ){
|
||||||
|
|
||||||
//tracker.element.style.paddingTop = "10px";
|
//tracker.element.style.paddingTop = "10px";
|
||||||
tracker.element.style.marginBottom = "-" + ( Math.floor(viewerSize.y*this.sizeRatio)*0.8 ) + "px";
|
tracker.element.style.marginBottom = "-" + ( $.getElementSize( tracker.element ).y / 2 ) + "px";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//tracker.element.style.paddingRight = "10px";
|
//tracker.element.style.paddingRight = "10px";
|
||||||
tracker.element.style.marginLeft = "-" + ( Math.floor(viewerSize.x*this.sizeRatio)*0.8 )+ "px";
|
tracker.element.style.marginLeft = "-" + ( $.getElementSize( tracker.element ).x / 2 )+ "px";
|
||||||
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -552,7 +552,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
* @return {Boolean}
|
* @return {Boolean}
|
||||||
*/
|
*/
|
||||||
isFullPage: function () {
|
isFullPage: function () {
|
||||||
return this.container.parentNode == document.body;
|
return this.element.parentNode == document.body;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@ -569,7 +569,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
var body = document.body,
|
var body = document.body,
|
||||||
bodyStyle = body.style,
|
bodyStyle = body.style,
|
||||||
docStyle = document.documentElement.style,
|
docStyle = document.documentElement.style,
|
||||||
containerStyle = this.container.style,
|
containerStyle = this.element.style,
|
||||||
canvasStyle = this.canvas.style,
|
canvasStyle = this.canvas.style,
|
||||||
oldBounds,
|
oldBounds,
|
||||||
newBounds,
|
newBounds,
|
||||||
@ -598,7 +598,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
canvasStyle.backgroundColor = "black";
|
canvasStyle.backgroundColor = "black";
|
||||||
canvasStyle.color = "white";
|
canvasStyle.color = "white";
|
||||||
|
|
||||||
containerStyle.position = "fixed";
|
//containerStyle.position = "fixed";
|
||||||
|
|
||||||
//when entering full screen on the ipad it wasnt sufficient to leave
|
//when entering full screen on the ipad it wasnt sufficient to leave
|
||||||
//the body intact as only only the top half of the screen would
|
//the body intact as only only the top half of the screen would
|
||||||
@ -606,6 +606,9 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
//them as touch events on the document body. Thus we remove and store
|
//them as touch events on the document body. Thus we remove and store
|
||||||
//the bodies elements and replace them when we leave full screen.
|
//the bodies elements and replace them when we leave full screen.
|
||||||
this.previousBody = [];
|
this.previousBody = [];
|
||||||
|
THIS[ this.hash ].prevElementParent = this.element.parentNode;
|
||||||
|
THIS[ this.hash ].prevNextSibling = this.element.prevNextSibling;
|
||||||
|
THIS[ this.hash ].prevElementSize = $.getElementSize( this.element );
|
||||||
nodes = body.childNodes.length;
|
nodes = body.childNodes.length;
|
||||||
for ( i = 0; i < nodes; i ++ ){
|
for ( i = 0; i < nodes; i ++ ){
|
||||||
this.previousBody.push( body.childNodes[ 0 ] );
|
this.previousBody.push( body.childNodes[ 0 ] );
|
||||||
@ -627,14 +630,21 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
'class',
|
'class',
|
||||||
this.toolbar.element.className +" fullpage"
|
this.toolbar.element.className +" fullpage"
|
||||||
);
|
);
|
||||||
this.toolbar.element.style.position = 'fixed';
|
//this.toolbar.element.style.position = 'fixed';
|
||||||
|
|
||||||
this.container.style.top = $.getElementSize(
|
//this.container.style.top = $.getElementSize(
|
||||||
this.toolbar.element
|
// this.toolbar.element
|
||||||
).y + 'px';
|
//).y + 'px';
|
||||||
}
|
}
|
||||||
body.appendChild( this.container );
|
body.appendChild( this.element );
|
||||||
THIS[ this.hash ].prevContainerSize = $.getWindowSize();
|
if( this.toolbar && this.toolbar.element ){
|
||||||
|
this.element.style.height = (
|
||||||
|
$.getWindowSize().y - $.getElementSize( this.toolbar.element ).y
|
||||||
|
) + 'px';
|
||||||
|
}else{
|
||||||
|
this.element.style.height = $.getWindowSize().y + 'px';
|
||||||
|
}
|
||||||
|
this.element.style.width = $.getWindowSize().x + 'px';
|
||||||
|
|
||||||
// mouse will be inside container now
|
// mouse will be inside container now
|
||||||
$.delegate( this, onContainerEnter )();
|
$.delegate( this, onContainerEnter )();
|
||||||
@ -651,9 +661,19 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
canvasStyle.backgroundColor = "";
|
canvasStyle.backgroundColor = "";
|
||||||
canvasStyle.color = "";
|
canvasStyle.color = "";
|
||||||
|
|
||||||
containerStyle.position = "relative";
|
//containerStyle.position = "relative";
|
||||||
containerStyle.zIndex = "";
|
//containerStyle.zIndex = "";
|
||||||
|
|
||||||
|
body.removeChild( this.element );
|
||||||
|
nodes = this.previousBody.length;
|
||||||
|
for ( i = 0; i < nodes; i++ ){
|
||||||
|
body.appendChild( this.previousBody.shift() );
|
||||||
|
}
|
||||||
|
THIS[ this.hash ].prevElementParent.insertBefore(
|
||||||
|
this.element,
|
||||||
|
THIS[ this.hash ].prevNextSibling
|
||||||
|
);
|
||||||
|
|
||||||
//If we've got a toolbar, we need to enable the user to use css to
|
//If we've got a toolbar, we need to enable the user to use css to
|
||||||
//reset it to its original state
|
//reset it to its original state
|
||||||
if( this.toolbar && this.toolbar.element ){
|
if( this.toolbar && this.toolbar.element ){
|
||||||
@ -665,7 +685,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
'class',
|
'class',
|
||||||
this.toolbar.element.className.replace('fullpage','')
|
this.toolbar.element.className.replace('fullpage','')
|
||||||
);
|
);
|
||||||
this.toolbar.element.style.position = 'relative';
|
//this.toolbar.element.style.position = 'relative';
|
||||||
this.toolbar.parentNode.insertBefore(
|
this.toolbar.parentNode.insertBefore(
|
||||||
this.toolbar.element,
|
this.toolbar.element,
|
||||||
this.toolbar.nextSibling
|
this.toolbar.nextSibling
|
||||||
@ -673,17 +693,12 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
delete this.toolbar.parentNode;
|
delete this.toolbar.parentNode;
|
||||||
delete this.toolbar.nextSibling;
|
delete this.toolbar.nextSibling;
|
||||||
|
|
||||||
this.container.style.top = 'auto';
|
//this.container.style.top = 'auto';
|
||||||
}
|
}
|
||||||
|
|
||||||
body.removeChild( this.container );
|
this.element.style.height = THIS[ this.hash ].prevElementSize.y + 'px';
|
||||||
nodes = this.previousBody.length;
|
this.element.style.width = THIS[ this.hash ].prevElementSize.x + 'px';
|
||||||
for ( i = 0; i < nodes; i++ ){
|
|
||||||
body.appendChild( this.previousBody.shift() );
|
|
||||||
}
|
|
||||||
this.element.appendChild( this.container );
|
|
||||||
THIS[ this.hash ].prevContainerSize = $.getElementSize( this.element );
|
|
||||||
|
|
||||||
// mouse will likely be outside now
|
// mouse will likely be outside now
|
||||||
$.delegate( this, onContainerExit )();
|
$.delegate( this, onContainerExit )();
|
||||||
|
|
||||||
@ -816,7 +831,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
|
|
||||||
if( this.toolbar ){
|
if( this.toolbar ){
|
||||||
this.toolbar.addControl(
|
this.toolbar.addControl(
|
||||||
this.navControl,
|
this.pagingControl,
|
||||||
$.ControlAnchor.BOTTOM_RIGHT
|
$.ControlAnchor.BOTTOM_RIGHT
|
||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
@ -978,6 +993,9 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
viewer: this
|
viewer: this
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if( this.referenceStrip ){
|
||||||
|
this.referenceStrip.setFocus( page );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -1198,7 +1216,7 @@ function updateOnce( viewer ) {
|
|||||||
if( viewer.referenceStrip ){
|
if( viewer.referenceStrip ){
|
||||||
animated = viewer.referenceStrip.update( viewer.viewport ) || animated;
|
animated = viewer.referenceStrip.update( viewer.viewport ) || animated;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !THIS[ viewer.hash ].animating && animated ) {
|
if ( !THIS[ viewer.hash ].animating && animated ) {
|
||||||
viewer.raiseEvent( "animationstart" );
|
viewer.raiseEvent( "animationstart" );
|
||||||
abortControlsAutoHide( viewer );
|
abortControlsAutoHide( viewer );
|
||||||
|
@ -2,16 +2,14 @@
|
|||||||
|
|
||||||
<div class="description">
|
<div class="description">
|
||||||
<p>
|
<p>
|
||||||
A tile source collections is really just another way of viewing a
|
An image reference strip allows the user to quickly preview and navigate a
|
||||||
sequence of tile sources, though instead of viewing one at a time
|
sequence of images.
|
||||||
the user is able to view many tile sources at the same time. At this
|
|
||||||
point in time it supports a matrix layout of N by M rows.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="demoarea">
|
<div class="demoarea">
|
||||||
<div class="demoheading">
|
<div class="demoheading">
|
||||||
A 1 by 2 tile collection.
|
Horizontal Scrolling Image Reference Strip
|
||||||
</div>
|
</div>
|
||||||
<div id="contentDiv"
|
<div id="contentDiv"
|
||||||
class="openseadragon"></div>
|
class="openseadragon"></div>
|
||||||
@ -76,12 +74,15 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The relevant configuration options are shown below. Note the value for the options
|
The relevant configuration options are shown below.
|
||||||
are the id of the element on the page to bind the button's action to.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
TODO
|
OpenSeadragon({
|
||||||
|
...
|
||||||
|
showReferenceStrip: true,
|
||||||
|
...
|
||||||
|
});
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<h2>example: vertical scrolling</h2>
|
<h2>example: vertical scrolling</h2>
|
||||||
@ -107,8 +108,10 @@ are the id of the element on the page to bind the button's action to.
|
|||||||
id: "contentDiv2",
|
id: "contentDiv2",
|
||||||
prefixUrl: "/openseadragon",
|
prefixUrl: "/openseadragon",
|
||||||
toolbar: "toolbarDiv",
|
toolbar: "toolbarDiv",
|
||||||
showReferenceStrip: true,
|
springStiffness: 10,
|
||||||
referenceStripScroll: 'vertical',
|
showReferenceStrip: true,
|
||||||
|
autoHideControls: false,
|
||||||
|
referenceStripScroll: 'vertical',
|
||||||
tileSources: [{
|
tileSources: [{
|
||||||
type: 'legacy-image-pyramid',
|
type: 'legacy-image-pyramid',
|
||||||
levels:[{
|
levels:[{
|
||||||
@ -162,5 +165,14 @@ are the id of the element on the page to bind the button's action to.
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
TODO
|
The relevant configuration options are shown below.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
OpenSeadragon({
|
||||||
|
...
|
||||||
|
showReferenceStrip: true,
|
||||||
|
referenceStripScroll: 'vertical',
|
||||||
|
...
|
||||||
|
});
|
||||||
|
</pre>
|
Loading…
x
Reference in New Issue
Block a user