These are chat archives for openseadragon/openseadragon

2nd
Jun 2017
criticalhits
@criticalhits
Jun 02 2017 15:45
Hi,
Is it possible to remove specific listeners? I am using a different canvas library with interactions involving mouse events, but I would like to add some zooming features that OpenSeaDragon has: without having to deal with multiple listeners from multiple libraries on one canvas for the same mouse event.
E.g., I'd be creating a open sea dragon canvas with an image, and then (if it doesn't clash) using the same canvas with another library so that I do drawing type interactions / overlaying shapes on the tiled image
I'm new to all of this javascript/web development stuff, forgive me if I didn't phrase the question properly!
William Lee
@WilliamCarlos
Jun 02 2017 16:56
what do you mean "delete" the event listeners? you can just leave them blank?
Ian Gilman
@iangilman
Jun 02 2017 17:00
@criticalhits It's fine if you have multiple handlers, as long as they don't conflict with each other
At any rate, you might start off by looking at some of the overlay plugins at http://openseadragon.github.io/#plugins
...there's one for canvas, for instance, with the idea being that you would draw additional things on top of the OSD canvas
William Lee
@WilliamCarlos
Jun 02 2017 17:01
if you're having issues with OSD navigation/drawing and other mouse operations (e.g. drawing on the canvas) this code might help
'''
mouseMode="OSD";
function setMouseMode(mode) {
switch(mode) {
case "OSD":
console.log("mousemode: OSD");
mouseMode="OSD";
viewer.setMouseNavEnabled(true);
break;
case "addAnnotation":
console.log("mousemode: addAnnotation");
mouseMode="addAnnotation";
viewer.setMouseNavEnabled(false);
break;
case "editAnnotation":
console.log("mousemode: editAnnotation");
mouseMode="editAnnotation";
break;
default:
console.log(mode);
throw "Tried to set invalid mouse mode";
}
} '''
oh boy that markdown didn't work
'''
'''
mouseMode="OSD";
function setMouseMode(mode) {
switch(mode) {
case "OSD":
console.log("mousemode: OSD");
mouseMode="OSD";
viewer.setMouseNavEnabled(true);
break;
case "addAnnotation":
console.log("mousemode: addAnnotation");
mouseMode="addAnnotation";
viewer.setMouseNavEnabled(false);
break;
case "editAnnotation":
console.log("mousemode: editAnnotation");
mouseMode="editAnnotation";
break;
default:
console.log(mode);
throw "Tried to set invalid mouse mode";
}
}
'''
William Lee
@WilliamCarlos
Jun 02 2017 17:06
you can use the mouseMode variable to separate fabricjs' mouse operations from OSD so that click/drag operations dont interact with the OSD viewer
not sure if that's what you were looking for