How to use the middle mouse button to pan a map

1498
1
Jump to solution
02-13-2019 07:07 AM
by Anonymous User
Not applicable

Is there any easy way to change the default mouse button used for panning a MapView on desktop (e.g. Windows/Mac) for the mouse?

By default, clicking and dragging the left mouse button pans the map around. I have a use case where some users would prefer to use the middle mouse button (I.e. typically the mouse wheel) for this. They are used to CAD programs that do this, where clicking with the left button is reserved for drawing and selection stuff and the middle button pans around. For them, this is intuitive and much faster.

The only way I can think is to place a MouseArea over the map, capture all mouse events and somehow manually pass them through to the MapView, somehow switching out a left click for middle when panning. But I'm not really even sure how to manually cause the map to pan, except by making it zoom to a point location to follow the mouse, which I expect would be quite slow and not keep up with the mouse movement.

Any ideas? It would be great if there was a property on the MapView object that could control this perhaps?

Lucas Danzinger

1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

Hi Paul, We don't have a simple way to switch this in the API. You'd need to override everything and handle it yourself. 

View solution in original post

1 Reply
LucasDanzinger
Esri Frequent Contributor

Hi Paul, We don't have a simple way to switch this in the API. You'd need to override everything and handle it yourself.