From f06461967adc5a2005e4f83a67eca8222fe97601 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 9 May 2024 13:23:34 +0200 Subject: [PATCH] fix: do not try to render drawinTooltip on drawing start The event does not contain latlng, so we cannot compute the line length yet. --- umap/static/umap/js/umap.controls.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 1ec336f2..a2e2a9db 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -198,7 +198,7 @@ U.ToggleEditAction = U.BaseFeatureAction.extend({ onClick: function (e) { if (this.feature._toggleEditing) { this.feature._toggleEditing(e) // Path - } else { + } else { this.feature.edit(e) // Marker } }, @@ -1319,10 +1319,7 @@ U.ContextMenu = L.Map.ContextMenu.extend({ U.Editable = L.Editable.extend({ initialize: function (map, options) { L.Editable.prototype.initialize.call(this, map, options) - this.on( - 'editable:drawing:start editable:drawing:click editable:drawing:move', - this.drawingTooltip - ) + this.on('editable:drawing:click editable:drawing:move', this.drawingTooltip) this.on('editable:drawing:end', (e) => { this.closeTooltip() // Leaflet.Editable will delete the drawn shape if invalid