Associate search input with route destination instead of departure

This commit is contained in:
Marwin Hochfelsner 2025-02-14 10:36:27 +01:00
parent 79f5ccca31
commit e6b0e1ae7e
2 changed files with 3 additions and 3 deletions

View file

@ -73,8 +73,8 @@ OSM.Directions = function (map) {
$(".directions_form .btn-close").on("click", function (e) {
e.preventDefault();
$(".describe_location").toggle(!endpoints[0].value);
$(".search_form input[name='query']").val(endpoints[0].value);
$(".describe_location").toggle(!endpoints[1].value);
$(".search_form input[name='query']").val(endpoints[1].value);
OSM.router.route("/" + OSM.formatHash(map));
});

View file

@ -11,7 +11,7 @@ OSM.Search = function (map) {
e.preventDefault();
const query = $(this).closest("form").find("input[name=query]").val();
let search = "";
if (query) search = "?" + new URLSearchParams({ from: query });
if (query) search = "?" + new URLSearchParams({ to: query });
OSM.router.route("/directions" + search + OSM.formatHash(map));
});