From 51a28d0d8bbe49b6be0d576ff1c94824eebd9174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Mon, 9 Nov 2020 16:22:01 +0100 Subject: set color per path in server --- templates/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'templates/index.js') diff --git a/templates/index.js b/templates/index.js index b7b3b58..a7cfd90 100644 --- a/templates/index.js +++ b/templates/index.js @@ -27,10 +27,14 @@ async function postShortestPath(event){ body: JSON.stringify(req) }) - res = await res.json() - console.log(res.path) - var poly = L.polyline(res.path).addTo(map) + res = await res.json() + for (edge of res.edges) { + console.log(edge.path) + L.polyline(edge.path, { + color: edge.color + }).addTo(map) + } } function handleMapClick ({latlng}){ -- cgit v1.2.1