提交 0576c7c8 编写于 作者: M Mr.doob

ImageLoader: Fixed data: links breakage.

上级 f8e0e542
...@@ -13,22 +13,29 @@ Object.assign( THREE.ImageLoader.prototype, { ...@@ -13,22 +13,29 @@ Object.assign( THREE.ImageLoader.prototype, {
load: function ( url, onLoad, onProgress, onError ) { load: function ( url, onLoad, onProgress, onError ) {
var image = document.createElement( 'img' ); var image = document.createElement( 'img' );
image.onload = function () {
var loader = new THREE.XHRLoader( this.manager ); URL.revokeObjectURL( image.src );
loader.setPath( this.path ); if ( onLoad ) onLoad( image );
loader.setResponseType( 'blob' );
loader.load( url, function ( blob ) {
image.onload = function () { };
URL.revokeObjectURL( image.src ); if ( url.indexOf( 'data:' ) === 0 ) {
if ( onLoad ) onLoad( image );
}; 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; return image;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册