[GIS] `change:center` event not fired on drag animation

eventsopenlayers

I'm quite new in OpenLayers, and I want to act when the map is moved.

So simply listening to the change:center event of the map's view:

map.getView().on('change:center', function(evt){
   console.log(map.getView().getCenter());
}

But I've noticed the event is not fired after we finish the map panning with the mouse – and the map is still moving and slowing down until it stops completely.

Is there another way to know when the map extent is changed?

Best Answer

The moveend event on the Map instance should do what you need: http://openlayers.org/en/v3.4.0/apidoc/ol.MapEvent.html?unstable=true#event:moveend

Related Question