Fix the jobLimit of the imageLoader

Fixes #490
This commit is contained in:
Philip Giuliani 2014-12-19 15:17:15 +01:00
parent d85d4d492d
commit c737bad66e
2 changed files with 7 additions and 4 deletions

View File

@ -94,14 +94,16 @@ ImageJob.prototype = {
* @memberof OpenSeadragon * @memberof OpenSeadragon
* @classdesc Handles downloading of a set of images using asynchronous queue pattern. * @classdesc Handles downloading of a set of images using asynchronous queue pattern.
* You generally won't have to interact with the ImageLoader directly. * You generally won't have to interact with the ImageLoader directly.
* @param {Object} options - Options for this ImageLoader.
* @param {Number} options.jobLimit - The number of concurrent image requests.
*/ */
$.ImageLoader = function() { $.ImageLoader = function( options ) {
$.extend( true, this, { $.extend( true, this, {
jobLimit: $.DEFAULT_SETTINGS.imageLoaderLimit, jobLimit: $.DEFAULT_SETTINGS.imageLoaderLimit,
jobQueue: [], jobQueue: [],
jobsInProgress: 0 jobsInProgress: 0
}); }, options );
}; };
@ -166,4 +168,3 @@ function completeJob( loader, job, callback ) {
} }
}( OpenSeadragon )); }( OpenSeadragon ));

View File

@ -436,7 +436,9 @@ $.Viewer = function( options ) {
this.viewport.setHomeBounds(this.world.getHomeBounds(), this.world.getContentFactor()); this.viewport.setHomeBounds(this.world.getHomeBounds(), this.world.getContentFactor());
// Create the image loader // Create the image loader
this.imageLoader = new $.ImageLoader(); this.imageLoader = new $.ImageLoader({
jobLimit: this.imageLoaderLimit
});
// Create the tile cache // Create the tile cache
this.tileCache = new $.TileCache({ this.tileCache = new $.TileCache({