1

Let's say that we added a point into to the map by using the code below:

const addInteraction = (source) => {
  draw = new ol.interaction.Draw({
    source: source,
    type: "Point",
    style: new ol.style.Style({
      fill: fillStyle,
      stroke: strokeStyle,
      image: circleStyle,
    }),
  });
  map.addInteraction(draw);
  draw.setActive(false);
  draw.on("drawend", (_event) => {
    draw.setActive(false);
  });
};

After clicking the left click this code add point into the map but I want to add an undo option or delete option for that point. Removing interaction did not work. How can I do this?

Jantoma21
  • 395
  • 4
  • 10
  • 2
    You cannot undo after the drawing has ended. As drawing a point only needs a single click the only option would be to remove the completed feature https://codesandbox.io/s/draw-features-forked-ortvr?file=/main.js – Mike Sep 08 '21 at 20:17

0 Answers0