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

Limit when panning can occur #24

Closed cancech closed 8 months ago

cancech commented 8 months ago

For zooming there is the capability to block zooming from taking place via OnWheel (i.e.: in the demos, block scroll unless Shift is pressed). Is there something comparable for panning? Playing around with the pan, it would appear that any mouse click+drag will cause panning, but I'd like to limit this to just specific occasions, such as:

Looking through the examples I'm not seeing anything which would allow for this type of control. If something of the sort is available, could you point me in that direction? Or thoughts on how something like this could be implemented?

Thanks!

gabedelgado commented 8 months ago

I've worked around this by creating an eventlistener in the window on keydown and keyup in the javascript directly, and when those events fire, you can enable or disable panning depending on the event. In my case, I decided to go back and call .net code so I can disable/enable with the BlazorPanzoom library, but you should be able to enable/disable it directly from javascript as well. It's a workaround, but it seems to work well. But I do agree with you ultimately, this feature would be nice to add to keep as much inside Blazor as possible.

cancech commented 8 months ago

Ok, thanks for the information!