Prevent to redraw a marker when setting invalid latlng from edit form

cf #799
This commit is contained in:
Yohan Boniface 2020-11-08 16:49:23 +01:00
parent 3927a845a4
commit 3089b71705
2 changed files with 5 additions and 0 deletions

View file

@ -546,3 +546,7 @@ L.U.Orderable = L.Evented.extend({
}
});
L.LatLng.prototype.isValid = function () {
return !isNaN(this.lat) && !isNaN(this.lng);
}

View file

@ -585,6 +585,7 @@ L.U.Marker = L.Marker.extend({
];
var builder = new L.U.FormBuilder(this, coordinatesOptions, {
callback: function () {
if (!this._latlng.isValid()) return;
this._redraw();
this.bringToCenter();
},