X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b8b9c3d1e9e412178426e9ba1b612e14e09f2320..96a12196bfc234af10b6cbda305f2bb9b48a07ee:/app/assets/javascripts/index/directions-endpoint.js diff --git a/app/assets/javascripts/index/directions-endpoint.js b/app/assets/javascripts/index/directions-endpoint.js index 0b52d3d4c..e3f6afa46 100644 --- a/app/assets/javascripts/index/directions-endpoint.js +++ b/app/assets/javascripts/index/directions-endpoint.js @@ -14,23 +14,16 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ch 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) { @@ -91,6 +84,15 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ch } }; + 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;