openseadragon / svg-overlay

An OpenSeadragon plugin that adds SVG overlay capability.
BSD 3-Clause "New" or "Revised" License
58 stars 28 forks source link

Catching certain mouse events without preventing others #33

Closed SeguinBe closed 5 years ago

SeguinBe commented 5 years ago

Hello,

I have been playing a bit with this beautiful library but I am stuck on something.

I can successfully display an SVG shape and can add an event for double clicking on it:

new OpenSeadragon.MouseTracker({
          element: <my-svg-element>,
          dblClickHandler: (e) => console.log(e)
    })

Otherwise catching the double click event disable all the other events (for instance being able to drag the view) happening on the SVG shape. I guess the event is consumed wether or not a handler is attached to it? Reading the documentation, I was expecting the default action to only be prevented if PreventDefaultAction is set to true for the incoming event, but I guess I am missing something?

Cheers, and wonderful work on this library 👍

iangilman commented 5 years ago

@msalsbery Any thoughts on this?

SeguinBe commented 5 years ago

Actually, in the end I used https://github.com/msalsbery/OpenSeadragonViewerInputHook to disable all clicks events for openseadragon.

I then simply use the standard onclick events of the svg elements. I am not sure yet that approach will give me all the flexibility I need eventually but so far it works fine.

iangilman commented 5 years ago

Interesting. Well, it's clear we need to improve our mouse/touch handling! We have several issues for that filed in the OSD repository.