Get Coordinates
idoshamun opened this issue · 2 comments
idoshamun commented
Hi,
I'm trying to transform mouse click event to image coordinates without any success.
Is it possible to implement a new function which gets control coordinates and returns image coordinates?
Thanks,
Ido
idoshamun commented
I think I've found the transformation:
var pos = iipmooviewer.canvas.getPosition();
var left = (e.event.clientX - pos.x) * iipmooviewer.resolutions[iipmooviewer.num_resolutions - 1].w / iipmooviewer.wid;
var top = (e.event.clientY - pos.y) * iipmooviewer.resolutions[iipmooviewer.num_resolutions - 1].h / iipmooviewer.hei;
Please, correct me if I'm wrong.
ruven commented
It depends what you're trying to do. Take a look at the updateCoords(event) function, which is currently used to view real-time image coordinates. It takes a mouse move event, calculates the physical image coordinate and displays this in the overview navigation window.