X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/cd36a388c22abc391bcc87023be0d807eb7330ba..4b6b49801c63424b08c582d349511a6b1e05354f:/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 7fe4b4ea7..2cc3ea662 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())); setLatLng(latlng); setInputValueFromLatLng(latlng); @@ -109,11 +109,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; };