Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update line layer widths #175

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/src/app/constants/basemapLayers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1100,8 +1100,9 @@ export const BASEMAP_LAYERS: LayerSpecification[] = [
source: 'counties',
'source-layer': 'tl_2023_us_county',
paint: {
'line-color': '#555',
'line-width': ['interpolate', ['exponential', 1.6], ['zoom'], 6, 0, 9, 0.75, 18, 1],
'line-color': '#333',
'line-opacity': 0.8,
'line-width': ['interpolate', ['exponential', 1.6], ['zoom'], 6, .625, 9, 1.625, 18, 2.25],
},
},
{
Expand Down
19 changes: 15 additions & 4 deletions app/src/app/constants/layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ export const BLOCK_HOVER_LAYER_ID = `${BLOCK_LAYER_ID}-hover`;
export const BLOCK_HOVER_LAYER_ID_CHILD = `${BLOCK_LAYER_ID_CHILD}-hover`;

export const INTERACTIVE_LAYERS = [BLOCK_HOVER_LAYER_ID, BLOCK_HOVER_LAYER_ID_CHILD];
export const LINE_LAYERS = [BLOCK_LAYER_ID, BLOCK_LAYER_ID_CHILD] as const

export const PARENT_LAYERS = [BLOCK_LAYER_ID, BLOCK_HOVER_LAYER_ID];
export const PARENT_LAYERS = [BLOCK_LAYER_ID, BLOCK_HOVER_LAYER_ID];

export const CHILD_LAYERS = [
BLOCK_LAYER_ID_CHILD,
Expand Down Expand Up @@ -52,6 +53,11 @@ ZONE_ASSIGNMENT_STYLE_DYNAMIC.push('#cecece');
// @ts-ignore
export const ZONE_ASSIGNMENT_STYLE: ExpressionSpecification = ZONE_ASSIGNMENT_STYLE_DYNAMIC;

const LAYER_LINE_WIDTHS = {
[BLOCK_LAYER_ID]: 2,
[BLOCK_LAYER_ID_CHILD]: 1
}

export function getLayerFilter(layerId: string, _shatterIds?: MapStore['shatterIds']) {
const shatterIds = _shatterIds || useMapStore.getState().shatterIds;
const isChildLayer = CHILD_LAYERS.includes(layerId);
Expand Down Expand Up @@ -180,10 +186,14 @@ export function getHighlightLayerSpecification(
},
};
}


export function getBlocksLayerSpecification(
sourceLayer: string,
layerId: string
layerId: typeof LINE_LAYERS[number]
): LayerSpecification {
const lineWidth = LAYER_LINE_WIDTHS[layerId]

const layerSpec: LayerSpecification = {
id: layerId,
source: BLOCK_SOURCE_ID,
Expand All @@ -194,8 +204,9 @@ export function getBlocksLayerSpecification(
},
paint: {
'line-opacity': 0.8,
'line-color': '#cecece', // Default color
'line-width': 1, // Default width
// 'line-color': '#aaaaaa', // Default color
'line-color': ['interpolate', ['exponential', 1.6], ['zoom'], 6, '#aaa', 9, '#777', 14, '#333'],
'line-width': ['interpolate', ['exponential', 1.6], ['zoom'], 6, lineWidth*.125, 9, lineWidth*.35, 14, lineWidth],
},
};
if (CHILD_LAYERS.includes(layerId)) {
Expand Down
Loading