Leaflet / Leaflet.draw

Vector drawing and editing plugin for Leaflet
https://leaflet.github.io/Leaflet.draw/docs/leaflet-draw-latest.html
MIT License
1.98k stars 994 forks source link

Error of the line creating possibility consisting of one point #1019

Open dmmishchenko opened 3 years ago

dmmishchenko commented 3 years ago

How to reproduce

Steps:

I found this at line 233:

_shapeIsValid: function () {
    return true;
},

I think there must be something like this:

_shapeIsValid(): boolean {
    return this._markers.length >= 2;
},

we also need to add handling for this error, since the current error message is not valid

What behaviour I'm expecting and which behaviour I'm seeing

Minimal example reproducing the issue

Demo: https://jsfiddle.net/dmmishchenko/gmnk1a0f/10/