mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 22:56:11 +03:00
Merge pull request #616 from kim-company/optimize-tile-loading
Optimize tile loading by clearing the queue on a re-draw
This commit is contained in:
commit
237edc0d6a
@ -124,7 +124,8 @@ $.ImageLoader.prototype = /** @lends OpenSeadragon.ImageLoader.prototype */{
|
|||||||
jobOptions = {
|
jobOptions = {
|
||||||
src: options.src,
|
src: options.src,
|
||||||
crossOriginPolicy: options.crossOriginPolicy,
|
crossOriginPolicy: options.crossOriginPolicy,
|
||||||
callback: complete
|
callback: complete,
|
||||||
|
abort: options.abort
|
||||||
},
|
},
|
||||||
newJob = new ImageJob( jobOptions );
|
newJob = new ImageJob( jobOptions );
|
||||||
|
|
||||||
@ -142,6 +143,13 @@ $.ImageLoader.prototype = /** @lends OpenSeadragon.ImageLoader.prototype */{
|
|||||||
* @method
|
* @method
|
||||||
*/
|
*/
|
||||||
clear: function() {
|
clear: function() {
|
||||||
|
for( var i = 0; i < this.jobQueue.length; i++ ) {
|
||||||
|
var job = this.jobQueue[i];
|
||||||
|
if ( typeof job.abort === "function" ) {
|
||||||
|
job.abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.jobQueue = [];
|
this.jobQueue = [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -883,6 +883,9 @@ function loadTile( tiledImage, tile, time ) {
|
|||||||
crossOriginPolicy: tiledImage.crossOriginPolicy,
|
crossOriginPolicy: tiledImage.crossOriginPolicy,
|
||||||
callback: function( image ){
|
callback: function( image ){
|
||||||
onTileLoad( tiledImage, tile, time, image );
|
onTileLoad( tiledImage, tile, time, image );
|
||||||
|
},
|
||||||
|
abort: function() {
|
||||||
|
tile.loading = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2926,6 +2926,7 @@ function resizeViewportAndRecenter( viewer, containerSize, oldBounds, oldCenter
|
|||||||
}
|
}
|
||||||
|
|
||||||
function drawWorld( viewer ) {
|
function drawWorld( viewer ) {
|
||||||
|
viewer.imageLoader.clear();
|
||||||
viewer.drawer.clear();
|
viewer.drawer.clear();
|
||||||
viewer.world.draw();
|
viewer.world.draw();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user