autoPan: true
});
- endpoint.enable = function () {
+ endpoint.enableListeners = function () {
endpoint.marker.on("drag dragend", markerDragListener);
input.on("keydown", inputKeydownListener);
input.on("change", inputChangeListener);
};
- endpoint.disable = function () {
+ endpoint.disableListeners = function () {
endpoint.marker.off("drag dragend", markerDragListener);
input.off("keydown", inputKeydownListener);
input.off("change", inputChangeListener);
-
- if (endpoint.geocodeRequest) endpoint.geocodeRequest.abort();
- delete endpoint.geocodeRequest;
- removeLatLng();
- delete endpoint.value;
- input.val("");
- map.removeLayer(endpoint.marker);
};
function markerDragListener(e) {
}
};
+ endpoint.clearValue = function () {
+ if (endpoint.geocodeRequest) endpoint.geocodeRequest.abort();
+ delete endpoint.geocodeRequest;
+ removeLatLng();
+ delete endpoint.value;
+ input.val("");
+ map.removeLayer(endpoint.marker);
+ };
+
endpoint.swapCachedReverseGeocodes = function (otherEndpoint) {
const g0 = endpoint.cachedReverseGeocode;
const g1 = otherEndpoint.cachedReverseGeocode;
map.on("locationfound", sendstartinglocation);
- endpoints[0].enable();
- endpoints[1].enable();
+ endpoints[0].enableListeners();
+ endpoints[1].enableListeners();
const params = new URLSearchParams(location.search),
route = (params.get("route") || "").split(";");
$("#map").off("dragend dragover drop");
map.off("locationfound", sendstartinglocation);
- endpoints[0].disable();
- endpoints[1].disable();
+ endpoints[0].disableListeners();
+ endpoints[1].disableListeners();
+
+ endpoints[0].clearValue();
+ endpoints[1].clearValue();
map
.removeLayer(popup)