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

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

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

With the PGS library it’s possible, I use it like that :

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