question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tile-source-specific overlays break in multi-image

See original GitHub issue

@hussainb reports:

I am following the Basic Single-Row Tile Source Collection example with the same configurations and tile sources as mentioned in the example. I am now trying to add overlays on the first and second image but having trouble doing it. The first overlay should have been positioned on top of the first image and the second overlay should have been placed on the second image but its not happening that way… I am adding the overlays collection to the tileSources collection. Are the overlays not independent for different pages?

Also, I get the below error in console after adding the overlays, I do not understand how I can use TiledImage.imageToViewportRectangle in such basic initialization of the plugin.

[Viewport.imageToViewportRectangle] is not accurate with multi-image; use TiledImage.imageToViewportRectangle instead.

https://codepen.io/hussainb/pen/QQPPvL

Sure enough, when you include overlays on a per-tileSource basis when you create your viewer, we use the global imageToViewportRectangle instead of the tiledImage-specific one, which we should use.

I think the solution is probably to pass the tiledImage into the addOverlay call in open here:

https://github.com/openseadragon/openseadragon/blob/master/src/viewer.js#L628

…and then get it to getOverlayObject where it can be used for the imageToViewportRectangle call:

https://github.com/openseadragon/openseadragon/blob/master/src/viewer.js#L2348

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hussainbcommented, Mar 17, 2018

@iangilman , awsome it works! thank you!

1reaction
iangilmancommented, Mar 13, 2018

Here’s an updated example:

https://codepen.io/iangilman/pen/EEPyyx

Note that I’m just changing the font size. I’m using the viewport-change event, as that’ll create the smoothest animation. To get the proper font-size, we have to calculate the zoom factor based on the zoom value and the width of all the images (world.getHomeBounds).

By the way, if you want everything in your overlays to zoom with the images, you might look into the SVG overlay plugin:

https://github.com/openseadragon/svg-overlay

It uses SVG instead of HTML, but everything scales exactly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overlay tiled images on a map - UWP - Microsoft Learn
Overlay third-party or custom tiled images on a map by using tile sources. Use tile sources to overlay specialized information such as ...
Read more >
Overlays - OpenSeadragon
A tile source overlay is specific to the particular tile source. ... OpenSeadragon also supports overlays that persist across image sequences.
Read more >
openseadragon/openseadragon - Gitter
You'll want to use the multi-image API to position everything the way you want it. As for your custom tile source, why is...
Read more >
Tile Overlays | Maps SDK for Android - Google Developers
A tile overlay, sometimes called a tile layer, is a collection of images that ... The Google Maps API breaks up the imagery...
Read more >
https://www.domenicoperrone.net/openseadragon/chan...
Added new tile source for simple images: ImageTileSource (#760) ... Swedish keyboard (#763) 2.0.0: * True multi-image mode (#450) * BREAKING CHANGE: Passing ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found