Skip to content

Commit

Permalink
Add circle radius and circle stroke width as options
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelSzmarowski committed Sep 19, 2023
1 parent 1a9af93 commit 2c89bb6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/visualizations/src/components/MapPoi/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export type Layer = {
type: LayerSpecification['type'];
color: Color;
borderColor?: Color;
circleRadius?: number;
circleStrokeWidth?: number;
/**
* Set a marker color based on a value.
* If no match, default color comes from `color`
Expand Down
8 changes: 5 additions & 3 deletions packages/visualizations/src/components/MapPoi/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ export const getMapLayers = (layers?: Layer[]): CircleLayerSpecification[] => {
circleBorderColor = groupBordersByColors;
}
}
const { id, type, source, sourceLayer } = layer;
const {
id, type, source, sourceLayer, circleRadius = 7, circleStrokeWidth = 1.5
} = layer;
return {
id,
type,
source,
...(sourceLayer ? { 'source-layer': sourceLayer } : undefined),
paint: {
'circle-radius': 7,
...(circleBorderColor && { 'circle-stroke-width': 1.5 }),
'circle-radius': circleRadius,
...(circleBorderColor && { 'circle-stroke-width': circleStrokeWidth }),
'circle-color': circleColor,
...(circleBorderColor && { 'circle-stroke-color': circleBorderColor }),
},
Expand Down

0 comments on commit 2c89bb6

Please sign in to comment.