OpenLayers line drawing issue

22 Views Asked by At

In OpenLayers, how can I finish drawing a line with a single click instead of the default behavior of ending the drawing with a double click?

drawInteraction.on('drawstart', function(event) { let feature = event.feature;

     openLayersMap!.once('click', function() {
       // 这里可以添加结束绘制时的逻辑,比如将绘制的线条保存到某个地方
       drawInteraction!.finishDrawing(); // 结束绘制
     });
   });
0

There are 0 best solutions below