Compare commits
No commits in common. "b58a02bf4a15bbb0ec18cbd1ea92094d63ffaf02" and "2e790adc903f55294cfde30f576a62e756acbcae" have entirely different histories.
b58a02bf4a
...
2e790adc90
@ -196,12 +196,8 @@ function jump_to_marker(e) {
|
|||||||
function prompt_location() {
|
function prompt_location() {
|
||||||
var str = prompt("Enter coordinates to jump to:\n\n" +
|
var str = prompt("Enter coordinates to jump to:\n\n" +
|
||||||
"Format: x, y [, zoom]", get_current_location_str());
|
"Format: x, y [, zoom]", get_current_location_str());
|
||||||
if (str) {
|
if (str)
|
||||||
if (!editor_mode)
|
document.location.hash = "#" + str;
|
||||||
document.location.hash = "#" + str;
|
|
||||||
else
|
|
||||||
onHashChange(null, "#" + str);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var search_element;
|
var search_element;
|
||||||
@ -338,17 +334,15 @@ mymap.on('moveend', update_hash_from_position);
|
|||||||
mymap.on('dragstart', function () { is_user_drag = 1;});
|
mymap.on('dragstart', function () { is_user_drag = 1;});
|
||||||
mymap.on('keydown', function (e) { if (e.originalEvent.code.match(/Arrow.*/)) is_user_drag = 1;});
|
mymap.on('keydown', function (e) { if (e.originalEvent.code.match(/Arrow.*/)) is_user_drag = 1;});
|
||||||
|
|
||||||
function onHashChange(e, hash=null) {
|
function onHashChange(e) {
|
||||||
if (!hash)
|
if (document.location.hash == "#" + get_current_location_str())
|
||||||
hash = document.location.hash;
|
|
||||||
if (hash == "#" + get_current_location_str())
|
|
||||||
return; // We're already there
|
return; // We're already there
|
||||||
coordstr = hash.slice(1).replace(/%20/g, "").split(",");
|
coordstr = window.location.hash.slice(1).replace(/%20/g, "").split(",");
|
||||||
if (coordstr.length < 2)
|
if (coordstr.length < 2)
|
||||||
coordstr.push(0); // Default y
|
coordstr.push(0); // Default y
|
||||||
if (coordstr.length < 3)
|
if (coordstr.length < 3)
|
||||||
coordstr.push(mymap.getZoom()); // Default zoom
|
coordstr.push(mymap.getZoom()); // Default zoom
|
||||||
var latlng = L.latLng(parseFloat(coordstr[1]), parseFloat(coordstr[0]));
|
var latlng = L.latLng(parseFloat(coordstr[0]), parseFloat(coordstr[1]));
|
||||||
mymap.setView(latlng, parseInt(coordstr[2]));
|
mymap.setView(latlng, parseInt(coordstr[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user