]> git.openstreetmap.org Git - rails.git/commitdiff
Move empty value check out of endpoint.getGeocode
authorAnton Khorev <tony29@yandex.ru>
Sun, 11 Aug 2024 04:03:01 +0000 (07:03 +0300)
committerAnton Khorev <tony29@yandex.ru>
Fri, 16 Aug 2024 05:54:23 +0000 (08:54 +0300)
app/assets/javascripts/index/directions-endpoint.js

index ec09352de15f4e97c4d61ee1c64cfcef84a22641..066542707d06d91f1a3369d22642cb2d3de43d28 100644 (file)
@@ -43,18 +43,12 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ch
       setLatLng(latlng);
       setInputValueFromLatLng(latlng);
       changeCallback();
-    } else {
+    } else if (endpoint.value) {
       endpoint.getGeocode();
     }
   };
 
   endpoint.getGeocode = function () {
-    // if no one has entered a value yet, then we can't geocode, so don't
-    // even try.
-    if (!endpoint.value) {
-      return;
-    }
-
     endpoint.awaitingGeocode = true;
 
     var viewbox = map.getBounds().toBBoxString(); // <sw lon>,<sw lat>,<ne lon>,<ne lat>