I have many <rect> inside a <g> tag in my SVG.
And the <g> group is under a circle mask.
The result looks like this:
However, I would like to know, whether one <rect> is inside mask or not, for example:
This rect is inside the mask:
This rect is outside the mask:
This rect is half inside, half outside.
I want to assign different styles to them according to there masking status. For example:
For the shapes inside the mask, I want to add class .inside to them.
For the shapes outside the mask, I want to add class .outside to them.
For the shapes half inside the mask, I want to add class .half to them.
Currently, I can only calculate by using coordinate functions but what if the mask is not a circle?
Is there any way I can achieve this?



