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
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:
parent
dc35e7df6d
commit
581140e08a
1 changed files with 4 additions and 0 deletions
|
@ -418,6 +418,10 @@ export class DataLayer {
|
||||||
|
|
||||||
removeFeature(feature, sync) {
|
removeFeature(feature, sync) {
|
||||||
const id = stamp(feature)
|
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) {
|
if (sync !== false) {
|
||||||
const oldValue = feature.toGeoJSON()
|
const oldValue = feature.toGeoJSON()
|
||||||
feature.sync.delete(oldValue)
|
feature.sync.delete(oldValue)
|
||||||
|
|
Loading…
Reference in a new issue