Closed roSievers closed 4 years ago
I see the use case and supporting it seems valuable, although exposing the path specifically locks you out of a lot of features of the library. Probably the more complete answer would be to expose a viewSvg
function that offers a way to render the icon completely to an SVG node rather than an HTML node, probably with some restrictions on features it supports. At the very least, the masking feature is all done in SVG, so that should be viable.
Does that sound reasonable to you?
As a note, if this is urgent, the Icon
type is public, so you can access the data to implement this in your own project (e.g: copying in Icon.corePath
with a few modifications) if you need to do this before the library has it implemented.
Yes it does sound good. I didn't use the more sophisticated features of your library yet so I didn't think of that.
It's not urgent :-)
I didn't end up being able to get around to this quickly, so I've just implemented the simpler version for now—as of 4.0.0 there is Svg.viewIcon
which gives a path for use in an existing SVG node. If someone wants to do something like masking in SVG, please open another issue for it.
I have a large "editor panel" rendered in svg next to a sidebar where the user can select a tool. Currently the tools each use a font awesome icon and it would be great to use the font awesome icons in the svg editor panel as well. (For example, to show the trash can above a token when you have the "delete" tool activated and hold down the left mouse button.)
For this I need a way to get the svg path element from the libary. It looks like the private function
Icon.corePath
does essentially what I need, save for the extrafill
property.Do you think exposing a function like this fits your library?