Skip to content

Commit

Permalink
Fix legend items when dropdown options fall back to default value
Browse files Browse the repository at this point in the history
  • Loading branch information
cdauth committed Feb 26, 2024
1 parent 38a6424 commit 2c132c1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/src/lib/components/legend/legend-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2c132c1

Please sign in to comment.