Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent rendering of SVGs in fabric.Image objects #4393

Closed
kputh opened this issue Oct 19, 2017 · 5 comments
Closed

Inconsistent rendering of SVGs in fabric.Image objects #4393

kputh opened this issue Oct 19, 2017 · 5 comments

Comments

@kputh
Copy link

kputh commented Oct 19, 2017

Version

2.0.0-beta7

Test Case

https://jsfiddle.net/nwkacqdb/

Steps to reproduce

Try to load an SVG file using fabric.Image.fromURL.

Expected Behavior

fabric.Image should render SVGs properly, and identically across all browsers.

Actual Behavior

The SVG is rendered in Safari 11. It does also render in Chrome 61, albeit at a different size. And it does not render in Firefox 56, lacking any error message in the JS console.

@kputh
Copy link
Author

kputh commented Oct 19, 2017

It would be helpful, if the documentation listed compatible image formats for fabric.Image.fromURL.

@blobinabottle
Copy link
Contributor

You should load your svg with the correct method:
https://jsfiddle.net/nwkacqdb/8/

@kputh
Copy link
Author

kputh commented Oct 23, 2017

I don't want to embed an SVG, I want to reference it. In SVG it looks like this:
<image xlink:href="firefox.jpg" x="0" y="0" height="50px" width="50px"/>

@asturur
Copy link
Member

asturur commented Oct 24, 2017

The issue has been described somewhere else here

image

the svg is lacking any kind of width and height.
Firefox will render it on the DOM, inspecting the container, but since there is no container when rendering offscren, he will just not render it.

I refreshed a bug in firefox asking for behave like the other browsers but they said is against the specs. https://bugzilla.mozilla.org/show_bug.cgi?id=700533#c28

#4324 this recent PR could work as a solution for you.

@asturur asturur closed this as completed Oct 24, 2017
@asturur
Copy link
Member

asturur commented Oct 25, 2017

let me know if #4324 solved for you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants