# Set event on SVG element in perspective

**URL:** <https://forum.inductiveautomation.com/t/set-event-on-svg-element-in-perspective/29442>\
**Category:** Ignition Early Access\
**Created:** [October 28, 2019, 12:54pm UTC](https://forum.inductiveautomation.com/t/set-event-on-svg-element-in-perspective/29442 "2019-10-28T12:54:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nader.chinichian](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nader.chinichian/32/9261_2.png) [@nader.chinichian](https://forum.inductiveautomation.com/u/nader.chinichian)\
**Post date:** [October 28, 2019, 12:54pm UTC](https://forum.inductiveautomation.com/t/set-event-on-svg-element-in-perspective/29442/1 "2019-10-28T12:54:37Z")

</div>

Hi  
How can I configure event(script) on an element of SVG object in perspective?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 30, 2019, 10:45pm UTC](https://forum.inductiveautomation.com/t/set-event-on-svg-element-in-perspective/29442/2 "2019-10-30T22:45:10Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![swolnisty](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@swolnisty](https://forum.inductiveautomation.com/u/swolnisty)\
**Post date:** [October 30, 2019, 11:09pm UTC](https://forum.inductiveautomation.com/t/set-event-on-svg-element-in-perspective/29442/3 "2019-10-30T23:09:28Z")

</div>

Does the phrasing “isn’t currently possible” indicate that it is something planned for the future? That would be pretty interesting!

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 30, 2019, 11:28pm UTC](https://forum.inductiveautomation.com/t/set-event-on-svg-element-in-perspective/29442/4 "2019-10-30T23:28:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Marek\_Bahnik](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Marek\_Bahnik](https://forum.inductiveautomation.com/u/Marek_Bahnik)\
**Post date:** [May 2, 2023, 12:10pm UTC](https://forum.inductiveautomation.com/t/set-event-on-svg-element-in-perspective/29442/5 "2023-05-02T12:10:59Z")

</div>

Hello,  
is there any update on this matter or is it still not possible?  
Thank you

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [May 3, 2023, 9:42am UTC](https://forum.inductiveautomation.com/t/set-event-on-svg-element-in-perspective/29442/6 "2023-05-03T09:42:48Z")

</div>

not really through conventional means, but i made this

> [@Javascript inject in Perspective... have fun](https://forum.inductiveautomation.com/t/javascript-inject-in-perspective-have-fun/65805/5):
>
> Gonna try to keep this topic updated with all my cool injectings stuck_out_tongue Version 8.1.22 svg clicker wink
