bug patches for lazy load on image reference strip

This commit is contained in:
thatcher 2012-10-13 02:39:42 -04:00
parent 46a499baed
commit ab35e86776
3 changed files with 20 additions and 18 deletions

View File

@ -6,7 +6,7 @@
PROJECT: openseadragon PROJECT: openseadragon
BUILD_MAJOR: 0 BUILD_MAJOR: 0
BUILD_MINOR: 9 BUILD_MINOR: 9
BUILD_ID: 81 BUILD_ID: 82
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}

View File

@ -1,5 +1,5 @@
/** /**
* @version OpenSeadragon 0.9.81 * @version OpenSeadragon 0.9.82
* *
* @fileOverview * @fileOverview
* <h2> * <h2>
@ -6968,11 +6968,10 @@ $.extend( $.ReferenceStrip.prototype, $.EventHandler.prototype, $.Viewer.prototy
} }
this.currentSelected = element; this.currentSelected = element;
this.currentSelected.style.background = '#999'; this.currentSelected.style.background = '#999';
$.getElement( element.id + '-displayregion' ).focus();
if( 'horizontal' == this.scroll ){ if( 'horizontal' == this.scroll ){
//right left //right left
offset = (Number(page)) * this.panelWidth; offset = (Number(page)) * ( this.panelWidth + 3 );
if( offset > offsetLeft + viewerSize.x - this.panelWidth){ if( offset > offsetLeft + viewerSize.x - this.panelWidth){
offset = Math.min(offset, (scrollWidth - viewerSize.x)); offset = Math.min(offset, (scrollWidth - viewerSize.x));
this.element.style.marginLeft = -offset + 'px'; this.element.style.marginLeft = -offset + 'px';
@ -6983,7 +6982,7 @@ $.extend( $.ReferenceStrip.prototype, $.EventHandler.prototype, $.Viewer.prototy
loadPanels( this, viewerSize.x, -offset ); loadPanels( this, viewerSize.x, -offset );
} }
}else{ }else{
offset = (Number(page) ) * this.panelHeight; offset = (Number(page) ) * ( this.panelHeight + 3 );
if( offset > offsetTop + viewerSize.y - this.panelHeight){ if( offset > offsetTop + viewerSize.y - this.panelHeight){
offset = Math.min(offset, (scrollHeight - viewerSize.y)); offset = Math.min(offset, (scrollHeight - viewerSize.y));
this.element.style.marginTop = -offset + 'px'; this.element.style.marginTop = -offset + 'px';
@ -6996,12 +6995,10 @@ $.extend( $.ReferenceStrip.prototype, $.EventHandler.prototype, $.Viewer.prototy
} }
this.currentPage = page; this.currentPage = page;
$.getElement( element.id + '-displayregion' ).focus();
onStripEnter.call( this, this.innerTracker ); onStripEnter.call( this, this.innerTracker );
} }
}, },
isVisibleInReferenceStrip: function( page ){
return true;
},
/** /**
* @function * @function
* @name OpenSeadragon.Navigator.prototype.update * @name OpenSeadragon.Navigator.prototype.update
@ -7046,6 +7043,7 @@ function onStripDrag( tracker, position, delta, shift ) {
//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';
loadPanels( this, viewerSize.x, offsetLeft + (delta.x * 2) );
} }
} }
}else{ }else{
@ -7059,6 +7057,7 @@ function onStripDrag( tracker, position, delta, shift ) {
//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';
loadPanels( this, viewerSize.y, offsetTop + (delta.y * 2) );
} }
} }
} }
@ -7092,6 +7091,7 @@ function onStripScroll( tracker, position, scroll, shift ) {
//reverse //reverse
if( offsetLeft < 0 ){ if( offsetLeft < 0 ){
this.element.style.marginLeft = ( offsetLeft - (scroll * 60) ) + 'px'; this.element.style.marginLeft = ( offsetLeft - (scroll * 60) ) + 'px';
loadPanels( this, viewerSize.x, offsetLeft - (scroll * 60) );
} }
} }
}else{ }else{
@ -7105,6 +7105,7 @@ function onStripScroll( tracker, position, scroll, shift ) {
//scroll dowm //scroll dowm
if( offsetTop < 0 ){ if( offsetTop < 0 ){
this.element.style.marginTop = ( offsetTop + (scroll * 60) ) + 'px'; this.element.style.marginTop = ( offsetTop + (scroll * 60) ) + 'px';
loadPanels( this, viewerSize.y, offsetTop + (scroll * 60) );
} }
} }
} }
@ -7125,9 +7126,9 @@ function loadPanels(strip, viewerSize, scroll){
}else{ }else{
panelSize = strip.panelHeight; panelSize = strip.panelHeight;
} }
activePanelsStart = Math.ceil( viewerSize / panelSize ) - 1; activePanelsStart = Math.ceil( viewerSize / panelSize ) + 5;
activePanelsEnd = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1; activePanelsEnd = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1;
activePanelsStart = activePanelsEnd - activePanelsEnd; activePanelsStart = activePanelsEnd - activePanelsStart;
activePanelsStart = activePanelsStart < 0 ? 0 : activePanelsStart; activePanelsStart = activePanelsStart < 0 ? 0 : activePanelsStart;
for( i = activePanelsStart; i < activePanelsEnd && i < strip.panels.length; i++ ){ for( i = activePanelsStart; i < activePanelsEnd && i < strip.panels.length; i++ ){

View File

@ -208,11 +208,10 @@ $.extend( $.ReferenceStrip.prototype, $.EventHandler.prototype, $.Viewer.prototy
} }
this.currentSelected = element; this.currentSelected = element;
this.currentSelected.style.background = '#999'; this.currentSelected.style.background = '#999';
$.getElement( element.id + '-displayregion' ).focus();
if( 'horizontal' == this.scroll ){ if( 'horizontal' == this.scroll ){
//right left //right left
offset = (Number(page)) * this.panelWidth; offset = (Number(page)) * ( this.panelWidth + 3 );
if( offset > offsetLeft + viewerSize.x - this.panelWidth){ if( offset > offsetLeft + viewerSize.x - this.panelWidth){
offset = Math.min(offset, (scrollWidth - viewerSize.x)); offset = Math.min(offset, (scrollWidth - viewerSize.x));
this.element.style.marginLeft = -offset + 'px'; this.element.style.marginLeft = -offset + 'px';
@ -223,7 +222,7 @@ $.extend( $.ReferenceStrip.prototype, $.EventHandler.prototype, $.Viewer.prototy
loadPanels( this, viewerSize.x, -offset ); loadPanels( this, viewerSize.x, -offset );
} }
}else{ }else{
offset = (Number(page) ) * this.panelHeight; offset = (Number(page) ) * ( this.panelHeight + 3 );
if( offset > offsetTop + viewerSize.y - this.panelHeight){ if( offset > offsetTop + viewerSize.y - this.panelHeight){
offset = Math.min(offset, (scrollHeight - viewerSize.y)); offset = Math.min(offset, (scrollHeight - viewerSize.y));
this.element.style.marginTop = -offset + 'px'; this.element.style.marginTop = -offset + 'px';
@ -236,12 +235,10 @@ $.extend( $.ReferenceStrip.prototype, $.EventHandler.prototype, $.Viewer.prototy
} }
this.currentPage = page; this.currentPage = page;
$.getElement( element.id + '-displayregion' ).focus();
onStripEnter.call( this, this.innerTracker ); onStripEnter.call( this, this.innerTracker );
} }
}, },
isVisibleInReferenceStrip: function( page ){
return true;
},
/** /**
* @function * @function
* @name OpenSeadragon.Navigator.prototype.update * @name OpenSeadragon.Navigator.prototype.update
@ -286,6 +283,7 @@ function onStripDrag( tracker, position, delta, shift ) {
//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';
loadPanels( this, viewerSize.x, offsetLeft + (delta.x * 2) );
} }
} }
}else{ }else{
@ -299,6 +297,7 @@ function onStripDrag( tracker, position, delta, shift ) {
//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';
loadPanels( this, viewerSize.y, offsetTop + (delta.y * 2) );
} }
} }
} }
@ -332,6 +331,7 @@ function onStripScroll( tracker, position, scroll, shift ) {
//reverse //reverse
if( offsetLeft < 0 ){ if( offsetLeft < 0 ){
this.element.style.marginLeft = ( offsetLeft - (scroll * 60) ) + 'px'; this.element.style.marginLeft = ( offsetLeft - (scroll * 60) ) + 'px';
loadPanels( this, viewerSize.x, offsetLeft - (scroll * 60) );
} }
} }
}else{ }else{
@ -345,6 +345,7 @@ function onStripScroll( tracker, position, scroll, shift ) {
//scroll dowm //scroll dowm
if( offsetTop < 0 ){ if( offsetTop < 0 ){
this.element.style.marginTop = ( offsetTop + (scroll * 60) ) + 'px'; this.element.style.marginTop = ( offsetTop + (scroll * 60) ) + 'px';
loadPanels( this, viewerSize.y, offsetTop + (scroll * 60) );
} }
} }
} }
@ -365,9 +366,9 @@ function loadPanels(strip, viewerSize, scroll){
}else{ }else{
panelSize = strip.panelHeight; panelSize = strip.panelHeight;
} }
activePanelsStart = Math.ceil( viewerSize / panelSize ) - 1; activePanelsStart = Math.ceil( viewerSize / panelSize ) + 5;
activePanelsEnd = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1; activePanelsEnd = Math.ceil( (Math.abs(scroll) + viewerSize ) / panelSize ) + 1;
activePanelsStart = activePanelsEnd - activePanelsEnd; activePanelsStart = activePanelsEnd - activePanelsStart;
activePanelsStart = activePanelsStart < 0 ? 0 : activePanelsStart; activePanelsStart = activePanelsStart < 0 ? 0 : activePanelsStart;
for( i = activePanelsStart; i < activePanelsEnd && i < strip.panels.length; i++ ){ for( i = activePanelsStart; i < activePanelsEnd && i < strip.panels.length; i++ ){