mirror of
https://github.com/umap-project/umap.git
synced 2025-04-28 19:42:36 +02:00
fix: do not try to remove a feature not yet added (#2637)
cf #2625 This happens while drawing a line or polygon and then hitting escape while the path is not yet valid.
This commit is contained in:
commit
bd91934544
1 changed files with 4 additions and 0 deletions
|
@ -418,6 +418,10 @@ export class DataLayer {
|
|||
|
||||
removeFeature(feature, sync) {
|
||||
const id = stamp(feature)
|
||||
// This feature was not yet added, may be after
|
||||
// hitting Escape while drawing a new line or
|
||||
// polygon, not yet valid (not enough points)
|
||||
if (!this._index.includes(id)) return
|
||||
if (sync !== false) {
|
||||
const oldValue = feature.toGeoJSON()
|
||||
feature.sync.delete(oldValue)
|
||||
|
|
Loading…
Reference in a new issue