These are chat archives for openseadragon/openseadragon

8th
Feb 2016
Grant Echols
@gechols
Feb 08 2016 21:28
I'm trying to 'draw' some overlays using a super imposed canvas element above the OSD viewer. I use the viewport.windowToViewportCoordinates to convert the X, Y coordinate of the starting position for the overlay into the correct coordinates. Do I also need to convert the width/height of the box into viewport coordinates somehow? It seems that when I'm zoomed in the resulting overlay is much larger than expected.
Alexey Tikhonov
@altert
Feb 08 2016 22:55
gechols: sure
you can use openseadragon-svg-overlay plugin as guide
Ian Gilman
@iangilman
Feb 08 2016 22:57
@gechols I would think you would want viewportToWindowCoordinates to figure out where to draw it on the canvas (assuming you have the overlay coordinates in viewport coordinates)
Btw, if you wanted to share your work, an openseadragon-canvas-overlay plugin would be awesome!
Alexey Tikhonov
@altert
Feb 08 2016 22:58
I happen to have almost finished one, but it's pretty much copy of svg-overlay
Ian Gilman
@iangilman
Feb 08 2016 22:59
That's fine! :)
Alexey Tikhonov
@altert
Feb 08 2016 22:59
speaking of which, I too have a question: I'm trying to run fabricjs over OSD
I've tried to put it into canvas overlay similar to svg overlay
but it tends behave wonky (seems to confuse mouse up events somehow)
so I made a div with fabric canvas static over OSD
the question is how can I fire up OSD Mouse tracker when there is a div above it?
Ian Gilman
@iangilman
Feb 08 2016 23:02
You mean how can you let the OSD viewer's mouse tracker get events that are obscured by the div?
Alexey Tikhonov
@altert
Feb 08 2016 23:03
yes
Ian Gilman
@iangilman
Feb 08 2016 23:03
Have you tried pointer-events: none on the div?
Alexey Tikhonov
@altert
Feb 08 2016 23:03
no. I'll give it a try, thank!
Ian Gilman
@iangilman
Feb 08 2016 23:04
Do you also want mouse events on the fabric?
Alexey Tikhonov
@altert
Feb 08 2016 23:04
not neccesary at the same time
can be switch to/from OSD
Ian Gilman
@iangilman
Feb 08 2016 23:04
Cool, then that should work
Alexey Tikhonov
@altert
Feb 08 2016 23:16
it totally works! thanks
Ian Gilman
@iangilman
Feb 08 2016 23:17
Excellent :)
Alexey Tikhonov
@altert
Feb 08 2016 23:19
speaking of canvas overlay - do you think it's worth it to put it on github? it's 95% svg-overlay
Ian Gilman
@iangilman
Feb 08 2016 23:21
Absolutely...I'm sure there are people who would find it useful who wouldn't know which 5% to change
Alexey Tikhonov
@altert
Feb 08 2016 23:24
ok. I'll do it then
Ian Gilman
@iangilman
Feb 08 2016 23:25
Awesome...and then we can add it to http://openseadragon.github.io/#plugins
Alexey Tikhonov
@altert
Feb 08 2016 23:33
I think I know now how to combine fabricjs with OSD, but not sure yet, if that's combinable in clean plugin. Need to think about it
Ian Gilman
@iangilman
Feb 08 2016 23:43
Very cool
Alexey Tikhonov
@altert
Feb 08 2016 23:45
if I was to tell OSD that I've clicked on some div over it, I might be able to do it with viewer.raiseEvent?
Ian Gilman
@iangilman
Feb 08 2016 23:46
That wouldn't really tell the viewer about it...that would just fire the event meant for the API
You might be able to hack it by calling handlers on its mousetracker though
Alexey Tikhonov
@altert
Feb 08 2016 23:47
thank. will dig into it)