From ca4df94e7f1b60152016dcbfaa684a4ef9444a68 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 28 Aug 2024 15:01:43 +0200 Subject: [PATCH] fix: correctly add drawn latlng when continuing line backward Otherwise the measure if wrong. fix #2069 --- umap/static/umap/js/umap.controls.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 7ec574b3..508f5550 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -1260,7 +1260,11 @@ U.Editable = L.Editable.extend({ } } else { 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) if (e.layer.editor._drawnLatLngs.length < e.layer.editor.MIN_VERTEX) {