shaigem / BlazorPanzoom

Blazor wrapper for timmywil's panzoom library that helps make zooming and panning of Blazor components and elements easier
https://shaigem.github.io/BlazorPanzoom/
MIT License
44 stars 12 forks source link

onclick gets triggered by panning #11

Closed wihrl closed 2 years ago

wihrl commented 2 years ago

What would be the best way to handle buttons and other input elements within a pan container? @onclick works, however, it gets triggered even when the user is panning.

The obvious solution to this is to use @onmousedown and @onmouseup and check the mouse position delta. That will not work with Blazor because it seems to attach all events to the root document.

wihrl commented 2 years ago

I've managed to mostly fix this by adding

image

to blazorpanzoom.js so that the events bubble up to document. (The default function calls stopPropagation()) Would be nice to be able to set this from C# somehow.