Press escape in the editor to stop drawing
This commit is contained in:
parent
035eb5a992
commit
777905e7f1
@ -103,9 +103,17 @@ if (editor_mode) {
|
|||||||
window.addEventListener("hashchange", editor_onHashChange, false);
|
window.addEventListener("hashchange", editor_onHashChange, false);
|
||||||
window.addEventListener("mouseup", onDragEnd, false); // Workaround as polyline.on(dragend, ) doesn't seem to work
|
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
|
// Configure map for better editing
|
||||||
mymap.setMaxZoom(14);
|
mymap.setMaxZoom(14);
|
||||||
mymap.off('click', onMapClick);
|
mymap.off('click', onMapClick);
|
||||||
|
mymap.on('keydown', onMapKeydown);
|
||||||
|
|
||||||
function get_location_string() {
|
function get_location_string() {
|
||||||
var latlngs;
|
var latlngs;
|
||||||
|
Loading…
Reference in New Issue
Block a user