提交 35216e71 编写于 作者: R renliv 提交者: Mr.doob

fix ImageLoader manager issue (#9176)

上级 d8bc8767
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册