Skip to content

Commit f182d6c

Browse files
authored
fix(geojson-layer): initialize strokeColor for LineString features (#2305) (#3338)
When loading GeoJSON data containing only LineString/MultiLineString features, setInitialLayerConfig did not set a strokeColor, leaving it as null. This caused the stroke color picker in the layer panel to show a different color than what was actually rendered (which fell back to the layer's base color). Now LineString-only layers get explicit strokeColor initialization matching the behavior of polygon layers, ensuring the color picker accurately reflects the rendered line color and that user changes to stroke color take effect immediately. Closes #2305 Signed-off-by: pierreeurope <pierre.europe@pm.me>
1 parent f25f128 commit f182d6c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/layers/src/geojson-layer/geojson-layer.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,13 @@ export default class GeoJsonLayer extends Layer {
637637
} else if (featureTypes && featureTypes.point) {
638638
// set fill to true if detect point
639639
return this.updateLayerVisConfig({filled: true, stroked: false});
640+
} else if (featureTypes && featureTypes.line) {
641+
// for line features, set strokeColor so the color picker reflects the actual rendered color
642+
return this.updateLayerVisConfig({
643+
stroked: true,
644+
filled: false,
645+
strokeColor: colorMaker.next().value
646+
});
640647
}
641648

642649
return this;

0 commit comments

Comments
 (0)