From 814c681e60d4ce248d1d302c7bd6c6959bb0ec9e Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Wed, 24 May 2017 14:37:34 +0200 Subject: [PATCH] refs #16 cancel deletion or edition when loading or clearing the map, this avoids data losses --- js/gpxedit.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/gpxedit.js b/js/gpxedit.js index cf3a2fb..ff4ff3f 100644 --- a/js/gpxedit.js +++ b/js/gpxedit.js @@ -1430,9 +1430,17 @@ }); $('button#clearButton').click(function(e) { + var cancelButton = $('.leaflet-draw .leaflet-draw-section:nth-child(2) li:nth-child(2) a'); + if (cancelButton.is(':visible')) { + cancelButton[0].click(); + } clear(); }); $('button#loadButton').click(function(e) { + var cancelButton = $('.leaflet-draw .leaflet-draw-section:nth-child(2) li:nth-child(2) a'); + if (cancelButton.is(':visible')) { + cancelButton[0].click(); + } if (gpxedit.currentAjax !== null) { gpxedit.currentAjax.abort(); hideLoadingAnimation();