Dynamic feature removal bug

According to wiki, when dynamically removing features we need to use:

parcel.removeFeature(f)

We can also use:

feature.remove()

which implicitly calls parcel.removeFeature() method in the implementation.

When we use this method it removes the feature, but also all the features which are positioned after it in the internal featuresList. This makes is tricky or impossible removing a single specific feature dynamically without unintentionally removing other features too. I think the issue is in the following line inside the parcel.removeFeature() implementation:

this.featuresList.splice(e)

Using splice in this way removes all features starting from index e. Fix could be specifying the number of elements to remove in the splice method, in this case only one:

this.featuresList.splice(e, 1)

ahahah good catch!

ok 8.3.4 should be fixed

1 Like