diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 28c7b288..b8461ef2 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -1261,16 +1261,11 @@ U.Editable = L.Editable.extend({ this.on('editable:drawing:cancel', (e) => { console.log('editable:drawing:cancel') if (e.layer instanceof U.Marker) e.layer.del() - else { - // the user might just exit with escape - e.layer.onCommit() - } }) this.on('editable:drawing:commit', function (e) { console.log('editable:drawing:commit') e.layer.isDirty = true if (this.map.editedFeature !== e.layer) e.layer.edit(e) - e.layer.onCommit() }) this.on('editable:editing', (e) => { console.log('editable:editing') diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index a7329c03..e8834a2a 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -652,6 +652,7 @@ U.Marker = L.Marker.extend({ }, this ) + this.on('editable:drawing:end', this.onCommit) if (!this.isReadOnly()) this.on('mouseover', this._enableDragging) this.on('mouseout', this._onMouseOut) this._popupHandlersAdded = true // prevent Leaflet from binding event on bindPopup @@ -933,6 +934,7 @@ U.PathMixin = { addInteractions: function () { U.FeatureMixin.addInteractions.call(this) + this.on('editable:disable', this.onCommit) this.on('mouseover', this._onMouseOver) this.on('edit', this.makeDirty) this.on('drag editable:drag', this._onDrag) @@ -942,7 +944,6 @@ U.PathMixin = { _onDrag: function () { if (this._tooltip) this._tooltip.setLatLng(this.getCenter()) - this.syncUpdatedProperties(['latlng']) }, transferShape: function (at, to) {