From d257e678429a84c6759f8d64566a91a2f61bfca8 Mon Sep 17 00:00:00 2001 From: Tucker Chapman Date: Sat, 16 Jan 2021 18:00:57 -0500 Subject: [PATCH] Remove conditional for polyline layer When a user searches for a route and one is not found the polyline layer is removed - if they then change the mode of transportation the event listener will not reroute if there is no polyline layer. This commit removes the conditional that prevents the routing code from re-running after the polyline has been removed. Fixes #3050 Closes #3055 --- app/assets/javascripts/index/directions.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 6efde27c6..ee44ad4c4 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -335,9 +335,7 @@ OSM.Directions = function (map) { select.on("change", function (e) { chosenEngine = engines[e.target.selectedIndex]; $.cookie("_osm_directions_engine", chosenEngine.id, { expires: expiry, path: "/" }); - if (map.hasLayer(polyline)) { - getRoute(true, true); - } + getRoute(true, true); }); $(".directions_form").on("submit", function (e) { -- 2.43.2