dy / pan-zoom

Pan / zoom for any element
MIT License
88 stars 15 forks source link

Disable/enable pan or zoom individually. #23

Closed soulfresh closed 4 years ago

soulfresh commented 4 years ago

What does this PR do?

Updates the API to allow users to disable or enable panning or zooming individually. This is useful if implementing a UI where the user needs to drag map pins on a map. In this situation, it can be useful to disable panning when the user hovers a map pin and then re-enable panning once the mouse leaves the map pin.

I tried to make this API backwards compatible by adding the enable/disable methods as properties on the returned destroy function.

dy commented 4 years ago

It feels like that logic belongs to userland - this lib just provides an event with pan-zoom stats.

soulfresh commented 4 years ago

Fair point. I went this direction for efficiency but you're probably right. Since I ended up forking this project with this and other features, I'll close this PR and keep the changes in my fork.