Merge pull request #364 from sul-dlss/cors-policy

add crossOriginPolicy drawer configuration to enable or disable CORS image requests
This commit is contained in:
iangilman 2014-03-21 09:18:41 -07:00
commit 184ba0dbea
3 changed files with 13 additions and 3 deletions

View File

@ -101,7 +101,8 @@ $.Drawer = function( options ) {
alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend, alwaysBlend: $.DEFAULT_SETTINGS.alwaysBlend,
minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio, minPixelRatio: $.DEFAULT_SETTINGS.minPixelRatio,
debugMode: $.DEFAULT_SETTINGS.debugMode, debugMode: $.DEFAULT_SETTINGS.debugMode,
timeout: $.DEFAULT_SETTINGS.timeout timeout: $.DEFAULT_SETTINGS.timeout,
crossOriginPolicy: $.DEFAULT_SETTINGS.crossOriginPolicy
}, options ); }, options );
@ -325,7 +326,10 @@ $.Drawer.prototype = /** @lends OpenSeadragon.Drawer.prototype */{
this.downloading++; this.downloading++;
image = new Image(); image = new Image();
image.crossOrigin = 'Anonymous';
if (_this.crossOriginPolicy !== false) {
image.crossOrigin = _this.crossOriginPolicy;
}
complete = function( imagesrc, resultingImage ){ complete = function( imagesrc, resultingImage ){
_this.downloading--; _this.downloading--;

View File

@ -409,6 +409,10 @@
* *
* @property {Number} [collectionTileSize=800] * @property {Number} [collectionTileSize=800]
* *
* @property {String} [crossOriginPolicy='Anonymous']
* Valid values are 'Anonymous', 'use-credentials', and false. If false, canvas requests will
* not use CORS, and the canvas will be tainted.
*
*/ */
/** /**
@ -723,6 +727,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
tileSources: null, tileSources: null,
tileHost: null, tileHost: null,
initialPage: 0, initialPage: 0,
crossOriginPolicy: 'Anonymous',
//PAN AND ZOOM SETTINGS AND CONSTRAINTS //PAN AND ZOOM SETTINGS AND CONSTRAINTS
panHorizontal: true, panHorizontal: true,

View File

@ -1921,7 +1921,8 @@ function openTileSource( viewer, source ) {
minPixelRatio: _this.collectionMode ? 0 : _this.minPixelRatio, minPixelRatio: _this.collectionMode ? 0 : _this.minPixelRatio,
timeout: _this.timeout, timeout: _this.timeout,
debugMode: _this.debugMode, debugMode: _this.debugMode,
debugGridColor: _this.debugGridColor debugGridColor: _this.debugGridColor,
crossOriginPolicy: _this.crossOriginPolicy
}); });
_this.drawers = [_this.drawer]; _this.drawers = [_this.drawer];