openseadragon: ImageToVieportZoom throws error on multi-image

Getting this error when having more that one tile on the viewer;

[Viewport.imageToViewportZoom] is not accurate with multi-image.

What should I use instead for multi-image ?

I think this should be a warning instead of an error, also anyway to suppress this ?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

@iangilman Hello, if it is still free, I would like to work on this issue

Yup, that’s a perfect solution. I wouldn’t call it a workaround… it’s exactly what you’re supposed to do in order to get an accurate result. 😃

@iangilman Hello, if it is still free, I would like to work on this issue

Go for it, and thank you!

Find a workaround for now, just need to get the largest image zoom:

  getTargetZoom = (scale = 1) => {
    let zooms = []
    const { viewport, world } = this.viewer
    const count = world.getItemCount()

    for (let i = 0; i < count; i++) {
      zooms[i] = world.getItemAt(i).imageToViewportZoom(scale)
    }

    return Math.max(zooms)
  }