-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Improve SVGLoader style support #19146
Conversation
add "opacity" support
This is good code, I approve it. 👍
As stated in the code comment, there is a reason this is not good to go. Please revert it.
I guess this is right. Any thoughts @mrdoob ? |
Well, perhaps some user will need to parse and use one of them. So it is good that they are accessible as BTW, a correction to myself:: the style object is in
It is a complex topic, but perhaps you want to give it a go. For me, it is just easier to convert SVG text to paths in the SVG editor. If you want to contribute more features to the SVGLoader, two things that could be more practical are the window size and |
Thanks! |
Changes
<style>
tag andclass / id
attributes in SVG files.opacity
support for Shapes.console.log
for unrecognised tags.Currently SVGLoader does not work nicely with Adobe Illustrator exported SVGs, in some cases.
It is valid for SVGs to include DOM-like
<style>
definitions, linked via classes:Example
Current vs corrected preview:
Corrected version reads additional styles from stylesheets using CSSStyleSheet. Also, silencing
console.log
for unrecognised tags does not clutter console with billions of exported third-party tags.Limitations / Not added in this PR
container child { fill: #ff0000; }
)Browser Support
Yes. CSSRule , CSSStyleSheet + .cssRules