Browse Source

Loaders: Harmonize crossOrigin in ObjectLoader and JSONLoader.

Mugen87 7 years ago
parent
commit
5aff15a354

+ 12 - 1
docs/api/loaders/JSONLoader.html

@@ -62,6 +62,12 @@
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 
 
+		<h3>[property:String crossOrigin]</h3>
+		<p>
+		If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
+	 attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
+		</p>
+
 		<h3>[property:LoadingManager manager]</h3>
 		<h3>[property:LoadingManager manager]</h3>
 		<p>
 		<p>
 			The [page:LoadingManager loadingManager]  the loader is using. Default is [page:DefaultLoadingManager].
 			The [page:LoadingManager loadingManager]  the loader is using. Default is [page:DefaultLoadingManager].
@@ -87,7 +93,12 @@
 		Begin loading from url and pass the <em>JSON</em> to onLoad.
 		Begin loading from url and pass the <em>JSON</em> to onLoad.
 		</p>
 		</p>
 
 
-		<h3>[method:null setTexturePath]( [param:String texturePath] )</h3>
+		<h3>[method:JSONLoader setCrossOrigin]( [param:String value] )</h3>
+		<p>
+			Set the [page:.crossOrigin] attribute.
+		</p>
+
+		<h3>[method:JSONLoader setTexturePath]( [param:String texturePath] )</h3>
 		<p>
 		<p>
 			Set the base path or URL from which to load files. This can be useful if
 			Set the base path or URL from which to load files. This can be useful if
 			you are loading many files from the same directory.
 			you are loading many files from the same directory.

+ 1 - 2
docs/api/loaders/ObjectLoader.html

@@ -77,8 +77,7 @@
 		<h3>[property:String crossOrigin]</h3>
 		<h3>[property:String crossOrigin]</h3>
 		<p>
 		<p>
 		If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
 		If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
-	 attribute of the image to the value of *crossOrigin*,
-		prior to starting the load. Default is *undefined*.
+	 attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *"anonymous"*.
 		</p>
 		</p>
 
 
 		<h3>[property:LoadingManager manager]</h3>
 		<h3>[property:LoadingManager manager]</h3>

+ 10 - 0
src/loaders/JSONLoader.js

@@ -32,6 +32,8 @@ function JSONLoader( manager ) {
 
 
 Object.assign( JSONLoader.prototype, {
 Object.assign( JSONLoader.prototype, {
 
 
+	crossOrigin: 'anonymous',
+
 	load: function ( url, onLoad, onProgress, onError ) {
 	load: function ( url, onLoad, onProgress, onError ) {
 
 
 		var scope = this;
 		var scope = this;
@@ -69,9 +71,17 @@ Object.assign( JSONLoader.prototype, {
 
 
 	},
 	},
 
 
+	setCrossOrigin: function ( value ) {
+
+		this.crossOrigin = value;
+		return this;
+
+	},
+
 	setTexturePath: function ( value ) {
 	setTexturePath: function ( value ) {
 
 
 		this.texturePath = value;
 		this.texturePath = value;
+		return this;
 
 
 	},
 	},
 
 

+ 2 - 0
src/loaders/ObjectLoader.js

@@ -66,6 +66,8 @@ function ObjectLoader( manager ) {
 
 
 Object.assign( ObjectLoader.prototype, {
 Object.assign( ObjectLoader.prototype, {
 
 
+	crossOrigin: 'anonymous',
+
 	load: function ( url, onLoad, onProgress, onError ) {
 	load: function ( url, onLoad, onProgress, onError ) {
 
 
 		if ( this.texturePath === '' ) {
 		if ( this.texturePath === '' ) {