[openstreetmap/openstreetmap-website] Fixed displacing points specified from context menu (PR #4904)
Anton Khorev
notifications at github.com
Tue Aug 20 13:13:55 UTC 2024
@AntonKhorev commented on this pull request.
> - endpoint.setLatLng(L.latLng(json[0]));
+ if (endpoint.value.match(new RegExp("^" + coordinatesRegularExpression + "$"))) {
+ var latlng_array = endpoint.value.split(/[/,]/);
+ $.getJSON(OSM.NOMINATIM_URL + "reverse?lat=" + latlng_array[0] + "&lon=" + latlng_array[1] + "&format=json&viewbox=" + viewbox, function (json) {
+ endpoint.awaitingGeocode = false;
+ endpoint.hasGeocode = true;
+
+ endpoint.setLatLng(L.latLng(latlng_array), false, true);
+
+ if (!json || !json.display_name) {
+ input.addClass("is-invalid");
+ alert(I18n.t("javascripts.directions.errors.no_place", { place: endpoint.value }));
+ return;
+ }
+
+ if (endpoint.latlng.distanceTo(L.latLng(json.lat, json.lon)) > 200.0) {
I don't do this in #5064 because it's a different problem, but it probably should be solved somewhere.
What's "near" probably depends on the current zoom level if the coordinates came from a click on the map.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4904#discussion_r1723292912
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4904/review/2247962988 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20240820/ce90bfd4/attachment.htm>
More information about the rails-dev
mailing list