简体   繁体   中英

Openlayers Modify interaction

I am having trouble with the Openlayers Modify interaction.

I have some features on a map and want to be able to modify the points of some of them based on a locked key.

The following works to let me modify all features on a source:

this.modify = new ol.interaction.Modify({
  source
});

The following doesn't allow me modify any of the features, where modifiableFeaturesCollection is a collection of features:

this.modify = new ol.interaction.Modify({
  features: modifiableFeaturesCollection
});

Here is a link to a jsfiddle I have created illustrateing the problem: https://jsfiddle.net/mcneela86/jhye21pm/

For some reason, I am unsure why making the following change makes this work.

this.modify = new ol.interaction.Modify({
  features: new ol.Collection(features)
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM