diff --git a/src/loaders/ImageLoader.js b/src/loaders/ImageLoader.js index fc3ae7a6084989..34007d10b0840f 100644 --- a/src/loaders/ImageLoader.js +++ b/src/loaders/ImageLoader.js @@ -12,12 +12,16 @@ Object.assign( THREE.ImageLoader.prototype, { load: function ( url, onLoad, onProgress, onError ) { + var scope = this; + var image = document.createElementNS( 'http://www.w3.org/1999/xhtml', 'img' ); image.onload = function () { URL.revokeObjectURL( image.src ); if ( onLoad ) onLoad( image ); + scope.manager.itemEnd( url ); + }; if ( url.indexOf( 'data:' ) === 0 ) { @@ -26,7 +30,7 @@ Object.assign( THREE.ImageLoader.prototype, { } else { - var loader = new THREE.XHRLoader( this.manager ); + var loader = new THREE.XHRLoader(); loader.setPath( this.path ); loader.setResponseType( 'blob' ); loader.load( url, function ( blob ) { @@ -36,6 +40,7 @@ Object.assign( THREE.ImageLoader.prototype, { }, onProgress, onError ); } + scope.manager.itemStart( url ); return image;