mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
fix: always unset editedFeature on editPanel close
And only this panel. This was creating a weird bug, steps to reproduce: - create a marker - shift-click on the marker to edit the layer (so without explicitly closing the panel) - try to type the layer name: the panel would close This is also because currently the schema and render() are too dump, and when any `name` is changed then the `data` reflow is called, while it should not when editing the datalayer name. We want to: - have more targeted schema - have more specific reflow in render But that's for other PRs!
This commit is contained in:
parent
023f48ee94
commit
71b55e7759
2 changed files with 15 additions and 2 deletions
|
@ -32,8 +32,10 @@ const FeatureMixin = {
|
||||||
if (map.editedFeature === this.feature) {
|
if (map.editedFeature === this.feature) {
|
||||||
this.feature._marked_for_deletion = true
|
this.feature._marked_for_deletion = true
|
||||||
this.feature.endEdit()
|
this.feature.endEdit()
|
||||||
|
if (map.editedFeature === this.feature) {
|
||||||
map.editPanel.close()
|
map.editPanel.close()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_removeIcon: function () {
|
_removeIcon: function () {
|
||||||
|
|
|
@ -25,6 +25,9 @@ export class Panel {
|
||||||
}
|
}
|
||||||
|
|
||||||
open({ content, className, actions = [] } = {}) {
|
open({ content, className, actions = [] } = {}) {
|
||||||
|
if (this.isOpen()) {
|
||||||
|
this.onClose()
|
||||||
|
}
|
||||||
this.container.className = `with-transition panel window ${this.className} ${
|
this.container.className = `with-transition panel window ${this.className} ${
|
||||||
this.mode || ''
|
this.mode || ''
|
||||||
}`
|
}`
|
||||||
|
@ -71,10 +74,13 @@ export class Panel {
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
document.body.classList.remove(`panel-${this.className.split(' ')[0]}-on`)
|
document.body.classList.remove(`panel-${this.className.split(' ')[0]}-on`)
|
||||||
|
this.onClose()
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose() {
|
||||||
if (DomUtil.hasClass(this.container, 'on')) {
|
if (DomUtil.hasClass(this.container, 'on')) {
|
||||||
DomUtil.removeClass(this.container, 'on')
|
DomUtil.removeClass(this.container, 'on')
|
||||||
this.map.invalidateSize({ pan: false })
|
this.map.invalidateSize({ pan: false })
|
||||||
this.map.editedFeature = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,6 +90,11 @@ export class EditPanel extends Panel {
|
||||||
super(map)
|
super(map)
|
||||||
this.className = 'right dark'
|
this.className = 'right dark'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onClose() {
|
||||||
|
super.onClose()
|
||||||
|
this.map.editedFeature = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FullPanel extends Panel {
|
export class FullPanel extends Panel {
|
||||||
|
|
Loading…
Reference in a new issue