Skip to content

Commit

Permalink
🪲 Fix selectedDistrict when changing language
Browse files Browse the repository at this point in the history
  • Loading branch information
Violini committed Jun 20, 2024
1 parent b7608ba commit 245b736
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frontend/src/components/Sidebar/MapComponents/HeatMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,6 @@ export default function HeatMap({
strokeWidth: 2,
layer: 1,
});

polygonTemplate.events.on('click', function (ev) {
if (ev.target.dataItem?.dataContext) {
setSelectedArea(ev.target.dataItem.dataContext as FeatureProperties);
}
});
})
);

Expand All @@ -239,6 +233,12 @@ export default function HeatMap({
if (!polygonSeries) return;
const polygonTemplate = polygonSeries.mapPolygons.template;
//show tooltip on heat legend when hovering
polygonTemplate.events.on('click', function (ev) {
if (ev.target.dataItem?.dataContext) {
setSelectedArea(ev.target.dataItem.dataContext as FeatureProperties);
}
});

polygonTemplate.events.on('pointerover', (e) => {
if (legendRef.current) {
const value = (e.target.dataItem?.dataContext as FeatureProperties).value as number;
Expand All @@ -254,7 +254,7 @@ export default function HeatMap({
void legendRef.current.hideTooltip();
}
});
}, [polygonSeries, legendRef, localization]);
}, [polygonSeries, legendRef, localization, setSelectedArea, theme.palette.primary.main]);

// This effect is responsible for showing the loading indicator if the data is not ready within 1 second. This
// prevents that the indicator is showing for every little change.
Expand Down

0 comments on commit 245b736

Please sign in to comment.