Skip to content

Commit

Permalink
fix ImageLoader manager issue (#9176)
Browse files Browse the repository at this point in the history
  • Loading branch information
indif authored and mrdoob committed Jun 24, 2016
1 parent d8bc876 commit 35216e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/loaders/ImageLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand All @@ -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 ) {
Expand All @@ -36,6 +40,7 @@ Object.assign( THREE.ImageLoader.prototype, {
}, onProgress, onError );

}
scope.manager.itemStart( url );

return image;

Expand Down

0 comments on commit 35216e7

Please sign in to comment.