Make setLatLng a private function
This commit is contained in:
parent
f65593651f
commit
f1ca64ff84
1 changed files with 5 additions and 5 deletions
|
@ -17,7 +17,7 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ge
|
|||
endpoint.marker.on("drag dragend", function (e) {
|
||||
var latlng = e.target.getLatLng();
|
||||
|
||||
endpoint.setLatLng(latlng);
|
||||
setLatLng(latlng);
|
||||
setInputValueFromLatLng(latlng);
|
||||
endpoint.value = input.val();
|
||||
dragCallback(e.type === "drag");
|
||||
|
@ -40,7 +40,7 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ge
|
|||
input.val(value);
|
||||
|
||||
if (latlng) {
|
||||
endpoint.setLatLng(latlng);
|
||||
setLatLng(latlng);
|
||||
setInputValueFromLatLng(latlng);
|
||||
} else {
|
||||
endpoint.getGeocode();
|
||||
|
@ -67,7 +67,7 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ge
|
|||
return;
|
||||
}
|
||||
|
||||
endpoint.setLatLng(L.latLng(json[0]));
|
||||
setLatLng(L.latLng(json[0]));
|
||||
|
||||
input.val(json[0].display_name);
|
||||
|
||||
|
@ -75,13 +75,13 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ge
|
|||
});
|
||||
};
|
||||
|
||||
endpoint.setLatLng = function (ll) {
|
||||
function setLatLng(ll) {
|
||||
endpoint.hasGeocode = true;
|
||||
endpoint.latlng = ll;
|
||||
endpoint.marker
|
||||
.setLatLng(ll)
|
||||
.addTo(map);
|
||||
};
|
||||
}
|
||||
|
||||
function setInputValueFromLatLng(latlng) {
|
||||
var precision = OSM.zoomPrecision(map.getZoom());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue