Click action on SVG shape only but not entire component

How can I restrict the click action to the svg shape only and not its entire rectangle?
Thanks
Colm

You could add condition in click event to check if click coordinates are within shape boundaries.

The easiest is use an overlay of some kind, like a label, then use the click event for that component.

I think the OP only wants a response when the green area is clicked.

yes, that is correct. thanks

Victor made a JS injection that will let you know the name of the SVG element that was clicked, might work here.

4 Likes

yes should work for this

2 Likes

Thanks a million. This worked. I changed it to a mousehover event and then checked the custom prop value in my click event. I also tried to use it to enable/disable the tooltip, which it did, but this didn't function as hoped. I guess the tooltip doesn't update once it has been triggered. I may use a tooltip style popup instead for these objects. Cheers.

iirc there is a component function to open the tooltip, you could use this probaly to open after updating it

requestTooltip()
1 Like

Your solution is great. Hopefully the new drawing tools will also allow us to add hitboxes to SVG sub elements to support this level of SVG integration natively (wink wink).

I'll be surprised if we have something like that in 8.3 at launch but I could see that becoming a thing down the road. Along the lines of their "first make it possible and then make it easy" strategy.

2 Likes