mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-01 07:31:41 +03:00
add lazy load to drag too, not just scroll
This commit is contained in:
parent
85ed579e6c
commit
79d048ac81
@ -6,7 +6,7 @@
|
|||||||
PROJECT: openseadragon
|
PROJECT: openseadragon
|
||||||
BUILD_MAJOR: 0
|
BUILD_MAJOR: 0
|
||||||
BUILD_MINOR: 9
|
BUILD_MINOR: 9
|
||||||
BUILD_ID: 70
|
BUILD_ID: 72
|
||||||
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}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @version OpenSeadragon 0.9.70
|
* @version OpenSeadragon 0.9.72
|
||||||
*
|
*
|
||||||
* @fileOverview
|
* @fileOverview
|
||||||
* <h2>
|
* <h2>
|
||||||
@ -6978,41 +6978,38 @@ function onStripDrag( tracker, position, delta, shift ) {
|
|||||||
offsetTop = Number(this.element.style.marginTop.replace('px','')),
|
offsetTop = Number(this.element.style.marginTop.replace('px','')),
|
||||||
scrollWidth = Number(this.element.style.width.replace('px','')),
|
scrollWidth = Number(this.element.style.width.replace('px','')),
|
||||||
scrollHeight = Number(this.element.style.height.replace('px','')),
|
scrollHeight = Number(this.element.style.height.replace('px','')),
|
||||||
viewerSize;
|
viewerSize = $.getElementSize( this.viewer.canvas );
|
||||||
this.dragging = true;
|
this.dragging = true;
|
||||||
if ( this.element ) {
|
if ( this.element ) {
|
||||||
if( 'horizontal' == this.scroll ){
|
if( 'horizontal' == this.scroll ){
|
||||||
if ( -delta.x > 0 ) {
|
if ( -delta.x > 0 ) {
|
||||||
//forward
|
//forward
|
||||||
viewerSize = $.getElementSize( this.viewer.canvas );
|
|
||||||
if( offsetLeft > -(scrollWidth - viewerSize.x)){
|
if( offsetLeft > -(scrollWidth - viewerSize.x)){
|
||||||
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
|
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
|
||||||
|
loadPanels( this, viewerSize.x, offsetLeft + (delta.x * 2) );
|
||||||
}
|
}
|
||||||
} else if ( -delta.x < 0 ) {
|
} else if ( -delta.x < 0 ) {
|
||||||
//reverse
|
//reverse
|
||||||
if( offsetLeft < 0 ){
|
if( offsetLeft < 0 ){
|
||||||
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
|
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if ( -delta.y > 0 ) {
|
if ( -delta.y > 0 ) {
|
||||||
//forward
|
//forward
|
||||||
viewerSize = $.getElementSize( this.viewer.canvas );
|
|
||||||
if( offsetTop > -(scrollHeight - viewerSize.y)){
|
if( offsetTop > -(scrollHeight - viewerSize.y)){
|
||||||
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
|
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
|
||||||
|
loadPanels( this, viewerSize.y, offsetTop + (delta.y * 2) );
|
||||||
}
|
}
|
||||||
} else if ( -delta.y < 0 ) {
|
} else if ( -delta.y < 0 ) {
|
||||||
//reverse
|
//reverse
|
||||||
if( offsetTop < 0 ){
|
if( offsetTop < 0 ){
|
||||||
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
|
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -7042,8 +7039,6 @@ function onStripScroll( tracker, position, scroll, shift ) {
|
|||||||
if( offsetLeft < 0 ){
|
if( offsetLeft < 0 ){
|
||||||
this.element.style.marginLeft = ( offsetLeft - (scroll * 60) ) + 'px';
|
this.element.style.marginLeft = ( offsetLeft - (scroll * 60) ) + 'px';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if ( scroll < 0 ) {
|
if ( scroll < 0 ) {
|
||||||
@ -7057,8 +7052,6 @@ function onStripScroll( tracker, position, scroll, shift ) {
|
|||||||
if( offsetTop < 0 ){
|
if( offsetTop < 0 ){
|
||||||
this.element.style.marginTop = ( offsetTop + (scroll * 60) ) + 'px';
|
this.element.style.marginTop = ( offsetTop + (scroll * 60) ) + 'px';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7079,7 +7072,7 @@ function loadPanels(strip, viewerSize, scroll){
|
|||||||
}
|
}
|
||||||
activePanels = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1;
|
activePanels = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1;
|
||||||
|
|
||||||
for( i = 0; i < activePanels; i++ ){
|
for( i = 0; i < activePanels && 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( {
|
||||||
|
@ -234,41 +234,38 @@ function onStripDrag( tracker, position, delta, shift ) {
|
|||||||
offsetTop = Number(this.element.style.marginTop.replace('px','')),
|
offsetTop = Number(this.element.style.marginTop.replace('px','')),
|
||||||
scrollWidth = Number(this.element.style.width.replace('px','')),
|
scrollWidth = Number(this.element.style.width.replace('px','')),
|
||||||
scrollHeight = Number(this.element.style.height.replace('px','')),
|
scrollHeight = Number(this.element.style.height.replace('px','')),
|
||||||
viewerSize;
|
viewerSize = $.getElementSize( this.viewer.canvas );
|
||||||
this.dragging = true;
|
this.dragging = true;
|
||||||
if ( this.element ) {
|
if ( this.element ) {
|
||||||
if( 'horizontal' == this.scroll ){
|
if( 'horizontal' == this.scroll ){
|
||||||
if ( -delta.x > 0 ) {
|
if ( -delta.x > 0 ) {
|
||||||
//forward
|
//forward
|
||||||
viewerSize = $.getElementSize( this.viewer.canvas );
|
|
||||||
if( offsetLeft > -(scrollWidth - viewerSize.x)){
|
if( offsetLeft > -(scrollWidth - viewerSize.x)){
|
||||||
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
|
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
|
||||||
|
loadPanels( this, viewerSize.x, offsetLeft + (delta.x * 2) );
|
||||||
}
|
}
|
||||||
} else if ( -delta.x < 0 ) {
|
} else if ( -delta.x < 0 ) {
|
||||||
//reverse
|
//reverse
|
||||||
if( offsetLeft < 0 ){
|
if( offsetLeft < 0 ){
|
||||||
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
|
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if ( -delta.y > 0 ) {
|
if ( -delta.y > 0 ) {
|
||||||
//forward
|
//forward
|
||||||
viewerSize = $.getElementSize( this.viewer.canvas );
|
|
||||||
if( offsetTop > -(scrollHeight - viewerSize.y)){
|
if( offsetTop > -(scrollHeight - viewerSize.y)){
|
||||||
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
|
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
|
||||||
|
loadPanels( this, viewerSize.y, offsetTop + (delta.y * 2) );
|
||||||
}
|
}
|
||||||
} else if ( -delta.y < 0 ) {
|
} else if ( -delta.y < 0 ) {
|
||||||
//reverse
|
//reverse
|
||||||
if( offsetTop < 0 ){
|
if( offsetTop < 0 ){
|
||||||
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
|
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -298,8 +295,6 @@ function onStripScroll( tracker, position, scroll, shift ) {
|
|||||||
if( offsetLeft < 0 ){
|
if( offsetLeft < 0 ){
|
||||||
this.element.style.marginLeft = ( offsetLeft - (scroll * 60) ) + 'px';
|
this.element.style.marginLeft = ( offsetLeft - (scroll * 60) ) + 'px';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if ( scroll < 0 ) {
|
if ( scroll < 0 ) {
|
||||||
@ -313,8 +308,6 @@ function onStripScroll( tracker, position, scroll, shift ) {
|
|||||||
if( offsetTop < 0 ){
|
if( offsetTop < 0 ){
|
||||||
this.element.style.marginTop = ( offsetTop + (scroll * 60) ) + 'px';
|
this.element.style.marginTop = ( offsetTop + (scroll * 60) ) + 'px';
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -335,7 +328,7 @@ function loadPanels(strip, viewerSize, scroll){
|
|||||||
}
|
}
|
||||||
activePanels = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1;
|
activePanels = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1;
|
||||||
|
|
||||||
for( i = 0; i < activePanels; i++ ){
|
for( i = 0; i < activePanels && 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( {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user