Skip to content

Commit

Permalink
reverse search: click on map triggers new search
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmail committed Feb 2, 2021
1 parent 3436e82 commit a4e6c68
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/SearchBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@
set_viewbox(map);
update_reverse_link(map)
});
map.on('click', function (e) {
if (reverse_search) {
document.querySelector('input[name=lat]').value = e.latlng.lat.toFixed(5);
document.querySelector('input[name=lon]').value = e.latlng.wrap().lng.toFixed(5);
document.querySelector('form').submit();
}
});
});
function reset_viewbox() {
Expand Down

0 comments on commit a4e6c68

Please sign in to comment.