From 3f12b69c25392bff5e086212e181e59e6af3d45f Mon Sep 17 00:00:00 2001 From: Philip Beelmann Date: Tue, 25 Apr 2023 11:11:00 +0000 Subject: [PATCH] extend getMeasure by argument extraPoint --- umap/static/umap/js/umap.features.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index b6df7a41..8934ed85 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -1012,8 +1012,17 @@ L.U.Polygon = L.Polygon.extend({ return options.concat(L.U.FeatureMixin.getInteractionOptions()); }, - getMeasure: function () { - var area = L.GeoUtil.geodesicArea(this._defaultShape()); + getMeasure: function (extraPoint) { + var polygon; + if (extraPoint){ + var tmpLatLngs = this.editor._drawnLatLngs.slice(); + tmpLatLngs.push(extraPoint); + polygon = tmpLatLngs; + } else { + polygon = this._defaultShape(); + } + + var area = L.GeoUtil.geodesicArea(polygon); return L.GeoUtil.readableArea(area, this.map.measureTools.getMeasureUnit()); },