mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-19 09:11:45 +03:00
what was initally a feature branch to work on just canvas prerender, evolved into a feature branch focused on broader ideas discussed in issue #4 - I've basically been able to reduce time spent in drawTile by half. good stuff, thanks to dustmoo for getting us looking into this
This commit is contained in:
parent
11a0f3b315
commit
61a844bdc0
@ -515,9 +515,15 @@ function updateViewport( drawer ) {
|
|||||||
).x;
|
).x;
|
||||||
|
|
||||||
zeroRatioT = drawer.viewport.deltaPixelsFromPoints(
|
zeroRatioT = drawer.viewport.deltaPixelsFromPoints(
|
||||||
drawer.source.getPixelRatio( 0 ),
|
drawer.source.getPixelRatio(
|
||||||
|
Math.max(
|
||||||
|
drawer.source.getClosestLevel( drawer.viewport.containerSize ) - 1,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
),
|
||||||
false
|
false
|
||||||
).x;
|
).x;
|
||||||
|
console.log( "ZERO RATIO T %s", drawer.source.getClosestLevel( drawer.viewport.containerSize ) );
|
||||||
|
|
||||||
optimalRatio = drawer.immediateRender ?
|
optimalRatio = drawer.immediateRender ?
|
||||||
1 :
|
1 :
|
||||||
@ -850,7 +856,7 @@ function blendTile( drawer, tile, x, y, level, levelOpacity, currentTime ){
|
|||||||
}
|
}
|
||||||
|
|
||||||
deltaTime = currentTime - tile.blendStart;
|
deltaTime = currentTime - tile.blendStart;
|
||||||
opacity = Math.min( 1, deltaTime / ( blendTimeMillis || 1 ) );
|
opacity = blendTimeMillis ? Math.min( 1, deltaTime / ( blendTimeMillis ) ) : 1;
|
||||||
|
|
||||||
if ( drawer.alwaysBlend ) {
|
if ( drawer.alwaysBlend ) {
|
||||||
opacity *= levelOpacity;
|
opacity *= levelOpacity;
|
||||||
@ -1080,14 +1086,16 @@ function drawTiles( drawer, lastDrawn ){
|
|||||||
//$.console.log("Rendering collection tile %s | %s | %s", tile.y, tile.y, position);
|
//$.console.log("Rendering collection tile %s | %s | %s", tile.y, tile.y, position);
|
||||||
if( tileSource ){
|
if( tileSource ){
|
||||||
drawer.collectionOverlays[ tileKey ] = viewer = new $.Viewer({
|
drawer.collectionOverlays[ tileKey ] = viewer = new $.Viewer({
|
||||||
element: $.makeNeutralElement( "div" ),
|
element: $.makeNeutralElement( "div" ),
|
||||||
mouseNavEnabled: false,
|
mouseNavEnabled: false,
|
||||||
showNavigator: false,
|
showNavigator: false,
|
||||||
showSequenceControl: false,
|
showSequenceControl: false,
|
||||||
showNavigationControl: false,
|
showNavigationControl: false,
|
||||||
//visibilityRatio: 1,
|
//visibilityRatio: 1,
|
||||||
//debugMode: true,
|
//debugMode: true,
|
||||||
//debugGridColor: 'red',
|
//debugGridColor: 'red',
|
||||||
|
animationTime: 0,
|
||||||
|
blentTime: 0.1,
|
||||||
tileSources: [
|
tileSources: [
|
||||||
tileSource
|
tileSource
|
||||||
]
|
]
|
||||||
|
@ -37,7 +37,10 @@ $.Navigator = function( options ){
|
|||||||
showNavigator: false,
|
showNavigator: false,
|
||||||
mouseNavEnabled: false,
|
mouseNavEnabled: false,
|
||||||
showNavigationControl: false,
|
showNavigationControl: false,
|
||||||
showSequenceControl: false
|
showSequenceControl: false,
|
||||||
|
immediateRender: true,
|
||||||
|
blendTime: 0,
|
||||||
|
animationTime: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
options.minPixelRatio = this.minPixelRatio = viewer.minPixelRatio;
|
options.minPixelRatio = this.minPixelRatio = viewer.minPixelRatio;
|
||||||
@ -228,6 +231,20 @@ $.extend( $.Navigator.prototype, $.EventHandler.prototype, $.Viewer.prototype, {
|
|||||||
}( this.displayRegion.style ));
|
}( this.displayRegion.style ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
open: function( source ){
|
||||||
|
var containerSize = this.viewer.viewport.containerSize.times( this.sizeRatio );
|
||||||
|
if( source.tileSize > containerSize.x ||
|
||||||
|
source.tileSize > containerSize.y ){
|
||||||
|
this.minPixelRatio = Math.min(
|
||||||
|
containerSize.x,
|
||||||
|
containerSize.y
|
||||||
|
) / source.tileSize;
|
||||||
|
} else {
|
||||||
|
this.minPixelRatio = thie.viewer.minPixelRatio;
|
||||||
|
}
|
||||||
|
return $.Viewer.prototype.open.apply( this, [ source ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -473,25 +473,25 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
wrapHorizontal: false,
|
wrapHorizontal: false,
|
||||||
wrapVertical: false,
|
wrapVertical: false,
|
||||||
visibilityRatio: 0.5,
|
visibilityRatio: 0.5,
|
||||||
minPixelRatio: 0.5,
|
minPixelRatio: 0.9,
|
||||||
minZoomImageRatio: 0.8,
|
|
||||||
maxZoomPixelRatio: 2,
|
|
||||||
defaultZoomLevel: 0,
|
defaultZoomLevel: 0,
|
||||||
minZoomLevel: null,
|
minZoomLevel: null,
|
||||||
maxZoomLevel: null,
|
maxZoomLevel: null,
|
||||||
|
|
||||||
//UI RESPONSIVENESS AND FEEL
|
//UI RESPONSIVENESS AND FEEL
|
||||||
springStiffness: 5.0,
|
springStiffness: 7.0,
|
||||||
clickTimeThreshold: 300,
|
clickTimeThreshold: 300,
|
||||||
clickDistThreshold: 5,
|
clickDistThreshold: 5,
|
||||||
zoomPerClick: 2.0,
|
zoomPerClick: 2.0,
|
||||||
zoomPerScroll: 1.2,
|
zoomPerScroll: 1.2,
|
||||||
zoomPerSecond: 2.0,
|
zoomPerSecond: 2.0,
|
||||||
animationTime: 1.5,
|
animationTime: 1.0,
|
||||||
blendTime: 1.5,
|
blendTime: 0,
|
||||||
alwaysBlend: false,
|
alwaysBlend: false,
|
||||||
autoHideControls: true,
|
autoHideControls: true,
|
||||||
immediateRender: false,
|
immediateRender: false,
|
||||||
|
minZoomImageRatio: 0.8,
|
||||||
|
maxZoomPixelRatio: 1.2,
|
||||||
|
|
||||||
//DEFAULT CONTROL SETTINGS
|
//DEFAULT CONTROL SETTINGS
|
||||||
showSequenceControl: true, //SEQUENCE
|
showSequenceControl: true, //SEQUENCE
|
||||||
@ -530,7 +530,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
//PERFORMANCE SETTINGS
|
//PERFORMANCE SETTINGS
|
||||||
imageLoaderLimit: 0,
|
imageLoaderLimit: 0,
|
||||||
maxImageCacheCount: 200,
|
maxImageCacheCount: 200,
|
||||||
timeout: 5000,
|
timeout: 30000,
|
||||||
|
|
||||||
//INTERFACE RESOURCE SETTINGS
|
//INTERFACE RESOURCE SETTINGS
|
||||||
prefixUrl: "/images/",
|
prefixUrl: "/images/",
|
||||||
|
@ -377,11 +377,13 @@ function loadPanels(strip, viewerSize, scroll){
|
|||||||
tileSources: [ strip.viewer.tileSources[ i ] ],
|
tileSources: [ strip.viewer.tileSources[ i ] ],
|
||||||
element: element,
|
element: element,
|
||||||
navigatorSizeRatio: strip.sizeRatio,
|
navigatorSizeRatio: strip.sizeRatio,
|
||||||
minPixelRatio: strip.minPixelRatio,
|
|
||||||
showNavigator: false,
|
showNavigator: false,
|
||||||
mouseNavEnabled: false,
|
mouseNavEnabled: false,
|
||||||
showNavigationControl: false,
|
showNavigationControl: false,
|
||||||
showSequenceControl: false
|
showSequenceControl: false,
|
||||||
|
immediateRender: true,
|
||||||
|
blendTime: 0,
|
||||||
|
animationTime: 0
|
||||||
} );
|
} );
|
||||||
|
|
||||||
miniViewer.displayRegion = $.makeNeutralElement( "textarea" );
|
miniViewer.displayRegion = $.makeNeutralElement( "textarea" );
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
(function( $ ){
|
(function( $ ){
|
||||||
var TILE_CACHE = {},
|
var TILE_CACHE = {};
|
||||||
TILE_CACHE_STACK = [],
|
|
||||||
TILE_CACHE_MAX = 256;
|
|
||||||
/**
|
/**
|
||||||
* @class
|
* @class
|
||||||
* @param {Number} level The zoom level this tile belongs to.
|
* @param {Number} level The zoom level this tile belongs to.
|
||||||
|
@ -180,6 +180,24 @@ $.TileSource.prototype = {
|
|||||||
return new $.Point(rx, ry);
|
return new $.Point(rx, ry);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function
|
||||||
|
* @param {Number} level
|
||||||
|
*/
|
||||||
|
getClosestLevel: function( rect ) {
|
||||||
|
var i,
|
||||||
|
tilesPerSide = Math.floor( Math.max( rect.x, rect.y ) / this.tileSize ),
|
||||||
|
tiles;
|
||||||
|
for( i = this.minLevel; i < this.maxLevel; i++ ){
|
||||||
|
tiles = this.getNumTiles( i );
|
||||||
|
if( Math.max( tiles.x, tiles.y ) + 1 >= tilesPerSide ){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Math.max( 0, i - 1 );
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function
|
* @function
|
||||||
* @param {Number} level
|
* @param {Number} level
|
||||||
|
Loading…
x
Reference in New Issue
Block a user