ctucx.git: trainsearch

web based trip-planner, fork of https://cyberchaos.dev/yuka/trainsearch

commit 6f557f7102b240e4a098ae52c35ff7276361b4c9
parent 6ddbcd9c68ce1f656b8043304ac028014e3dc906
Author: Yureka <yuka@yuka.dev>
Date: Sat, 23 Jul 2022 12:03:14 +0200

add stroke for better visibility of overlapping legs
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/canvas.js b/src/canvas.js
@@ -9,7 +9,7 @@ const formatTime = (date) => {
 
 const textFor = (leg) => leg.line && leg.line.name || '';
 const colorFor = (leg, type) => {
-	const product = leg.line && leg.line.product || 'walk';
+	const product = leg.line?.product || 'walk';
 	return colors[type][product] || colors[type].default;
 };
 const loadFactorColors = {

@@ -278,6 +278,8 @@ const renderJourneys = () => {
 			} else {
 				ctx.fillStyle = colorFor(leg, 'fill');
 				ctx.fillRect(x, y, rectWidth, duration);
+				ctx.strokeStyle = colorFor(leg, 'text');
+				ctx.strokeRect(x, y, rectWidth, duration);
 			}
 			//ctx.shadowBlur = 0;