diff options
author | Markus Koch <markus@notsyncing.net> | 2020-04-19 17:00:01 +0200 |
---|---|---|
committer | Markus Koch <markus@notsyncing.net> | 2020-04-19 17:00:01 +0200 |
commit | 8d5fc922d17b8ce9be42382ae4e12668bd348c01 (patch) | |
tree | 6039406807446a9de53400d50b465d880154705a /htdocs | |
parent | 2e790adc903f55294cfde30f576a62e756acbcae (diff) | |
download | lifomapserver-8d5fc922d17b8ce9be42382ae4e12668bd348c01.tar.gz lifomapserver-8d5fc922d17b8ce9be42382ae4e12668bd348c01.tar.bz2 lifomapserver-8d5fc922d17b8ce9be42382ae4e12668bd348c01.zip |
Fix goto function in editor mode
Diffstat (limited to 'htdocs')
-rw-r--r-- | htdocs/mapscript.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js index 14dde51..b22cfd1 100644 --- a/htdocs/mapscript.js +++ b/htdocs/mapscript.js @@ -196,8 +196,12 @@ function jump_to_marker(e) { function prompt_location() { var str = prompt("Enter coordinates to jump to:\n\n" + "Format: x, y [, zoom]", get_current_location_str()); - if (str) - document.location.hash = "#" + str; + if (str) { + if (!editor_mode) + document.location.hash = "#" + str; + else + onHashChange(null, "#" + str); + } } var search_element; @@ -334,10 +338,12 @@ mymap.on('moveend', update_hash_from_position); mymap.on('dragstart', function () { is_user_drag = 1;}); mymap.on('keydown', function (e) { if (e.originalEvent.code.match(/Arrow.*/)) is_user_drag = 1;}); -function onHashChange(e) { - if (document.location.hash == "#" + get_current_location_str()) +function onHashChange(e, hash=null) { + if (!hash) + hash = document.location.hash; + if (hash == "#" + get_current_location_str()) return; // We're already there - coordstr = window.location.hash.slice(1).replace(/%20/g, "").split(","); + coordstr = hash.slice(1).replace(/%20/g, "").split(","); if (coordstr.length < 2) coordstr.push(0); // Default y if (coordstr.length < 3) |