TransWikia.com

Initialize modify interaction so it can only delete vertices, OpenLayers

Geographic Information Systems Asked on September 29, 2021

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?

One Answer

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,
    ...
});

...

Answered by mfdev on September 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP