These are chat archives for openseadragon/openseadragon

15th
Mar 2017
sickrandir
@sickrandir
Mar 15 2017 08:54
@iangilman made the same change for the canvas-drag event as a separate PR
how can I modify the documentation?
Ian Gilman
@iangilman
Mar 15 2017 16:36
@sickrandir Right on... I've added a note to the canvas-drag PR and merged the canvas-click PR. I assume you've figured out how to modify the documentation? The doc comments automatically get built into documentation when we release.
sickrandir
@sickrandir
Mar 15 2017 16:38
@iangilman thanks. I missed the implication of the canvas-drag change I introduced. Now I'm starting to grasp them
Ian Gilman
@iangilman
Mar 15 2017 16:38
:)
sickrandir
@sickrandir
Mar 15 2017 16:39
the reason i introduce that change is that I wanted to be able to block dragging when my context-menu is open
you can see an example here
toggleLabelMenuOverlay
sorry
here
Ian Gilman
@iangilman
Mar 15 2017 16:40
Yeah, I think it's a good change... it's what we should have done from the beginning. I'm just wanting to make sure we think through the implications now that it's an existing API we're modifying
sickrandir
@sickrandir
Mar 15 2017 16:40
with touch/mobile mode enabled, the context menu is triggered with long press and I want to be able to move the pointer over one of the icons without dragging the canvas
the only problem that I still have, is that I'm not able to capture the release event on the icons of the context menus!
even attaching a MouseTracker to the every element and defining releaseHandler doesn't work
Ian Gilman
@iangilman
Mar 15 2017 16:42
That's a pretty wild app! Fun to see :)
So you mean you want people to be able to continue keeping their finger down during the long press and move it over to the appropriate menu item? Makes sense
sickrandir
@sickrandir
Mar 15 2017 16:44
Yes, it's something along the lines of what the Pinterest app does with its context menu
Ian Gilman
@iangilman
Mar 15 2017 16:45
Pretty slick :)
I'm not sure the best fix for the release handler issue...
sickrandir
@sickrandir
Mar 15 2017 16:46
once it's finished I think it could be made into a plugin maybe
Ian Gilman
@iangilman
Mar 15 2017 16:46
presumably it's because the drag captures the mouse, so you don't get release on anything else than the canvas
A plugin for that behavior would be sweet!
One possible work around for the release would be to get the canvas-release event, and do your own hit testing to determine if it hit any of the buttons
sickrandir
@sickrandir
Mar 15 2017 16:47
I tried that with document.elementFromPoint(data.position.x,data.position.y);
but I wasn't able to get the element
don't know why, it always returns the canvas element
maybe I'm using the wrong coordinates...
Ian Gilman
@iangilman
Mar 15 2017 16:51
Looks like canvas-release gives the position in pixels relative to the viewer's canvas and elementFromPoint takes its x, y in pixels relative to the entire window. Did you convert between the two?
Anyway, presumably you know which elements are your buttons... you can loop through them and test their coordinates yourself. That way you don't have to worry about whether something else is in front of them (since elementFromPoint always picks the topmost if there are multiple elements hit)
sickrandir
@sickrandir
Mar 15 2017 16:54
I see...I think I'm missing something with the coordinate conversion
I'll look a bit into it.
Thanks as usual!!!
Ian Gilman
@iangilman
Mar 15 2017 16:55
Sure :)
sickrandir
@sickrandir
Mar 15 2017 17:39
It's working now! I had to convert to window coordinates as you guessed. Thanx a lot!
Ian Gilman
@iangilman
Mar 15 2017 20:57
@sickrandir Excellent :)