X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/147b3f05d83e79d270a26ee03aa2ef7b231945a1..7cf9bf0e553a141acab2afea53842f97eddd0a40:/app/assets/javascripts/index/directions-endpoint.js diff --git a/app/assets/javascripts/index/directions-endpoint.js b/app/assets/javascripts/index/directions-endpoint.js index 6a3cd7c26..30d499ad7 100644 --- a/app/assets/javascripts/index/directions-endpoint.js +++ b/app/assets/javascripts/index/directions-endpoint.js @@ -34,7 +34,7 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ch }; 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; @@ -159,11 +159,5 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ch input.val(latlng.lat + ", " + latlng.lng); } - function convertLatLngToZoomPrecision(latlng) { - var precision = OSM.zoomPrecision(map.getZoom()); - - return L.latLng(latlng.lat.toFixed(precision), latlng.lng.toFixed(precision)); - } - return endpoint; };