Press escape in the editor to stop drawing

This commit is contained in:
Markus Koch 2020-04-25 18:08:23 +02:00
parent 035eb5a992
commit 777905e7f1

View File

@ -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;