From 4980e58db095cd8da40f0bbe7ab7ed4f7f9a38a7 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Thu, 29 Oct 2020 22:55:08 +0100 Subject: [PATCH] Add undo to draw-features example --- examples/draw-features.html | 7 ++++--- examples/draw-features.js | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/examples/draw-features.html b/examples/draw-features.html index 281d725a6a..cd43dff850 100644 --- a/examples/draw-features.html +++ b/examples/draw-features.html @@ -6,17 +6,18 @@ docs: > Example of using the Draw interaction. Select a geometry type from the dropdown above to start drawing. To finish drawing, click the last point. To activate freehand drawing for lines, polygons, and circles, hold - the `Shift` key. + the `Shift` key. To remove the last point of a line or polygon, press "Undo". tags: "draw, edit, freehand, vector" ---
- - +
diff --git a/examples/draw-features.js b/examples/draw-features.js index cefff36c35..fdac072ede 100644 --- a/examples/draw-features.js +++ b/examples/draw-features.js @@ -45,4 +45,8 @@ typeSelect.onchange = function () { addInteraction(); }; +document.getElementById('undo').addEventListener('click', function () { + draw.removeLastPoint(); +}); + addInteraction();