This input value computed from coordinates is not always used. endpoint.getGeocode() overwrites it immediately.
});
endpoint.marker.on("drag dragend", function (e) {
});
endpoint.marker.on("drag dragend", function (e) {
- endpoint.setLatLng(e.target.getLatLng());
+ var latlng = e.target.getLatLng();
+
+ endpoint.setLatLng(latlng);
+ setInputValueFromLatLng(latlng);
+ endpoint.value = input.val();
dragCallback(e.type === "drag");
});
dragCallback(e.type === "drag");
});
if (latlng) {
endpoint.setLatLng(latlng);
if (latlng) {
endpoint.setLatLng(latlng);
+ setInputValueFromLatLng(latlng);
} else {
endpoint.getGeocode();
}
} else {
endpoint.getGeocode();
}
};
endpoint.setLatLng = function (ll) {
};
endpoint.setLatLng = function (ll) {
- var precision = OSM.zoomPrecision(map.getZoom());
- input.val(ll.lat.toFixed(precision) + ", " + ll.lng.toFixed(precision));
endpoint.hasGeocode = true;
endpoint.latlng = ll;
endpoint.marker
endpoint.hasGeocode = true;
endpoint.latlng = ll;
endpoint.marker
+ function setInputValueFromLatLng(latlng) {
+ var precision = OSM.zoomPrecision(map.getZoom());
+
+ input.val(latlng.lat.toFixed(precision) + ", " + latlng.lng.toFixed(precision));
+ }
+