From: Tucker Chapman Date: Sat, 16 Jan 2021 23:00:57 +0000 (-0500) Subject: Remove conditional for polyline layer X-Git-Tag: live~1842 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/d257e678429a84c6759f8d64566a91a2f61bfca8?hp=810e4da85ab65100d1d4d7ad6a302755da67b4d9 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 --- 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) {