Openseadragon: Get TiledImage from Multi-Image collection

Created on 24 Jun 2021  路  3Comments  路  Source: openseadragon/openseadragon

Hi
I have a multi-image in the collection mode. I would like to get the TiledImage the mouse pointer is hovering over. The only idea I have is to loop thru all TiledImages calling tiledImage.viewportToImageCoordinates(x,y) and hoping that if I miss the TiledImage I'm looking for the function will return null. Is there a better approach?
Or maybe I create an overlay for each tiledImage.getBounds() and try to detect which overlay the mouse is hovering over?

D

question

All 3 comments

Looping through the images is what I recommend. Here's an example: https://codepen.io/iangilman/pen/PqxvgN

Thanks, very helpful as usual :)
Just a little observation
viewer.viewport.fitBounds(viewer.world.getItemAt(index).getBounds());
Does this look a bit off or this is the expected behaviour of .fitBounds?
Try here https://cdpn.io/iangilman/fullpage/PqxvgN

PS. Is it better to ask questions in the discussions?

@darwinjob Good catch! I've now fixed it, with gestureSettingsMouse: { clickToZoom: false }.

Was this page helpful?
0 / 5 - 0 ratings