These are chat archives for openseadragon/openseadragon

3rd
May 2016
Illya Moskvin
@IllyaMoskvin
May 03 2016 00:35
@altert Ah a 360 spin! Man, you're like the guru of OSD use in museums. Cool work!
I was at the Museums and the Web conference last month, and at the IIIF meet-up, they were talking about the possibility of including 360 spin specifications in their Presentation API.
Might be something to think about for OSD, if it goes through.
Erik Sjölund
@eriksjolund
May 03 2016 16:10
First post here. I've forked https://github.com/altert/OpenseadragonFabricjsOverlay and modified it to support Paper.js instead of Fabric.js. https://github.com/eriksjolund/OpenSeadragonPaperjsOverlay License: BSD. Although not present in the current repo, I managed to create a small example web page with a circle that I could drag with the mouse. Next week I'll have more time to continue the project.
Antoine Vandecreme
@avandecreme
May 03 2016 17:33
:+1:
Alexey Tikhonov
@altert
May 03 2016 18:48
@eriksjolund cool!
Grant Echols
@gechols
May 03 2016 20:18
I would like to process some keyboard input in OSD but when I add a listener to "keyup" or "keydown" I don't seem to be getting any events. Is there a special way to grab keyboard events in OSD?
Alexey Tikhonov
@altert
May 03 2016 20:20
@gechols to which object are you adding listener?
Grant Echols
@gechols
May 03 2016 20:23
I have tried both the parent element (a div) and the canvas element. Neither seems to work. I know there is a keyup handler in OSD, but I must have disabled something in our 'grid mode'. We make several changes to the viewer in this 'grid mode'
openseadragon.innerTracker.clickHandler = gridClickHandler;
openseadragon.innerTracker.dblClickHandler = gridDblClickHandler;
//Cancel the default dragEndHandler so the built-in boundary constraints aren't applied
openseadragon.innerTracker.dragEndHandler = function() {};

openseadragon.removeHandler("zoom", applyConstraints);
openseadragon.addHandler("canvas-scroll", gridCanvasScrollHandler);
openseadragon.addHandler("pan", gridPanHandler);
openseadragon.addHandler("tile-open-failed", tileOpenFailedHandler);
openseadragon.addHandler("tile-load-failed", tileOpenFailedHandler);

openseadragon.zoomPerClick = 1; //disable zoom in thumbnail mode.
openseadragon.gestureSettingsMouse.scrollToZoom = false;
openseadragon.gestureSettingsMouse.clickToZoom = false;
openseadragon.gestureSettingsTouch.pinchToZoom = false;
openseadragon.gestureSettingsTouch.dblClickToZoom = false;
openseadragon.gestureSettingsTouch.flickEnabled = false;
openseadragon.panHorizontal = false;
I'm wondering if one of the gestureSetting changes is disabling it somehow
Alexey Tikhonov
@altert
May 03 2016 20:25
but I thought only focused element can have keyup handler event? I’m not sure it’s applicable to OSD canvas. Why not bind keyup to window element?
Grant Echols
@gechols
May 03 2016 20:26
I would have thought that the parentEl would work, but that could be the problem - I have not reached high enough in the DOM stack to grab key events. I can try that.
Grant Echols
@gechols
May 03 2016 20:32
OK, I can get the key events on the window, but I lose any context that indicates that the keys should belong to the OSD viewer. Is this a problem with the canvas not being a 'focusable' element?
Alexey Tikhonov
@altert
May 03 2016 20:38
hmm. I think it’s more likely due to OSD having it’s own keyup handler (it’s onCanvasKeyPress)
Grant Echols
@gechols
May 03 2016 20:41
So what I did was I added a "tabindex" attribute and requested focus and I start getting key events now: $parentEl.attr("tabindex", "1").focus().on("keyup", gridKeyHandler);
Alexey Tikhonov
@altert
May 03 2016 20:41
you could try using your function similar to clickHandler. openseadragon.innerTracker.keyHandler = …
Grant Echols
@gechols
May 03 2016 20:46
That doesn't seem to work
Grant Echols
@gechols
May 03 2016 20:53
The $parentEl.attr("tabindex", "1").focus().on("keyup", gridKeyHandler); seems to be the most predictable and gives me control when I want.
Alexey Tikhonov
@altert
May 03 2016 20:55
ok. keyHandler is keypressed, not keyup. You can also use openseadragon.innerTracker.keyDownHandler to override all default OSD keyboard handling