Home > Enterprise >  How to get coordinates when clicking on the image in React?
How to get coordinates when clicking on the image in React?

Time:11-18

I have an image in a React application, in the future images from cameras will be displayed there. the task is to get the coordinates of the clicked place by clicking on the image. as if we are clicking on a target in the image.

enter image description here

I've tried using const coordnates = [e.clientX, e.clientY] but I get screen coordinates not the

CodePudding user response:

It seems like that you're looking for this: Find mouse position relative to element. (getBoundingClientRect)

But there are plenty options that you can use for example <map>.

  • Related