# Is possible to know if my mouse is on an svg?

**URL:** <https://discourse.processing.org/t/is-possible-to-know-if-my-mouse-is-on-an-svg/32825>\
**Category:** Coding Questions\
**Created:** [October 14, 2021, 8:50am UTC](https://discourse.processing.org/t/is-possible-to-know-if-my-mouse-is-on-an-svg/32825 "2021-10-14T08:50:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomLeVeritable](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@TomLeVeritable](https://discourse.processing.org/u/TomLeVeritable)\
**Post date:** [October 14, 2021, 8:50am UTC](https://discourse.processing.org/t/is-possible-to-know-if-my-mouse-is-on-an-svg/32825/1 "2021-10-14T08:50:39Z")

</div>

Hello I would just like to know if it is possible to know when the mouse is on an SVG?

For example as above is it possible to know when our mouse is over Michigan and when it is over Ohio, And how do we do the detection if this is possible

> **[Get Child / Examples](https://processing.org/examples/getchild.html)**
>
> SVG files can be made of many individual shapes. Each of these shapes (called a "child") has its own name that can be used to extract it from the "parent" file. This example loads a map of the United …

---

<div class="post-metadata">

**Author:** ![hotfooted](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hotfooted/32/3670_2.png) [@hotfooted](https://discourse.processing.org/u/hotfooted)\
**Post date:** [October 14, 2021, 1:47pm UTC](https://discourse.processing.org/t/is-possible-to-know-if-my-mouse-is-on-an-svg/32825/2 "2021-10-14T13:47:54Z")

</div>

this has been discussed before here and as far as i know the PShape library hasn’t added any hit testing since it was talked about. there is in that discussion some ways to overcome the limitations so maybe it will be a handy read

---

<div class="post-metadata">

**Author:** ![matheplica](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/matheplica/32/21035_2.png) [@matheplica](https://discourse.processing.org/u/matheplica)\
**Post date:** [October 14, 2021, 2:48pm UTC](https://discourse.processing.org/t/is-possible-to-know-if-my-mouse-is-on-an-svg/32825/3 "2021-10-14T14:48:37Z")

</div>

With the [PGS library](https://github.com/micycle1/PGS) it’s possible, I use it like that :

```auto
import micycle.pgs.*;
boolean isInside() {
    return PGS_ShapePredicates.containsPoint(sh, new PVector(mouseX, mouseY));
  }

```
