fix: do not try to render drawinTooltip on drawing start

The event does not contain latlng, so we cannot compute the
line length yet.
This commit is contained in:
Yohan Boniface 2024-05-09 13:23:34 +02:00
parent b450acf81d
commit f06461967a

View file

@ -198,7 +198,7 @@ U.ToggleEditAction = U.BaseFeatureAction.extend({
onClick: function (e) { onClick: function (e) {
if (this.feature._toggleEditing) { if (this.feature._toggleEditing) {
this.feature._toggleEditing(e) // Path this.feature._toggleEditing(e) // Path
} else { } else {
this.feature.edit(e) // Marker this.feature.edit(e) // Marker
} }
}, },
@ -1319,10 +1319,7 @@ U.ContextMenu = L.Map.ContextMenu.extend({
U.Editable = L.Editable.extend({ U.Editable = L.Editable.extend({
initialize: function (map, options) { initialize: function (map, options) {
L.Editable.prototype.initialize.call(this, map, options) L.Editable.prototype.initialize.call(this, map, options)
this.on( this.on('editable:drawing:click editable:drawing:move', this.drawingTooltip)
'editable:drawing:start editable:drawing:click editable:drawing:move',
this.drawingTooltip
)
this.on('editable:drawing:end', (e) => { this.on('editable:drawing:end', (e) => {
this.closeTooltip() this.closeTooltip()
// Leaflet.Editable will delete the drawn shape if invalid // Leaflet.Editable will delete the drawn shape if invalid