img-mapper / react-img-mapper

React Component to highlight interactive zones in images
https://img-mapper.github.io/react-docs
MIT License
122 stars 39 forks source link

onClick works one time #80

Closed geeflaxx closed 7 months ago

geeflaxx commented 10 months ago

Describe the bug A clear and concise description of what the bug is. I want to use a function if I am clicking on an area. The first time the function will be used. After clicking on the other area, nothing happend.

At the screenshot you can see: Postit, keyboard and desktop is marked.

in the console only one time shows the log message "Logging a message!'", It should be everytime if I am click on the different area. Do you have a solution?

To Reproduce Steps to reproduce the behavior:

  1. Go to the page, hover on all the polygons
  2. Click on a polygon
  3. Console output shows right
  4. After clicking on another polyigon the output don't show up

grafik

Desktop (please complete the following information):

Additional context Add any other context about the problem here. I use for usually typescript.

const logMessage = () => {
    console.log('Logging a message!');
};

<ImageMapper src={URL} map={MAP} stayMultiHighlighted={true} onClick={logMessage}/>

NishargShah commented 9 months ago

Hello @geeflaxx, can you please provide the example in code sandbox? and if possible, please use the latest version https://www.npmjs.com/package/react-img-mapper/v/2.0.0-alpha.3

NishargShah commented 7 months ago

Due to no example from the @geeflaxx, I am closing it.