]> git.openstreetmap.org Git - rails.git/commitdiff
Fix route path 'hovering' when marker positions are changed
authorJamie Guthrie <jamie.guthrie@gmail.com>
Wed, 14 Feb 2018 19:54:53 +0000 (19:54 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 15 Feb 2018 17:58:59 +0000 (17:58 +0000)
Closes #1755

app/assets/javascripts/index/directions.js

index 1ad7f9cb70c986a4d6e86ffe1a4d42746075758a..1a3e0d4ecae558056b2b9867c4ea2ea0fe4b9920 100644 (file)
@@ -54,6 +54,8 @@ OSM.Directions = function (map) {
     });
 
     input.on("change", function (e) {
+      awaitingGeocode = true;
+      
       // make text the same in both text boxes
       var value = e.target.value;
       endpoint.setValue(value);
@@ -88,12 +90,9 @@ OSM.Directions = function (map) {
           return;
         }
 
-        input.val(json[0].display_name);
+        endpoint.setLatLng(L.latLng(json[0]));
 
-        endpoint.latlng = L.latLng(json[0]);
-        endpoint.marker
-          .setLatLng(endpoint.latlng)
-          .addTo(map);
+        input.val(json[0].display_name);
 
         if (awaitingGeocode) {
           awaitingGeocode = false;