code: function (potentialLatLng) {
  		var lastPtDistance;
  		if (this._markers.length > 0) {
  			var finishMarker;
  			if (this.type === L.Draw.Polyline.TYPE) {
  				finishMarker = this._markers[this._markers.length - 1];
  			} else if (this.type === L.Draw.Polygon.TYPE) {
  				finishMarker = this._markers[0];
  			} else {
  				return Infinity;
  			}
  			var lastMarkerPoint = this._map.latLngToContainerPoint(finishMarker.getLatLng()),
  				potentialMarker = new L.Marker(potentialLatLng, {
  					icon: this.options.icon,
  					zIndexOffset: this.options.zIndexOffset * 2
  				});
  			var potentialMarkerPint = this._map.latLngToContainerPoint(potentialMarker.getLatLng());
  			lastPtDistance = lastMarkerPoint.distanceTo(potentialMarkerPint);
  		} else {
  			lastPtDistance = Infinity;
  		}
  		return lastPtDistance;
  	}
docs: calculate if we are currently within close enough distance of the closing point (first point for shapes, last point for lines) this is semi-ugly code but the only reliable way i found to get the job done note: calculating point.distanceTo between mouseDownOrigin and last marker did NOT work