react-map-interaction icon indicating copy to clipboard operation
react-map-interaction copied to clipboard

Add options to disable mouse wheel zoom and single touch panning

Open thejsn opened this issue 5 years ago • 1 comments

Hello, This PR adds two new options: disableMouseWheelZoom and disableSingleTouchPan. The purpose of these options are to allow a user to scroll past a react-map-interaction instance more easily, without disabling more functionality than necessary.

These options are different than the existing disableZoom and disablePan options in the following ways:

  • disableMouseWheelZoom will still allow zooming with the control buttons or two fingers on a touch device.
  • disableSingleTouchPan still allows panning with the mouse or with two fingers on a touch device.

I also took the liberty to rewrite the example page to make it a bit easier to test the different options.

thejsn avatar Mar 07 '20 08:03 thejsn

Thanks for the PR. I'll need to see how this behaves locally, first. We may want to consider a better way of handling all of these options before tacking on two more. The code is starting to be full of these checks in various places which makes the core logic harder to grasp.

Also, I'd prefer to add tests, linting, coverage, etc. before adding more features (and possible regressions). I'll be working on that shortly. With more people using the lib, and the subtle bugs that can pop up with touch/drag support, I'd like to have strong test coverage before making addtions.

scottyantipa avatar Mar 07 '20 20:03 scottyantipa