These are chat archives for openseadragon/openseadragon

23rd
May 2016
John Susi
@johnsusi
May 23 2016 06:50
@iangilman Should that preserve rotation as well? I've tried master since there was a PR landed about rotation but degrees is always set to 0.
John Susi
@johnsusi
May 23 2016 07:12
ahh I see, i have to supply degree: to Viewer. never mind then :)
foobarable
@foobarable
May 23 2016 12:28
Hi, I am playing arround with overlays and for some reason the overlays are shown once I zoom in anywhere (or move). Any hints? https://gp3.mpg.de/viewer
Antoine Vandecreme
@avandecreme
May 23 2016 13:11
@johnsusi yeah rotation is taken into account (on the master branch). You will need to make sure to serialize x,y,width,height and degrees from the rectangle returned by getBounds().
@foobarable how are the overlays added?
and what version of OSD are you using?
foobarable
@foobarable
May 23 2016 13:17
"openseadragon": "~2.1.0",
@avandecreme: I add the overlays to the tilesource object upon creation.
@avandecreme also, I use angular-openseadragon, which could be an issue as well
im really not sure what the reason could be
But yeah, it is likely that the angular module is the culprit
Antoine Vandecreme
@avandecreme
May 23 2016 13:21
not sure either. You can try to call viewer.forceRedraw() at some point (when the open event fire? or later?)
foobarable
@foobarable
May 23 2016 13:23
@avandecreme i am working on that. The problem is that I currently iterate over several seadragon directives and can't access the scope of the viewers directly. So, i need to find a workarround for that first
@avandecreme Are there any easy ways to get on-click events for those overlays?
thx for the hints so far.
Antoine Vandecreme
@avandecreme
May 23 2016 13:27
I usually just register to the event manually. OpenSeadragon.addEvent(overlayElt, 'click', clickHandler);
You could also use the mousetracker
would probably handle drag, touch etc better
foobarable
@foobarable
May 23 2016 13:28
but then i would need to see which element was clicked on
@avandecreme I have another question ;) As you could see I am using the overlays in collection mode. In the examples you use the coordinate system with coordinates between 0-1. This does not work in collection mode
i have to supply the absolute coordinates (in pixels?)
Antoine Vandecreme
@avandecreme
May 23 2016 13:31

but then i would need to see which element was clicked on

you can retrieve that element with viewer.getOverlayById()

As you could see I am using the overlays in collection mode.

Maybe that is the source of the issue. I don't see anything wrong with the angular directive.

In the examples you use the coordinate system with coordinates between 0-1. This does not work in collection mode
i have to supply the absolute coordinates (in pixels?)

Yeah that probably the easiest way.

foobarable
@foobarable
May 23 2016 14:14
@avandecreme but this will break once i just view one image. I fear i have to transform those coordinates dependent on the "view" case
foobarable
@foobarable
May 23 2016 14:20
@avandecreme I am testing overlays with single images next to exclude any problem with the collection mode and overlays
Antoine Vandecreme
@avandecreme
May 23 2016 14:20
Why would that break with just one image?
foobarable
@foobarable
May 23 2016 14:21
Well, i have to provide coordinates that are absolute in the whole collection mode view
check out the console in my example
i print out the list of images with their overlays. see the object with index 8.
it has very large coordinates, so i have to provide absolute coordinates in collection mode coordinate system
if i store those for each image those coordinates won't be valid for viewing just a single image
Antoine Vandecreme
@avandecreme
May 23 2016 14:30
ha, OSD does not convert the image coordinates (px, py) correctly if there are multiple images, yes?
foobarable
@foobarable
May 23 2016 14:30
that's what im experiencing, yes
phew, and i thought im too dumb to use it correctly
The most convenient behaviour would be that overlay coordinates are always in the interval of [0,1] and that in collection mode those coordinates are translated to the collection mode coordinate system, right?
foobarable
@foobarable
May 23 2016 14:39
position = viewport.pixelFromPoint(
this.bounds.getTopLeft(),
true
),
Antoine Vandecreme
@avandecreme
May 23 2016 14:43
I think that if an overlay is attached to a tile source, the coordinates should be relative to that tile source
if attached to the viewport, then it should be viewport coordinates