I
I
Ilya Alekseev2016-08-12 20:09:47
JavaScript
Ilya Alekseev, 2016-08-12 20:09:47

How to hide the line that we are currently drawing in openlayers?

There is an initial line drawing addition

var vectorSource = new ol.source.Vector();
      var vectorLayer = new ol.layer.Vector({ source: vectorSource });
      var drawLine = new ol.interaction.Draw({
         source: vectorSource,
         type: 'LineString'
      });
      map.addLayer(vectorLayer);


it is necessary when we hover over the element to hide the line that moves with the mouse, and when we remove the mouse from the element back, return the line to the mouse

$(".elem").hover(function(){
//скрыть линию
},
 function(){
//вернуть линию к мышке
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Moskus, 2016-08-12
@Moskus

Change the strokeOpacity of the line. When you want to hide - put "0", and when to show - "1".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question