Thursday, 15 September 2011

How to disable DragPan in OpenLayers 3? -


How to disable DropPoint interactions in OpenLayers 3 (when the map is already defined)?

Besides, why am I unable to use the mousemove event?
I am doing this: map.on ('mousemove', function (e) {...}); And it does not work.

To disable the contact, you delete it from the map . If you do not have a reference to your conversation, then you can find it using the getInteractions map method:

  var dragpan; Map.getInteractions () Each (function (interaction) {if (Interaction Install ol.interaction.DragPan) {dragPan = interaction;}}, this); If (dragpan) {map.removeInteraction (dragpan); }  

For the mouse movement, use an appropriate event to use the ' Pointermove ', see an example usage here:

Know that you can configure the interaction you want to create and add to your map by default. For example, if you want to create a map without the droppane interaction, you can do this:

  var map = new ol.Map ({layers: layers, interactions: ol Interaction. Defaults ({dragpan: false}), see: new ol.View ({center: [0, 0], zoom: 2})}); See a list of all possible options for  

ol.interaction.defaults .


No comments:

Post a Comment