Let's deactivate zoom and pan with the keyboard and also the rotate when doing Alt + Shift + mouse drag.
For this, do the following:
Copy the usual HTML file.
Add in the block
<div id="map" class="map"></div>
the attributetabIndex
with a value0
to make it focusable.Change the
keyboard
option tofalse
in theinteractions
property of theol.Map
object.Do all this with the
altShiftDragRotate
option. Try different actions with the left, right, up, and down arrows or with the plus and minus keys.Do all this by trying to use Alt + Shift + mouse drag.
Here you just saw an example to deactivate some default behaviors.
By changing keyboard options to false
, we make the application unable to respond to keyboard interaction with pan and zoom.
After reviewing the ol.interaction.defaults
function itself, you also learn that each map already embedded nine ol.interaction
by default, and for keyboard, the switch works for all...