Skip to content

Commit

Permalink
feat: Clear button that removes route line, expansion graph and traff…
Browse files Browse the repository at this point in the history
…ic flows
  • Loading branch information
kinkard committed Nov 13, 2024
1 parent 451d88e commit 5975bfe
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
<textarea id="route-summary" rows="11" cols="50"></textarea>
</div>
<button id="do-traffic">Show traffic</button>
<button id="do-clear">Clear</button>
</div>
<div id="error-message"></div>
</div>
Expand Down Expand Up @@ -403,6 +404,26 @@
errorMessage.textContent = "Bad /api/traffic/ response: " + err;
});;
});

document.getElementById("do-clear").addEventListener("click", () => {
map.getSource("route").setData({
type: "Feature",
geometry: {
type: "LineString",
coordinates: []
}
});
map.getSource("expansion").setData({
type: "FeatureCollection",
features: [],
});
map.getSource("traffic-lines").setData({
type: "FeatureCollection",
features: [],
});
document.getElementById("route-summary").textContent = "";
document.getElementById("error-message").textContent = "";
})
});

function sendValhallaRequest(endpoint, locations, addons) {
Expand Down

0 comments on commit 5975bfe

Please sign in to comment.