img-mapper/react-img-mapper

Programmatically set highlighted area/s.

Closed this issue · 0 comments

Is your feature request related to a problem? Please describe.
I couldn't find a solution for programmatically setting selected areas.
I want to sync a map with a dropdown field. See picture.

image

Describe the solution you'd like
It would be great if the highlighted areas would be available as value and to get the current set of active areas with onChange, similar to how you would handle form inputs.
Of course, the value could be overwritten to reflect the rendered areas.

Describe alternatives you've considered
I tried working around the problem (before I read the code) assuming I could set the img-mapper-area-highlighted class on the area elements to highlight an area. Before I noticed that the canvas actually takes care of displaying the areas.

Additional context