Skip to content

Commit

Permalink
fix(frontend): restore region labels (#36)
Browse files Browse the repository at this point in the history
The move to vector base maps accidentally removed labels for administative regions. This restores them.
  • Loading branch information
eatyourgreens authored Jun 11, 2024
1 parent d0aed1a commit 6109a51
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions frontend/src/state/layers/view-layers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { regionLabelsDeckLayer } from 'config/regions/region-labels-deck-layer';
import { regionBoundariesViewLayer } from 'config/regions/boundaries-view-layer';
import { ViewLayer, viewOnlyLayer } from 'lib/data-map/view-layers';
import { backgroundState, showLabelsState } from 'map/layers/layers-state';
import { selector } from 'recoil';
import { truthyKeys } from 'lib/helpers';
import { ConfigTree } from 'lib/nested-config/config-tree';
Expand Down Expand Up @@ -49,6 +51,8 @@ export const viewLayersState = selector<ConfigTree<ViewLayer>>({
get: ({ get }) => {
const showRegions = get(sectionVisibilityState('regions'));
const regionLevel = get(regionLevelState);
const background = get(backgroundState);
const showLabels = get(showLabelsState);

return [
// administrative region boundaries or population density
Expand All @@ -73,6 +77,18 @@ export const viewLayersState = selector<ConfigTree<ViewLayer>>({
get(droughtOptionsLayerState),

get(featureBoundingBoxLayerState),

showLabels && [
// administrative regions labels
showRegions &&
viewOnlyLayer(`boundaries_${regionLevel}-text`, () =>
regionLabelsDeckLayer(regionLevel, background),
),
],

/**
* CAUTION: for some reason, vector layers put here are obscured by the 'labels' semi-transparent raster layer
*/
];
},
});

0 comments on commit 6109a51

Please sign in to comment.