Improve keyboard / mouse navigation API

723
0
09-25-2020 10:03 AM
Status: Open
VictorBerchet
Occasional Contributor

As of 4.16 customization keyboard / mouse navigation is quite hard.

I have tried to this on a SceneView but it also apply to a MapView.

While some customization is doable the system could be more flexible.

I have tried to use Ctrl + Drag to rotate the map while Drag only should pan the map.

I haven't found an easy way to do this.

What I ended up doing is listening to the key-down / key-up events and if the key is "Control" then call the toggle method of the navigation-toggle widget. It sorts of work but sometime the navigation would got stuck for a little while.

Then an other problem is that if I want to attach a behavior to mouse-wheel + Control (i.e. view.on('mouse-wheel', ['Control'], (e) => { ... })) then my key-down / key-up event isn't really working any more.

May be one way to solve this would be to decouple the key/mouse from the navigation and being able to map some key/mouse to a different action ?

For example I could bind Drag to a pan navigation and bind Control + Drag to a rotate navigation. It would also be nice to "unbind" any keys that are not needed.

It should also be possible to trigger an action programmatically. i.e. rotate around the map center, ...

reference: https://community.esri.com/thread/259792-customize-keyboard-navigation 

Tags (1)