From 43f8dc74eaf5206e4fcc6297022a23ca573ee376 Mon Sep 17 00:00:00 2001 From: Ryan Lester Date: Thu, 26 Jun 2014 11:33:43 -0700 Subject: [PATCH] Fixing CORS bug --- src/drawer.js | 1 + src/imageLoader.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/drawer.js b/src/drawer.js index 10165ffb..ebdf9c77 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -711,6 +711,7 @@ function loadTile( drawer, tile, time ) { tile.loading = true; drawer.imageLoader.addJob({ src: tile.url, + crossOriginPolicy: drawer.crossOriginPolicy, callback: function( image ){ onTileLoad( drawer, tile, time, image ); } diff --git a/src/imageLoader.js b/src/imageLoader.js index 4ada9832..0f79546c 100644 --- a/src/imageLoader.js +++ b/src/imageLoader.js @@ -41,6 +41,7 @@ * * @memberof OpenSeadragon * @param {String} source - URL of image to download. + * @param {String} crossOriginPolicy - CORS policy to use for downloads * @param {Function} callback - Called once image has finished downloading. */ function ImageJob ( options ) { @@ -69,7 +70,7 @@ ImageJob.prototype = { this.image = new Image(); - if ( _this.crossOriginPolicy !== false ) { + if ( this.crossOriginPolicy !== false ) { this.image.crossOrigin = this.crossOriginPolicy; } @@ -122,6 +123,7 @@ $.ImageLoader.prototype = { * Add an unloaded image to the loader queue. * @method * @param {String} src - URL of image to download. + * @param {String} crossOriginPolicy - CORS policy to use for downloads * @param {Function} callback - Called once image has been downloaded. */ addJob: function( options ) { @@ -131,6 +133,7 @@ $.ImageLoader.prototype = { }, jobOptions = { src: options.src, + crossOriginPolicy: options.crossOriginPolicy, callback: complete }, newJob = new ImageJob( jobOptions );