0

I want to initialize modify interaction in the way that the user can only delete vertices. I want to disable the other two functionalities which interaction offers like moving and adding new ones. Does anyone have some suggestion?

1 Answer 1

0

You can pass the altKeyOnly condition to the Modify interaction:

import { altKeyOnly } from "ol/events/condition";
import { Modify } from "ol/interaction";

const features = ...;   // get modifying features

const modify = new Modify({
    features: features,
    condition: altKeyOnly,
    ...
});

...
2
  • I am working with OpenLayers 3 geoadmin.github.io/ol3/apidoc/ol.interaction.Modify.html, there isn't condition property
    – Goran
    Commented Oct 29, 2019 at 13:04
  • It works anyway, this is how my options looks like , but now my deleteCondition is not working , { features : select.getFeatures(), deleteCondition : ol.events.condition.click, condition: ol.events.condition.altKeyOnly, }
    – Goran
    Commented Oct 29, 2019 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.