From 2c132c1ad632b2b0519981b14e69d7df3c7a1d51 Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Mon, 26 Feb 2024 20:10:34 +0100 Subject: [PATCH] Fix legend items when dropdown options fall back to default value --- frontend/src/lib/components/legend/legend-utils.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/components/legend/legend-utils.ts b/frontend/src/lib/components/legend/legend-utils.ts index 392cb40d..9f549bee 100644 --- a/frontend/src/lib/components/legend/legend-utils.ts +++ b/frontend/src/lib/components/legend/legend-utils.ts @@ -115,32 +115,32 @@ export function getLegendItems(context: FacilMapContext): LegendType[] { } if (field.controlColour) { - item.colour = `#${option.colour}`; + item.colour = `#${option.colour ?? type.defaultColour}`; } else if (type.colourFixed) { item.colour = `#${type.defaultColour}`; } if (type.type == "marker") { if (field.controlSymbol) { - item.symbol = option.symbol; + item.symbol = option.symbol ?? type.defaultSymbol; } else if (type.symbolFixed) { item.symbol = type.defaultSymbol; } if (field.controlShape) { - item.shape = option.shape; + item.shape = option.shape ?? type.defaultShape; } else if (type.shapeFixed) { item.shape = type.defaultShape; } } else if (type.type == "line") { if (field.controlWidth) { - item.width = option.width; + item.width = option.width ?? type.defaultWidth; } else if (type.widthFixed) { item.width = type.defaultWidth; } if (field.controlStroke) { - item.stroke = option.stroke; + item.stroke = option.stroke ?? type.defaultStroke; } else if (type.strokeFixed) { item.stroke = type.defaultStroke; }