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
This commit is contained in:
Tucker Chapman 2021-01-16 18:00:57 -05:00 committed by Tom Hughes
parent 810e4da85a
commit d257e67842

View file

@ -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) {