src/leaflet-measure.js
function(evt) {
    const latlng = this._map.mouseEventToLatLng(evt.originalEvent), // get actual latlng instead of the marker's latlng from originalEvent
      lastClick = this._latlngs[this._latlngs.length - 1],
      vertexSymbol = this._symbols.getSymbol('measureVertex');

    if (!lastClick || !latlng.equals(lastClick)) {
      // skip if same point as last click, happens on `dblclick`
      this._latlngs.push(latlng);
      this._addMeasureArea(this._latlngs);
      this._addMeasureBoundary(this._latlngs);

      this._measureVertexes.eachLayer(function(layer) {
        layer.setStyle(vertexSymbol);
        // reset all vertexes to non-active class - only last vertex is active
        // `layer.setStyle({ className: 'layer-measurevertex'})` doesn't work. https://github.com/leaflet/leaflet/issues/2662
        // set attribute on path directly
        if (layer._path) {
          layer._path.setAttribute('class', vertexSymbol.className);
        }
      });

      this._addNewVertex(latlng);

      if (this._measureBoundary) {
        this._measureBoundary.bringToFront();
      }
      this._measureVertexes.bringToFront();
    }

    this._updateResults();
    this._updateMeasureStartedWithPoints();
  }
function(evt) {
    const latlng = this._map.mouseEventToLatLng(evt.originalEvent), // get actual latlng instead of the marker's latlng from originalEvent
      lastClick = this._latlngs[this._latlngs.length - 1],
      vertexSymbol = this._symbols.getSymbol('measureVertex');

    if (!lastClick || !latlng.equals(lastClick)) {
      // skip if same point as last click, happens on `dblclick`
      this._latlngs.push(latlng);
      this._addMeasureArea(this._latlngs);
      this._addMeasureBoundary(this._latlngs);

      this._measureVertexes.eachLayer(function(layer) {
        layer.setStyle(vertexSymbol);
        // reset all vertexes to non-active class - only last vertex is active
        // `layer.setStyle({ className: 'layer-measurevertex'})` doesn't work. https://github.com/leaflet/leaflet/issues/2662
        // set attribute on path directly
        if (layer._path) {
          layer._path.setAttribute('class', vertexSymbol.className);
        }
      });

      this._addNewVertex(latlng);

      if (this._measureBoundary) {
        this._measureBoundary.bringToFront();
      }
      this._measureVertexes.bringToFront();
    }

    this._updateResults();
    this._updateMeasureStartedWithPoints();
  }
function ( evt ) { const latlng = this . _map . mouseEventToLatLng ( evt . originalEvent ) , // get actual latlng instead of the marker's latlng from originalEvent lastClick = this . _latlngs [ this . _latlngs . length - 1 ] , vertexSymbol = this . _symbols . getSymbol ( 'measureVertex' ) ; if ( ! lastClick || ! latlng . equals ( lastClick ) ) { // skip if same point as last click, happens on `dblclick` this . _latlngs . push ( latlng ) ; this . _addMeasureArea ( this . _latlngs ) ; this . _addMeasureBoundary ( this . _latlngs ) ; this . _measureVertexes . eachLayer ( function ( layer ) { layer . setStyle ( vertexSymbol ) ; // reset all vertexes to non-active class - only last vertex is active // `layer.setStyle({ className: 'layer-measurevertex'})` doesn't work. https://github.com/leaflet/leaflet/issues/2662 // set attribute on path directly if ( layer . _path ) { layer . _path . setAttribute ( 'class' , vertexSymbol . className ) ; } } ) ; this . _addNewVertex ( latlng ) ; if ( this . _measureBoundary ) { this . _measureBoundary . bringToFront ( ) ; } this . _measureVertexes . bringToFront ( ) ; } this . _updateResults ( ) ; this . _updateMeasureStartedWithPoints ( ) ; }
handle map click during ongoing measurement add new clicked point, update measure layers and results ui
handle map click during ongoing measurement add new clicked point update measure layers and results ui