These are chat archives for openseadragon/openseadragon

20th
Nov 2014
aeschylus
@aeschylus
Nov 20 2014 22:02
Hello. Is there a way to bind events to overlays in the collections branch?
I want to register hover events on each rectangular div overlay element, or otherwise capture and parse them from above.
Ian Gilman
@iangilman
Nov 20 2014 22:03
I don't think anything has changed in that regard. Was it possible before?
(I'm not as conversant with overlays as some of the other areas)
Mark Salsbery
@msalsbery
Nov 20 2014 22:04
As far as I know, overlays are just HTML elements, so events can be binded to them in the usual ways
aeschylus
@aeschylus
Nov 20 2014 22:04
I thought so as well, and this used to be possible.
But it no longer works.
Ian Gilman
@iangilman
Nov 20 2014 22:04
Which seems like the way to go. But maybe it's tricky finding which one is which?
How are you trying to do it
?
aeschylus
@aeschylus
Nov 20 2014 22:05
I can easily select them with document.getElementByClassName(), or jquery or some such, but events do nothing.
They simply never fire.
Mark Salsbery
@msalsbery
Nov 20 2014 22:05
Which events?
aeschylus
@aeschylus
Nov 20 2014 22:05
The same was happening with click events some time ago, although I believe this has been resolved recently.
clicking or hovering.
I have not tried others.
Ian Gilman
@iangilman
Nov 20 2014 22:06
Perhaps it's related to #502?
How is work going on that, @msalsbery?
aeschylus
@aeschylus
Nov 20 2014 22:06
It's possible I'm just overlooking something, but it seems endemic. The same methods work on elements not stored on the canvas, and on the canvas itself.
Yes, I believe it's related.
Mark Salsbery
@msalsbery
Nov 20 2014 22:07
@iangilman Click or mouse up perhaps, but no others I’m aware of. mouseover and mouse out should work on all browsers as a starting reference - If you don’t get those then I reckon the event isn’t bound
aeschylus
@aeschylus
Nov 20 2014 22:07
Also, I noticed that the documentation has an .addEvent() method that doesn't seem to be present in collections mode.
Hm.
Well, they're being selected.
Mark Salsbery
@msalsbery
Nov 20 2014 22:08
@iangilman testing testing testing…too many browsers and devices. Can’t they all just get along?
aeschylus
@aeschylus
Nov 20 2014 22:08
Even selecting them after the fact in the console and binding the events there doesn't seem to work
I'm using chrome 39 on os 10
Ian Gilman
@iangilman
Nov 20 2014 22:15
All righty... I'll take a look at the overlay selecting.
Ian Gilman
@iangilman
Nov 20 2014 22:31
@aeschylus I have verified the 'overlays behind the canvas' issue and I'm working on fixing that. I've also verified the 'can't click on overlays' issue and I'll investigate to see whether it's #502 or something else.
As for the overlays going away on viewer.open, I believe that's how it was before the collections branch and I've verified that that's how it is now. Incidentally, if you include overlays as part of the options when you create the viewer, they do come back for every new open(). Overlays added with addOverlay do not.
Ian Gilman
@iangilman
Nov 20 2014 22:45
@aeschylus I have a fix for the "overlays behind canvas"; I'll check it in shortly.
I can get clicks for overlays just fine... there's one issue that might be tripping you up, though... overlays don't actually exist until after an update after they've been added, so if you addOverlay and then try to select it, it won't be there.
I'll look into sorting that out. Meanwhile, try adding a setTimeout to verify that that's the issue.
Ian Gilman
@iangilman
Nov 20 2014 22:51
@aeschylus the 'behind canvas' bug fix is up at #523.
@msalsbery I hear you... just want to lock them all in a room until they sort out their differences!
Ian Gilman
@iangilman
Nov 20 2014 23:36
@aeschylus the "overlays not immediately available" issue is now fixed on #523 as well.