mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
wip: only display visible vertexmarker and do not display if too much
This should improve the edit experience with huge geometries. So one can still edit the properties event if the path is big, and should zoom in to allow the geometry to be editable.
This commit is contained in:
parent
64d63ff6cc
commit
76c3f87f67
2 changed files with 17 additions and 2 deletions
|
@ -680,8 +680,8 @@ class Path extends Feature {
|
||||||
|
|
||||||
edit(event) {
|
edit(event) {
|
||||||
if (this.map.editEnabled) {
|
if (this.map.editEnabled) {
|
||||||
if (!this.ui.editEnabled()) this.ui.enableEdit()
|
|
||||||
super.edit(event)
|
super.edit(event)
|
||||||
|
if (!this.ui.editEnabled()) this.ui.makeGeometryEditable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,6 +281,21 @@ const PathMixin = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
makeGeometryEditable: function () {
|
||||||
|
if (this._map.editedFeature !== this.feature) {
|
||||||
|
this.disableEdit()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this._map.once('moveend', this.makeGeometryEditable, this)
|
||||||
|
const pointsCount = this._parts.reduce((acc, part) => acc + part.length, 0)
|
||||||
|
if (pointsCount > 100 && this._map.getZoom() < this._map.getMaxZoom()) {
|
||||||
|
this._map.tooltip.open({ content: L._('Please zoom in to edit the geometry') })
|
||||||
|
this.disableEdit()
|
||||||
|
} else {
|
||||||
|
this.enableEdit()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
addInteractions: function () {
|
addInteractions: function () {
|
||||||
FeatureMixin.addInteractions.call(this)
|
FeatureMixin.addInteractions.call(this)
|
||||||
this.on('editable:disable', this.onCommit)
|
this.on('editable:disable', this.onCommit)
|
||||||
|
@ -376,7 +391,7 @@ const PathMixin = {
|
||||||
getContextMenuEditItems: function (event) {
|
getContextMenuEditItems: function (event) {
|
||||||
const items = FeatureMixin.getContextMenuEditItems.call(this, event)
|
const items = FeatureMixin.getContextMenuEditItems.call(this, event)
|
||||||
if (
|
if (
|
||||||
this._map?.editedFeature !== this &&
|
this._map?.editedFeature !== this.feature &&
|
||||||
this.feature.isSameClass(this._map.editedFeature)
|
this.feature.isSameClass(this._map.editedFeature)
|
||||||
) {
|
) {
|
||||||
items.push({
|
items.push({
|
||||||
|
|
Loading…
Reference in a new issue