Hi
How can I configure event(script) on an element of SVG object in perspective?
@nader.chinichian,
If I understand what you’re asking for correctly, no, this isn’t currently possible. Because SVGs are rendered on the final page as a single DOM element, they don’t have individual nodes. Before 8.0.0 was fully released, we had a work-in-progress mode where SVGs were added to Perspective as a stack of individual components, similarly to how things worked in Vision, but it had some serious performance drawbacks.
For now, what you could do is parse the event.clientX
and event.clientY
values passed to mouse events in Perspective, and then see if they overlap with the region you want to be able to fire the script. It won’t be perfect, unless you know the exact resolution your SVG will be rendered at, but it’s a start.
Does the phrasing “isn’t currently possible” indicate that it is something planned for the future? That would be pretty interesting!
It’s possible we’ll revisit that earlier attempt - either as an optional mode (if you’re aware of the potential performance hit) or if we can get it working well enough. I wasn’t paying close attention at the time, but I think there may also have been problems with trying to parse SVGs - the SVG document specification is pretty wild, so implementing a parser for it is no small task.
Hello,
is there any update on this matter or is it still not possible?
Thank you
not really through conventional means, but i made this