|
@@ -13,22 +13,29 @@ Object.assign( THREE.ImageLoader.prototype, {
|
|
|
load: function ( url, onLoad, onProgress, onError ) {
|
|
|
|
|
|
var image = document.createElement( 'img' );
|
|
|
+ image.onload = function () {
|
|
|
|
|
|
- var loader = new THREE.XHRLoader( this.manager );
|
|
|
- loader.setPath( this.path );
|
|
|
- loader.setResponseType( 'blob' );
|
|
|
- loader.load( url, function ( blob ) {
|
|
|
+ URL.revokeObjectURL( image.src );
|
|
|
+ if ( onLoad ) onLoad( image );
|
|
|
|
|
|
- image.onload = function () {
|
|
|
+ };
|
|
|
|
|
|
- URL.revokeObjectURL( image.src );
|
|
|
- if ( onLoad ) onLoad( image );
|
|
|
+ if ( url.indexOf( 'data:' ) === 0 ) {
|
|
|
|
|
|
- };
|
|
|
+ image.src = url;
|
|
|
|
|
|
- image.src = URL.createObjectURL( blob );
|
|
|
+ } else {
|
|
|
|
|
|
- }, onProgress, onError );
|
|
|
+ var loader = new THREE.XHRLoader( this.manager );
|
|
|
+ loader.setPath( this.path );
|
|
|
+ loader.setResponseType( 'blob' );
|
|
|
+ loader.load( url, function ( blob ) {
|
|
|
+
|
|
|
+ image.src = URL.createObjectURL( blob );
|
|
|
+
|
|
|
+ }, onProgress, onError );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
return image;
|
|
|
|