Customize keyboard navigation ?

240
1
09-10-2020 07:40 AM
VictorBerchet
New Contributor III

The key bindings used for navigation with the JS API are specific to ArcGIS.

It seems like most other platform (Google Earth, Google Maps, Cesium, ...) use Shift + Left click to rotate the view around the camera center. The only way to do that with the JS API is right click + drag at least when the device has no touch screen.

Rotating becomes a pain when you only have a touchpad.

It would be super nice to be able to override the key bindings to add custom ones.

Is there any plan ? 

Thanks for this great API.

Tags (2)
0 Kudos
1 Reply
VictorBerchet
New Contributor III

For now I have solved my problem using the following code:

const toggle = view.ui.find('navigation-toggle') as NavigationToggle;

view.on('key-down', (e) => {
if (e.key == 'Control' && !e.repeat) {
toggle.toggle();
}
});

view.on('key-up', (e) => {
if (e.key == 'Control') {
toggle.toggle();
}
});
0 Kudos