summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Koch <markus@notsyncing.net>2020-04-25 18:08:23 +0200
committerMarkus Koch <markus@notsyncing.net>2020-04-25 18:08:23 +0200
commit777905e7f1a73a6b021d4a142491cd5aa17668ae (patch)
tree8c3bc2ea6b8429a87afee2f92143ef73483fab74
parent035eb5a9920ed0507e54b6c9a3c43fab27235385 (diff)
downloadlifomapserver-777905e7f1a73a6b021d4a142491cd5aa17668ae.tar.gz
lifomapserver-777905e7f1a73a6b021d4a142491cd5aa17668ae.tar.bz2
lifomapserver-777905e7f1a73a6b021d4a142491cd5aa17668ae.zip
Press escape in the editor to stop drawing
-rw-r--r--htdocs/streeteditor.js8
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;