};
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();
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();