You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be beneficial to allow developers to customize the mouse button used for the dragPan interaction in MapLibre GL JS. Currently, the dragPan handler is tied to the left mouse button, with no built-in support for customizing this behavior. Adding a button option to the dragPan.enable() method or allowing configuration during map initialization would enable greater flexibility for developers.
This feature is already implemented in some other mapping libraries, making it an expected functionality for developers transitioning to MapLibre GL JS.
Proposed Solution
Introduce an optional button parameter in the dragPan.enable() method, which specifies the mouse button to trigger the drag pan interaction. For example:
Applications requiring non-standard drag interactions, such as:
Using the middle mouse button for drag panning to avoid conflicts with other left-button interactions.
Customizing drag interactions to align with user preferences or specific application requirements.
Workaround Used Now
Currently, for my temporary implementation, I'm using custom event handling. Although not perfect, performant, or native, it works (for anyone trying to implement this unofficially):
I'm trying to implement it myself, but I'm not that good with typescript so it's probably going to be a non-optimal solution.
I'll share my advancements later
Why this Feature Request?
It would be beneficial to allow developers to customize the mouse button used for the dragPan interaction in MapLibre GL JS. Currently, the dragPan handler is tied to the left mouse button, with no built-in support for customizing this behavior. Adding a button option to the dragPan.enable() method or allowing configuration during map initialization would enable greater flexibility for developers.
This feature is already implemented in some other mapping libraries, making it an expected functionality for developers transitioning to MapLibre GL JS.
Proposed Solution
Use Cases
Applications requiring non-standard drag interactions, such as:
Workaround Used Now
Currently, for my temporary implementation, I'm using custom event handling. Although not perfect, performant, or native, it works (for anyone trying to implement this unofficially):
First I created a variable for the handler:
Then I disabled the dragPan functionality after initializing the map:
Finally, I added the implementation:
Edit: added mouseout interaction and minMovement in pixels on drag to start panning the map
The text was updated successfully, but these errors were encountered: