fix: properly call endEdit for markers (#2617)

fix #2607
This commit is contained in:
Yohan Boniface 2025-04-08 15:32:09 +02:00 committed by GitHub
commit 7b582a8ec1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 8 deletions

View file

@ -218,6 +218,7 @@ class Feature {
edit(event) { edit(event) {
if (!this._umap.editEnabled || this.isReadOnly()) return if (!this._umap.editEnabled || this.isReadOnly()) return
if (this._umap.editedFeature === this) return
const container = DomUtil.create('div', 'umap-feature-container') const container = DomUtil.create('div', 'umap-feature-container')
DomUtil.createTitle( DomUtil.createTitle(
container, container,
@ -326,7 +327,9 @@ class Feature {
] ]
} }
endEdit() {} endEdit() {
this.ui.disableEdit()
}
getDisplayName() { getDisplayName() {
const keys = U.LABEL_KEYS.slice() // Copy. const keys = U.LABEL_KEYS.slice() // Copy.
@ -828,11 +831,6 @@ class Path extends Feature {
) )
} }
endEdit() {
this.ui.disableEdit()
super.endEdit()
}
transferShape(at, to) { transferShape(at, to) {
const shape = this.ui.enableEdit().deleteShapeAt(at) const shape = this.ui.enableEdit().deleteShapeAt(at)
// FIXME: make Leaflet.Editable send an event instead // FIXME: make Leaflet.Editable send an event instead

View file

@ -111,7 +111,6 @@ const PointMixin = {
this.on('dragend', (event) => { this.on('dragend', (event) => {
this.isDirty = true this.isDirty = true
this.feature.edit(event) this.feature.edit(event)
// this.feature.pullGeometry(false)
}) })
if (!this.feature.isReadOnly()) this.on('mouseover', this._enableDragging) if (!this.feature.isReadOnly()) this.on('mouseover', this._enableDragging)
this.on('mouseout', this._onMouseOut) this.on('mouseout', this._onMouseOut)

View file

@ -525,7 +525,6 @@ export default class Umap {
'Ctrl+e': { 'Ctrl+e': {
if: () => this.hasEditMode(), if: () => this.hasEditMode(),
do: () => { do: () => {
console.log('doing')
if (!this.editEnabled) this.enableEdit() if (!this.editEnabled) this.enableEdit()
else if (!this.isDirty) this.disableEdit() else if (!this.isDirty) this.disableEdit()
}, },