Add Left, Right, and Middle click pan options #420
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows users to disable panning with certain mouse buttons. At the moment, any mouse button that triggers a MouseEvent will initiate panning, but in many situations a user might want to limit that functionality to a single button, or any of a set of buttons. For instance, a common use case is that right click should not pan, or that only middle click should pan to emulate other similar desktop applications with zoom/pan/pinch interfaces.
With this PR, all three buttons (left click, right click, middle click) are enabled by default to avoid changing existing functionality. To disable specific button presses, you can add any of the following props to the TransformWrapper:
Here is an example bit of code to disable left and right click panning, and only allow middle click to initiate panning: