Skip to content

Commit 04aed70

Browse files
authored
DEV-12131 Fix usa county map hiding from legends (#2517)
1 parent 601341d commit 04aed70

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/map/src/components/UsaMap/components/UsaMap.County.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import useGeoClickHandler from '../../../hooks/useGeoClickHandler'
1515
import { applyLegendToRow } from '../../../helpers/applyLegendToRow'
1616
import useApplyTooltipsToGeo from '../../../hooks/useApplyTooltipsToGeo'
1717
import { MapConfig } from '../../../types/MapConfig'
18-
import { DEFAULT_MAP_BACKGROUND } from '../../../helpers/constants'
18+
import { DISABLED_MAP_COLOR } from '../../../helpers/constants'
1919
import { publishAnalyticsEvent } from '@cdc/core/helpers/metrics/helpers'
2020
import { getVizTitle, getVizSubType } from '@cdc/core/helpers/metrics/utils'
2121

@@ -625,9 +625,9 @@ const CountyMap = () => {
625625
context.fillStyle =
626626
legendValues && config.general.type !== 'us-geocode'
627627
? legendValues[0] === '#000000'
628-
? DEFAULT_MAP_BACKGROUND
628+
? DISABLED_MAP_COLOR
629629
: legendValues[0]
630-
: DEFAULT_MAP_BACKGROUND
630+
: DISABLED_MAP_COLOR
631631
context.beginPath()
632632
path(geo)
633633
context.fill()
@@ -708,7 +708,7 @@ const CountyMap = () => {
708708
? applyLegendToRow(runtimeData[key], config, runtimeLegend, legendMemo, legendSpecialClassLastMemo)
709709
: false
710710
if (legendValues) {
711-
if (legendValues?.[0] === '#000000' || legendValues?.[0] === DEFAULT_MAP_BACKGROUND) return
711+
if (legendValues?.[0] === '#000000' || legendValues?.[0] === DISABLED_MAP_COLOR) return
712712
const shapeType = config.visual.cityStyle.toLowerCase()
713713
const shapeProperties = createShapeProperties(shapeType, pixelCoords, legendValues, config, geoRadius)
714714
if (shapeProperties) {

packages/map/src/helpers/applyLegendToRow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const applyLegendToRow = (
4343
const idx = legendMemo.current.get(hash)!
4444
const disabledIdx = showSpecialClassesLast ? legendSpecialClassLastMemo.current.get(hash) ?? idx : idx
4545

46+
// Note: DISABLED_MAP_COLOR is used in UsaMap.County.tsx to check for hidden bubbles. Should be refactored to use the hidden value when that is implemented.
4647
if (runtimeLegend.items?.[disabledIdx]?.disabled || runtimeLegend.items?.[disabledIdx]?.hidden) {
4748
return generateColorsArray(DISABLED_MAP_COLOR)
4849
}

0 commit comments

Comments
 (0)