diff options
Diffstat (limited to 'htdocs')
-rw-r--r-- | htdocs/streeteditor.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/htdocs/streeteditor.js b/htdocs/streeteditor.js index 4ade184..230324c 100644 --- a/htdocs/streeteditor.js +++ b/htdocs/streeteditor.js @@ -103,9 +103,17 @@ if (editor_mode) { window.addEventListener("hashchange", editor_onHashChange, false); window.addEventListener("mouseup", onDragEnd, false); // Workaround as polyline.on(dragend, ) doesn't seem to work + function onMapKeydown(e) { + if (e.originalEvent.key == "Escape") { + if (polyline) + polyline.editor.cancelDrawing(); + } + } + // Configure map for better editing mymap.setMaxZoom(14); mymap.off('click', onMapClick); + mymap.on('keydown', onMapKeydown); function get_location_string() { var latlngs; |