How to make paths of a single or multiple SVG's clickable?

Godot Version

4.3

Question

I’d like to make each square of this svg

<svg width="400" height="400" xmlns="http://www.w3.org/2000/svg">
    <path d="M 0 0 H 200 V 200 H 0 Z" fill="#ff0000"/>
    <path d="M 200 0 H 400 V 200 H 200 Z" fill="#00ff00"/>
    <path d="M 0 200 H 200 V 400 H 0 Z" fill="#0000ff"/>
    <path d="M 200 200 H 400 V 400 H 200 Z" fill="#ffff00"/>
</svg>

clickable. I tried it with Polygon2D and CollisionPolygon2D, as the future paths will contain several points.

Nothing has worked so far. Do you know a way to make the areas of a single or multiple SVG’s clickable?

You can use Geometry2D (Geometry2D — Godot Engine (stable) documentation in English) for this, using get_global_mouse_position or get_local_mouse_position on your node when you detect a click using Input or _unhandled_input method.

An example from my plugin Scalable Vector Shapes 2D:

Would you like to try the plugin? It ships an svg to Polygon2D importer as well

On github: GitHub - Teaching-myself-Godot/ez-curved-lines-2d

Youtube:

A-Z Explainer: https://youtu.be/_QOnMRrlIMk
Some updates: https://youtu.be/pP0CYEvU2uQ