These are chat archives for openseadragon/openseadragon

24th
Oct 2018
Tammy DiPrima
@tdiprima
Oct 24 2018 15:48
Hey guys. I’ve got a small heatmap of the slide image on a static webpage. And I want to make it clickable, such that I can then zoom to a location on the actual image in openseadragon. I have a feeling I might be reinventing the wheel. Does anybody know how it’s done? Mapping coordinates on a smaller image to the larger slide image?
Ian Gilman
@iangilman
Oct 24 2018 16:37
@tdiprima if you haven't done anything to change this, the viewport coordinates in your OpenSeadragon are such that 0 is the left side and 1 is the right side. To convert a click in your static image into viewport coordinates, then, is as simple as dividing the click position (relative to the static image) by the width of the static image.
Tammy DiPrima
@tdiprima
Oct 24 2018 16:42
Yes, thank you for confirming. I was going to use html <map> with the smaller image. I was guessing that somebody came up with a library to map all points on an image automatically. You know what I mean? I could do the long and tedious way. Just wondering.
Ian Gilman
@iangilman
Oct 24 2018 16:44
You want different parts of the image to go to different pages?
Tammy DiPrima
@tdiprima
Oct 24 2018 16:45
No, different parts of the image to go to different points in the viewer.
Ian Gilman
@iangilman
Oct 24 2018 16:46
Seems like that would be a lot easier with JavaScript than with an HTML map.
Tammy DiPrima
@tdiprima
Oct 24 2018 16:46
mm. You’re probably right. Thanks, Ian! :)
Ian Gilman
@iangilman
Oct 24 2018 16:47
Put a click handler on the smaller image and grab the click location from the event. Convert it to viewport coordinates and use that to navigate to the correct location in the OpenSeadragon image.
Otherwise you'd have to build a monster HTML map to get every point!
Tammy DiPrima
@tdiprima
Oct 24 2018 16:48
Right :) Cheers, thanks a lot!
Ian Gilman
@iangilman
Oct 24 2018 16:48
:-)