4

I have found this Question for capturing mouse movement on the map, but I'm not using python for this project, I use openlayers3.

I would like someone to explain to me how can I capture mouse movement on the map with openlayers3, basically map will follow users interaction whit the map. Here is a JSFIDDLE example of the map.

copser
  • 143
  • 1
  • 4

1 Answers1

7

Listen for pointermove event on map object:

map.on('pointermove', function(evt) {
    // When user was dragging map, then coordinates didn't change and there's
    // no need to continue
    if (evt.dragging) {
        return;
    }
    // You can access coordinates from evt.coordinate now
});
user1702401
  • 2,871
  • 1
  • 18
  • 17