To disable interaction, you need to remove it from the card . If you don’t have a link to your interaction, you can find it using the getInteractions map getInteractions :
var dragPan; map.getInteractions().forEach(function(interaction) { if (interaction instanceof ol.interaction.DragPan) { dragPan = interaction; } }, this); if (dragPan) { map.removeInteraction(dragPan); }
For the mouse move event, the correct event to use is pointermove ', see the usage example here: http://openlayers.org/en/v3.3.0/examples/icon.html
Know that you can customize the interactions you want to create and add by default to your map. If, for example, you wanted to create a map without interacting with dragPan, you can do it as follows:
var map = new ol.Map({ layers: layers, interactions: ol.interaction.defaults({ dragPan: false }), view: new ol.View({ center: [0, 0], zoom: 2 }) });
See here for a list of all the possible ol.interaction.defaults options.
Alexandre Dubé
source share