I have an irregular shape on my screen. As soon as the mouse cursor enters into the shape, a text must be shown inside the shape. However, the text sometimes appears also when the mouse is not yet entered into the shape. I guess it is because the Mouse Enter event which I am using in this case, does not take into account the irregular boundaries of the shape, but just its bounding rectangle.
Since I want to use this method for a linguistic map having several irregular-shaped geographic areas touching each other, I need a more accurate method to detect the boundaries of each areas. Do you think isPointInPath() method is the the best choice for this purpose? Any suggestion on how to use it in this case?
Do you use freeform shapes?
If so, the second CSS selector in @mackavi’s answer should be .irregular > svg > :first-child.
If you don’t know where to set the class and CSS, you can see this topic: Events of transparent areas
I would prefer to do all my map drawings with Inkscape and importing them into SA.
In the case of a freeform shape drawn inside SA, the text inside the shape is correctly shown when the mouse cursor enters into the boundaries of the shape, even if it flickers a little bit when the mouse cursor passes over the text area.
On the contrary, in the case of an imported SVG (be it Inkscape or Plain SVG, it seems it does not make any difference), I cannot understand why the text does not appear at all even if I followed your indications. I have attached my Saola file for your information. test_area.zip (10.3 KB)
The above CSS only works for Saola Animate shapes and freeforms. It doesn’t work with imported SVG images.
You can use Curve tool (Elements > Shape > Curve) in Saola Animate to draw a custom curve so that it works with the above CSS. For more information about creating and editing a curve, please see this tutorial: https://atomisystems.com/html5-animation/drawing-vector-graphics/
Sorry, I completely misunderstood. I thought it was possible to do it also with an imported SVG image.
If there is no other choice, I will try to draw all the shapes in Saola Animate instead of using Inkscape.
Thank you for your support.