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

SVGs not rendering in Chrome #3085

Closed
ghost opened this issue Oct 10, 2016 · 7 comments
Closed

SVGs not rendering in Chrome #3085

ghost opened this issue Oct 10, 2016 · 7 comments
Labels
👍 Not A Bug Verified issue and is working as intended. 🤔 Question User question, similar to Help Wanted or Needs Help. These can be addressed whenever someone has tim

Comments

@ghost
Copy link

ghost commented Oct 10, 2016

For some reason, the demo pen used in #2510 (https://jsfiddle.net/vwzjzn4h/1/) shows pixi.js unable to render SVG to canvas properly (yes, I changed the js used in that pen to 4.0.3, the latest release, but somehow even as it uses 3.0.x it still does not show the svg).

I tried reproducing it with a fresh pen since I was seeing this in my current project: http://codepen.io/prime-ralph/pen/dpmjdq?editors=0010 (I included a sample png to show I was correctly rendering a PNG to canvas)

Is it a bug or I'm just doing something wrong?
Will try to test a few things more, will be reporting back if I find anything.

And I tried it already with a local SVG, not this one borrowed from @RanzQ. Tested with the latest version of Chrome (53.0.2785.143 m). Will try this with another browser later.

@themoonrat
Copy link
Member

Trying on the latest dev build of PIXI,
http://jsfiddle.net/f8fu0a84/1/
It flags up an error in the console

pixi.js:22488 Uncaught Error: The SVG image must have width and height defined (in pixels), canvas API needs them.(…)

@ivanpopelyshev
Copy link
Collaborator

ivanpopelyshev commented Oct 10, 2016

@prime-ralph

Can you make example with loader, and render only onload? async load + sync render wont work in any case

@ghost
Copy link
Author

ghost commented Oct 10, 2016

@ivanpopelyshev Apparently I was calling the render function before the SVG was loaded. Using requestAnimationFrame I was able to render the stage at some point after the SVG was loaded.

Seems like even if you use a loader to load an SVG does not mean it has been loaded as a texture already. Will update pen.

@ghost
Copy link
Author

ghost commented Oct 10, 2016

Pen has been updated. Leaving it as a basic example of how not to load things :D I just wish this was documented somewhere.

@ghost ghost closed this as completed Oct 10, 2016
@themoonrat
Copy link
Member

It would be a great help if you submitted a PR with the added documentation in the relevant location to help the next person who may have this issue.

@ghost
Copy link
Author

ghost commented Oct 11, 2016

Will do.

This was referenced Oct 11, 2016
englercj added a commit that referenced this issue Oct 11, 2016
@englercj englercj added 🤔 Question User question, similar to Help Wanted or Needs Help. These can be addressed whenever someone has tim 👍 Not A Bug Verified issue and is working as intended. labels Oct 12, 2016
@lock
Copy link

lock bot commented Feb 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 25, 2019
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
👍 Not A Bug Verified issue and is working as intended. 🤔 Question User question, similar to Help Wanted or Needs Help. These can be addressed whenever someone has tim
Projects
None yet
Development

No branches or pull requests

3 participants