ruven / iipmooviewer

IIPMooViewer is an advanced javascript HTML5 image viewer for streaming high resolution scientific images

Home Page:https://iipimage.sourceforge.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get Coordinates

idoshamun opened this issue · comments

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

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.

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.