};
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;
delete endpoint.geocodeRequest;
if (json.length === 0) {
input.addClass("is-invalid");
+ // eslint-disable-next-line no-alert
alert(I18n.t("javascripts.directions.errors.no_place", { place: endpoint.value }));
return;
}
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;
};