summaryrefslogtreecommitdiff
path: root/htdocs/streeteditor.js
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/streeteditor.js')
-rw-r--r--htdocs/streeteditor.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/htdocs/streeteditor.js b/htdocs/streeteditor.js
index 7109b0e..8b86a4a 100644
--- a/htdocs/streeteditor.js
+++ b/htdocs/streeteditor.js
@@ -1,6 +1,7 @@
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
-if (urlParams.has('editor')) {
+editor_mode = urlParams.has('editor');
+if (editor_mode) {
var draw_layer;
var polyline;
@@ -60,22 +61,23 @@ if (urlParams.has('editor')) {
}
}
- function onHashChange() {
+ function editor_onHashChange() {
if (("#" + get_location_string()) != window.location.hash) {
polyline.remove(mymap);
onLoad(0);
}
}
- window.addEventListener("hashchange", onHashChange, false);
+ window.removeEventListener("hashchange", onHashChange, false);
+ window.addEventListener("hashchange", editor_onHashChange, false);
window.addEventListener("mouseup", onDragEnd, false); // Workaround as polyline.on(dragend, ) doesn't seem to work
// Configure map for better editing
document.getElementById('mapid').classList.add("no-aa");
mymap.setMaxZoom(14);
mymap.off('click', onMapClick);
- //mymap.setOpacity(0.7);
-
+ mymap.off('zoomend', update_hash_from_position);
+ mymap.off('dragend', update_hash_from_position);
onLoad();
function get_location_string() {