From: Tom Hughes Date: Sun, 2 Feb 2025 12:44:27 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/5064' X-Git-Tag: live~205 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/8f7f02b025f59db466fdb22ea3686cb6c5adc400?ds=sidebyside;hp=--cc Merge remote-tracking branch 'upstream/pull/5064' --- 8f7f02b025f59db466fdb22ea3686cb6c5adc400 diff --cc app/assets/javascripts/index/directions-endpoint.js index 2cc3ea662,6a3cd7c26..30d499ad7 --- a/app/assets/javascripts/index/directions-endpoint.js +++ b/app/assets/javascripts/index/directions-endpoint.js @@@ -34,8 -34,11 +34,11 @@@ OSM.DirectionsEndpoint = function Endpo }; function markerDragListener(e) { - var latlng = convertLatLngToZoomPrecision(e.target.getLatLng()); + const latlng = L.latLng(OSM.cropLocation(e.target.getLatLng(), map.getZoom())); + if (endpoint.geocodeRequest) endpoint.geocodeRequest.abort(); + delete endpoint.geocodeRequest; + setLatLng(latlng); setInputValueFromLatLng(latlng); endpoint.value = input.val(); diff --cc app/assets/javascripts/index/directions.js index 4eb0e09f4,df5677105..0847318cf --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@@ -281,8 -284,9 +280,8 @@@ OSM.Directions = function (map) var pt = L.DomEvent.getMousePosition(oe, map.getContainer()); // co-ordinates of the mouse pointer at present pt.y += 20; var ll = map.containerPointToLatLng(pt); - var precision = OSM.zoomPrecision(map.getZoom()); - var value = ll.lat.toFixed(precision) + ", " + ll.lng.toFixed(precision); - endpoints[type === "from" ? 0 : 1].setValue(value); + const llWithPrecision = OSM.cropLocation(ll, map.getZoom()); - endpoints[type === "from" ? 0 : 1].setValue(llWithPrecision.join(", "), llWithPrecision); ++ endpoints[type === "from" ? 0 : 1].setValue(llWithPrecision.join(", ")); }); endpoints[0].enable();