add lazy load to drag too, not just scroll

This commit is contained in:
thatcher 2012-09-05 11:35:42 -04:00
parent 85ed579e6c
commit 79d048ac81
3 changed files with 12 additions and 26 deletions

View File

@ -6,7 +6,7 @@
PROJECT: openseadragon
BUILD_MAJOR: 0
BUILD_MINOR: 9
BUILD_ID: 70
BUILD_ID: 72
BUILD: ${PROJECT}.${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}
VERSION: ${BUILD_MAJOR}.${BUILD_MINOR}.${BUILD_ID}

View File

@ -1,5 +1,5 @@
/**
* @version OpenSeadragon 0.9.70
* @version OpenSeadragon 0.9.72
*
* @fileOverview
* <h2>
@ -6978,41 +6978,38 @@ function onStripDrag( tracker, position, delta, shift ) {
offsetTop = Number(this.element.style.marginTop.replace('px','')),
scrollWidth = Number(this.element.style.width.replace('px','')),
scrollHeight = Number(this.element.style.height.replace('px','')),
viewerSize;
viewerSize = $.getElementSize( this.viewer.canvas );
this.dragging = true;
if ( this.element ) {
if( 'horizontal' == this.scroll ){
if ( -delta.x > 0 ) {
//forward
viewerSize = $.getElementSize( this.viewer.canvas );
if( offsetLeft > -(scrollWidth - viewerSize.x)){
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
loadPanels( this, viewerSize.x, offsetLeft + (delta.x * 2) );
}
} else if ( -delta.x < 0 ) {
//reverse
if( offsetLeft < 0 ){
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
}
} else {
return false;
}
}else{
if ( -delta.y > 0 ) {
//forward
viewerSize = $.getElementSize( this.viewer.canvas );
if( offsetTop > -(scrollHeight - viewerSize.y)){
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
loadPanels( this, viewerSize.y, offsetTop + (delta.y * 2) );
}
} else if ( -delta.y < 0 ) {
//reverse
if( offsetTop < 0 ){
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
}
} else {
}
}
}
return false;
}
}
}
};
@ -7042,8 +7039,6 @@ function onStripScroll( tracker, position, scroll, shift ) {
if( offsetLeft < 0 ){
this.element.style.marginLeft = ( offsetLeft - (scroll * 60) ) + 'px';
}
} else {
return false;
}
}else{
if ( scroll < 0 ) {
@ -7057,8 +7052,6 @@ function onStripScroll( tracker, position, scroll, shift ) {
if( offsetTop < 0 ){
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;
for( i = 0; i < activePanels; i++ ){
for( i = 0; i < activePanels && i < strip.panels.length; i++ ){
element = strip.panels[ i ];
if ( !element.activePanel ){
miniViewer = new $.Viewer( {

View File

@ -234,41 +234,38 @@ function onStripDrag( tracker, position, delta, shift ) {
offsetTop = Number(this.element.style.marginTop.replace('px','')),
scrollWidth = Number(this.element.style.width.replace('px','')),
scrollHeight = Number(this.element.style.height.replace('px','')),
viewerSize;
viewerSize = $.getElementSize( this.viewer.canvas );
this.dragging = true;
if ( this.element ) {
if( 'horizontal' == this.scroll ){
if ( -delta.x > 0 ) {
//forward
viewerSize = $.getElementSize( this.viewer.canvas );
if( offsetLeft > -(scrollWidth - viewerSize.x)){
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
loadPanels( this, viewerSize.x, offsetLeft + (delta.x * 2) );
}
} else if ( -delta.x < 0 ) {
//reverse
if( offsetLeft < 0 ){
this.element.style.marginLeft = ( offsetLeft + (delta.x * 2) ) + 'px';
}
} else {
return false;
}
}else{
if ( -delta.y > 0 ) {
//forward
viewerSize = $.getElementSize( this.viewer.canvas );
if( offsetTop > -(scrollHeight - viewerSize.y)){
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
loadPanels( this, viewerSize.y, offsetTop + (delta.y * 2) );
}
} else if ( -delta.y < 0 ) {
//reverse
if( offsetTop < 0 ){
this.element.style.marginTop = ( offsetTop + (delta.y * 2) ) + 'px';
}
} else {
}
}
}
return false;
}
}
}
};
@ -298,8 +295,6 @@ function onStripScroll( tracker, position, scroll, shift ) {
if( offsetLeft < 0 ){
this.element.style.marginLeft = ( offsetLeft - (scroll * 60) ) + 'px';
}
} else {
return false;
}
}else{
if ( scroll < 0 ) {
@ -313,8 +308,6 @@ function onStripScroll( tracker, position, scroll, shift ) {
if( offsetTop < 0 ){
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;
for( i = 0; i < activePanels; i++ ){
for( i = 0; i < activePanels && i < strip.panels.length; i++ ){
element = strip.panels[ i ];
if ( !element.activePanel ){
miniViewer = new $.Viewer( {