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

function _defaultShape bug #904

Open codonge opened 5 years ago

codonge commented 5 years ago

I'm reporting a bug:

old code: _defaultShape: function () { return L.Polyline._flat ? L.Polyline._flat(this._poly._latlngs) ? this._poly._latlngs : this._poly._latlngs[0] : this._poly._latlngs },

new code: _defaultShape: function () { var _latlngs = this._poly._latlngs, defaultShape = null;

                    function getdefaultShape(t) {
                        return L.LineUtil.isFlat(t) ? t : getdefaultShape(t[0]);
                    }
                    if (L.LineUtil.isFlat) {
                        defaultShape = getdefaultShape(_latlngs);
                    } else {
                        defaultShape = _latlngs;
                    }
                    return defaultShape;
    }
johnd0e commented 4 years ago

I'm reporting a bug:

Could you explain what exactly is the bug?