These are chat archives for openseadragon/openseadragon

16th
Nov 2016
Tristan Roddis
@tristanr-cogapp
Nov 16 2016 13:12
For a multiple-image viewer, what's the easiest way to find out the actual pixel regions that are displayed in the viewport for the image(s)?
If it helps, I don't need to know actual image region coordinates, just the overall area that is displayed of each image (in pixels)
I.e. I want to trigger an event when the overall area of a given image that is displayed is less than 10 pixels square
Antoine Vandecreme
@avandecreme
Nov 16 2016 17:05
@tristanr-cogapp you probably need to callviewport.getBounds and tiledImage.getBounds and then compute the intersection of the 2.
We have a rect.intersection method but it only works for the bounding box, see: https://github.com/openseadragon/openseadragon/blob/master/src/rectangle.js#L314
If you are not playing with rotation, that should be enough for you.
Once you have the intersection in viewport coordinates, you can just call tiledImage.viewportToImageCoordinates to get the coordinates in image pixels.