These are chat archives for openseadragon/openseadragon

24th
Feb 2016
foobarable
@foobarable
Feb 24 2016 07:56
@iangilman Hmm, not really. I sleeped 2 seconds and then the world was filled with the pictures and I could move them arround. I guess this is not the most beautiful way to do it. Passing X and Y arguments in the tileSources object didn't do anything.
Ian Gilman
@iangilman
Feb 24 2016 17:16
@foobarable You can use viewer.addHandler('open', function() {...}) to wait until the images are loaded
As for the x and y arguments, can you share how you're doing it? Also, are you using collectionMode? It overrides any x and y you provide, so you shouldn't use it if you want a specific layout
Grant Echols
@gechols
Feb 24 2016 18:12
I think I'm trying to do something unique with image overlays and I'm running into problems. My scenario is this: I have multiple images in the world list. I want to define a set of overlays that are globally applied to the images as we navigate from one to the next. We "navigate" from one image to the next by changing the viewport bounds to the current image bounds. When this navigation occurs I'm trying to "pick up" the overlays from the previous image and get them added to the current image. I must be messing up the rectangle calculation though because they never show up and when I look at the X, Y, W, H coordinates they seem to be way too large for the new image. I know this is a bit off the beaten path, but can anyone come up with some guidance on how to properly translate the coordinates of the overlay rectangle from one image to the next?
Ian Gilman
@iangilman
Feb 24 2016 18:14
@gechols Are you using viewport coordinates for your overlays?
Also, do you want your overlays to stick to the images as you zoom and pan, or are they more of a heads up display that you want to stay fixed on the screen?
Grant Echols
@gechols
Feb 24 2016 18:18
I start out drawing a 'rectangle' on the window and use tiledImage.windowToImageCoordinates to create image based coordinates. I'm hoping that these 'image' coordinates will transition to multiple images. I then use tiledImage.imageToViewportRectangle before calling viewer.addOverlay (I want the overlays to zoom in/out, pan, etc. and things are good at this point).
Ian Gilman
@iangilman
Feb 24 2016 18:20
Hmm...sounds like you're doing the right coordinate conversions...
So what process do you use to move an existing overlay to a new image space?
Grant Echols
@gechols
Feb 24 2016 18:20
For getting them onto the original image I am - when I switch images I seem to be messing things up.
I grab the original 'image location' and run it through the tiledImage.imageToViewportRectangle call using the newly selected tiledImage
That seems to be the wrong thing to do though
The numbers just seem to be way too large and I don't see anything on the viewer
Ian Gilman
@iangilman
Feb 24 2016 18:22
And both of the images have the same width and height?
Grant Echols
@gechols
Feb 24 2016 18:23
Ya - within a few pixels.
I also tried delaying the code for a few seconds to make sure the tiledImage got updated and fixed as it 'pans' into view.
Ian Gilman
@iangilman
Feb 24 2016 18:25
And you're not moving the tiled images, right? Just panning the viewport?
And how do you update the overlay position once you have a new rectangle for it?
(it sounds like you're doing the right things)
Grant Echols
@gechols
Feb 24 2016 18:31
We don't move the tiled images, but we do change the viewport bounds so that the new image fills the viewport. I would think that the viewport relative positions would be relatively similar when we call the addOverlay method, and that's what seems to be messed up. The first time I call addOverlay the rectangle is X=376, Y=556, W=1118, H=465 (rounded off) but when I call it again after the image changes X=2623, Y=211, W=189, H=78. Doesn't even look close so I'm pretty sure I'm calling something wrong.
I'm going to try to post my code to a test site... I can't imagine being able to grasp the mess I'm making without seeing it in operation.
Ian Gilman
@iangilman
Feb 24 2016 18:34
The viewport coordinates are one set of coordinates for the whole world...if you have one image in the upper left of the world and another in the lower right, their x and y are going to be quite different
Given those coordinates, it looks like you're displaying one image large and to the left and another image smaller and up and to the right of the first. Is that the case?
But yes, posting a working example would help a good deal!
Anyway, those viewport coordinates you just posted seem reasonable. What technique are you using to tell the overlay to move?