Openlayers 4: mouse click to draw a point, make mouse click on the screen and drag the map

0
Hello, I'm studying the development of a map with the help of Openlayers 4, watching video lessons, I'm at the stage where I created a routine with 3 buttons (Pan, Draw, Erase) to draw on the map. However, when I click the Draw button, to create a Point-type feature instead of the click, the cursor sticks to the map, as if I had double-clicked to start Drag-and-drop. But I just clicked, wanting to put the point there. Does anyone know why this is happening?

    
asked by anonymous 02.01.2018 / 20:36

1 answer

0

Look, I got the solution! It's just that I was looking at a code in a tutorial that used only ol.interaction.Draw, with the event name varDraw.on ('drawend', function (e) {... etc. Well, in the official Openlayers.org documentation, has an example that satisfied my search, where the Snap method is used: var snap = new ol.interaction.Snap ({source: source}), and then the map.addInteraction (snap) command is applied again. And it looks like this is more current for version 4. It works cool now. Thanks to anyone who's interested.

    
02.01.2018 / 23:21