提交 5ad36da0 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #10363 from kevanstannard/fix-svg-file-loading

Fix Loading an SVG with TextureLoader
......@@ -48,6 +48,13 @@ Object.assign( ImageLoader.prototype, {
loader.setPath( this.path );
loader.setResponseType( 'blob' );
loader.setWithCredentials( this.withCredentials );
// By default the FileLoader requests files to be loaded with a MIME
// type of `text/plain`. Using `URL.createObjectURL()` with SVGs that
// have a MIME type of `text/plain` results in an error, so explicitly
// set the SVG MIME type.
if ( /\.svg$/.test( url ) ) loader.setMimeType( 'image/svg+xml' );
loader.load( url, function ( blob ) {
image.src = URL.createObjectURL( blob );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册