# Perspective mouse event: x, y coordinates

**URL:** <https://forum.inductiveautomation.com/t/perspective-mouse-event-x-y-coordinates/103852>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [March 18, 2025, 10:32pm UTC](https://forum.inductiveautomation.com/t/perspective-mouse-event-x-y-coordinates/103852 "2025-03-18T22:32:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [March 18, 2025, 10:32pm UTC](https://forum.inductiveautomation.com/t/perspective-mouse-event-x-y-coordinates/103852/1 "2025-03-18T22:32:06Z")

</div>

Hi all,  
When I click a component in a Perspective view is there any way to get the x, y coordinates relative to the component I clicked? In the help I read about clientX/Y, screenX/Y, pageX/Y but nothing related to the clicked component.

Thanks in advance, regards

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 18, 2025, 11:06pm UTC](https://forum.inductiveautomation.com/t/perspective-mouse-event-x-y-coordinates/103852/2 "2025-03-18T23:06:21Z")

</div>

I don't think this is possible at present. I tried to do find a way to detect the click coordinates in a View Canvas so the user could add views containing icons onto a floor layout. There was no solution to my bumping this [View Canvas mouse click coordinates](https://forum.inductiveautomation.com/t/view-canvas-mouse-click-coordinates/84636) thread. It does seem like a significant omission.

---

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [March 19, 2025, 7:26am UTC](https://forum.inductiveautomation.com/t/perspective-mouse-event-x-y-coordinates/103852/3 "2025-03-19T07:26:26Z")

</div>

Thanks @Transistor . This is my second time I post this question: this time I have an image component where I show an SVG representing a plant and I'd like to catch the element inside the SVG where the operator clicks. Since each element is represented through the xy coordinates of its vertices, I was thinking of getting the mouse xy to get to the chosen element: in this case xy must be relative to the image component itself.

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [March 19, 2025, 7:40am UTC](https://forum.inductiveautomation.com/t/perspective-mouse-event-x-y-coordinates/103852/4 "2025-03-19T07:40:41Z")

</div>

You can do it I believe with one of @victordcq 's js hacks posted already, I think it gets the SVG id

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

---

<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:** [March 19, 2025, 8:03am UTC](https://forum.inductiveautomation.com/t/perspective-mouse-event-x-y-coordinates/103852/5 "2025-03-19T08:03:24Z")

</div>

You definilty should not use coordinates to calculate which element is clicked, Its going to be a pain with zoom's and different sizes of screen.  
Use one of my injections, it can catch the _name_ prop in the svg.  
The link nminchin supplied has an example view

---

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [March 19, 2025, 5:54pm UTC](https://forum.inductiveautomation.com/t/perspective-mouse-event-x-y-coordinates/103852/6 "2025-03-19T17:54:46Z")

</div>

Many thanks, I will give it a try and be back soon!
