fix: correctly add drawn latlng when continuing line backward

Otherwise the measure if wrong.

fix #2069
This commit is contained in:
Yohan Boniface 2024-08-28 15:01:43 +02:00
parent ab8bce985e
commit ca4df94e7f

View file

@ -1260,7 +1260,11 @@ U.Editable = L.Editable.extend({
} }
} else { } else {
const tmpLatLngs = e.layer.editor._drawnLatLngs.slice() const tmpLatLngs = e.layer.editor._drawnLatLngs.slice()
tmpLatLngs.push(e.latlng) if (e.layer.editor._drawing === L.Editable.BACKWARD) {
tmpLatLngs.unshift(e.latlng)
} else {
tmpLatLngs.push(e.latlng)
}
measure = e.layer.getMeasure(tmpLatLngs) measure = e.layer.getMeasure(tmpLatLngs)
if (e.layer.editor._drawnLatLngs.length < e.layer.editor.MIN_VERTEX) { if (e.layer.editor._drawnLatLngs.length < e.layer.editor.MIN_VERTEX) {