Skip to content

Commit 5daecd3

Browse files
committed
feat: added white halo for detour lines and changed color and dash array slightly
1 parent 0f0717d commit 5daecd3

5 files changed

Lines changed: 55 additions & 12 deletions

File tree

src/map/pinkDetourLeaflet.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ export function addDetourPaintToMap(
3535
map: L.Map,
3636
pieces: DetourPaintPiece[],
3737
dashedStyle: L.PolylineOptions,
38-
layersOut: L.Layer[]
38+
layersOut: L.Layer[],
39+
dashedHaloStyle?: L.PolylineOptions
3940
): void {
4041
ensureOffroadLinePane(map);
4142

4243
const offroadPieces: Extract<DetourPaintPiece, { kind: "offroad" }>[] = [];
4344

4445
for (const piece of pieces) {
4546
if (piece.kind === "road") {
47+
if (dashedHaloStyle) {
48+
layersOut.push(L.polyline(piece.points as L.LatLngExpression[], dashedHaloStyle).addTo(map));
49+
}
4650
const pl = L.polyline(piece.points as L.LatLngExpression[], dashedStyle).addTo(map);
4751
layersOut.push(pl);
4852
} else {

src/pages/MapPage/PinkLineMapPage.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
} from "../../utils/pinkLineRoute";
1919
import { addDetourPaintToMap } from "../../map/pinkDetourLeaflet";
2020
import { pinkDetourGoogleDashedStyle } from "../../map/pinkDetourDashStyle";
21+
import { proposedLineHaloStyle } from "./mapLineStyles";
2122
import supabase from "../../supabase";
2223
import PinkLineNodeForm from "./PinkLineNodeForm";
2324
import PinkRouteFetchingBanner from "./PinkRouteFetchingBanner";
@@ -280,6 +281,7 @@ const PinkLineMapPage = () => {
280281
const { solid, dashed, removed } = integratedRoute;
281282
const solidStyle: L.PolylineOptions = { color: "#FF69B4", weight: 5, opacity: 0.9 };
282283
const dashedStyle = pinkDetourGoogleDashedStyle;
284+
const dashedHaloStyle = proposedLineHaloStyle;
283285
const removedStyle: L.PolylineOptions = { color: "#FF69B4", weight: 5, opacity: 0.6 };
284286
const showUserDetours = nodes.length > 0;
285287

@@ -295,11 +297,17 @@ const PinkLineMapPage = () => {
295297
}
296298
if (showUserDetours) {
297299
if (integratedRoute.detourPaint && integratedRoute.detourPaint.length > 0) {
298-
addDetourPaintToMap(map, integratedRoute.detourPaint, dashedStyle, routeLayersRef.current);
300+
addDetourPaintToMap(
301+
map,
302+
integratedRoute.detourPaint,
303+
dashedStyle,
304+
routeLayersRef.current,
305+
dashedHaloStyle
306+
);
299307
} else {
300308
for (const pts of dashed) {
301-
const layer = L.polyline(pts as L.LatLngExpression[], dashedStyle).addTo(map);
302-
routeLayersRef.current.push(layer);
309+
routeLayersRef.current.push(L.polyline(pts as L.LatLngExpression[], dashedHaloStyle).addTo(map));
310+
routeLayersRef.current.push(L.polyline(pts as L.LatLngExpression[], dashedStyle).addTo(map));
303311
}
304312
}
305313
}

src/pages/MapPage/index.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ import {
1717
} from "../../utils/pinkLineRoute";
1818
import { addDetourPaintToMap } from "../../map/pinkDetourLeaflet";
1919
import { pinkDetourGoogleDashedStyle } from "../../map/pinkDetourDashStyle";
20-
import { oldLineHaloStyle, oldLineStyle, solidLineStyle } from "./mapLineStyles";
20+
import {
21+
oldLineHaloStyle,
22+
oldLineStyle,
23+
proposedLineHaloStyle,
24+
solidLineStyle,
25+
} from "./mapLineStyles";
2126
import { ensureMemorialSitesProjectForUser, loadProjects } from "../../supabase/projects";
2227
import { PendingSite } from "../../supabase/memorialSites";
2328
import {
@@ -507,6 +512,7 @@ const MapPage = () => {
507512
const { solid, dashed, removed } = integratedPinkRoute;
508513
const solidStyle = solidLineStyle;
509514
const dashedStyle = pinkDetourGoogleDashedStyle;
515+
const dashedHaloStyle = proposedLineHaloStyle;
510516
const removedStyle = oldLineStyle;
511517
const removedHaloStyle = oldLineHaloStyle;
512518
const showPinkDetours = pinkNodes.length > 0;
@@ -522,9 +528,16 @@ const MapPage = () => {
522528
}
523529
if (showPinkDetours) {
524530
if (integratedPinkRoute.detourPaint && integratedPinkRoute.detourPaint.length > 0) {
525-
addDetourPaintToMap(map, integratedPinkRoute.detourPaint, dashedStyle, routeLayersRef.current);
531+
addDetourPaintToMap(
532+
map,
533+
integratedPinkRoute.detourPaint,
534+
dashedStyle,
535+
routeLayersRef.current,
536+
dashedHaloStyle
537+
);
526538
} else {
527539
for (const points of dashed) {
540+
routeLayersRef.current.push(L.polyline(points as L.LatLngExpression[], dashedHaloStyle).addTo(map));
528541
routeLayersRef.current.push(L.polyline(points as L.LatLngExpression[], dashedStyle).addTo(map));
529542
}
530543
}
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { describe, expect, it } from "vitest";
2-
import { oldLineHaloStyle, oldLineStyle, proposedLineStyle } from "./mapLineStyles";
2+
import {
3+
oldLineHaloStyle,
4+
oldLineStyle,
5+
proposedLineHaloStyle,
6+
proposedLineStyle,
7+
} from "./mapLineStyles";
38

49
describe("map line styles", () => {
5-
it("keeps old segment solid gray at full opacity while still weaker than proposed", () => {
10+
it("keeps replaced segments solid (no dash) and visually weaker than proposed", () => {
611
expect(oldLineStyle.dashArray).toBeUndefined();
7-
expect(oldLineStyle.opacity).toBe(1);
8-
expect(oldLineStyle.color).toBe("#6D7887");
912
expect(oldLineStyle.weight ?? 0).toBeGreaterThanOrEqual(4);
1013
expect(oldLineStyle.weight ?? 0).toBeLessThan(proposedLineStyle.weight ?? 99);
1114
expect(proposedLineStyle.dashArray).toBeDefined();
@@ -16,4 +19,10 @@ describe("map line styles", () => {
1619
expect(oldLineHaloStyle.dashArray).toBeUndefined();
1720
expect(oldLineHaloStyle.weight ?? 0).toBeGreaterThan(oldLineStyle.weight ?? 0);
1821
});
22+
23+
it("uses a solid white halo underlay wider than the dashed proposed line", () => {
24+
expect(proposedLineHaloStyle.color?.toLowerCase()).toBe("#ffffff");
25+
expect(proposedLineHaloStyle.dashArray).toBeUndefined();
26+
expect(proposedLineHaloStyle.weight ?? 0).toBeGreaterThan(proposedLineStyle.weight ?? 0);
27+
});
1928
});

src/pages/MapPage/mapLineStyles.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,19 @@ export const oldLineHaloStyle: PolylineOptions = {
2929

3030
/** New / proposed detour alignment — stronger than old segments. */
3131
export const proposedLineStyle: PolylineOptions = {
32-
color: "#FF4FA3",
32+
color: "#ff587b",
3333
weight: 6,
3434
opacity: 0.95,
35-
dashArray: "4 7",
35+
dashArray: "3 7",
36+
lineCap: "round",
37+
lineJoin: "round",
38+
};
39+
40+
/** Drawn beneath `proposedLineStyle` polylines for a white halo (solid stroke; dashed line on top). */
41+
export const proposedLineHaloStyle: PolylineOptions = {
42+
color: "#ffffff",
43+
weight: 7,
44+
opacity: 0.22,
3645
lineCap: "round",
3746
lineJoin: "round",
3847
};

0 commit comments

Comments
 (0)