Skip to content

Commit

Permalink
Merge branch 'hospital-ownership-map'
Browse files Browse the repository at this point in the history
  • Loading branch information
wcedmisten committed Apr 2, 2024
2 parents 3ad03d1 + a125036 commit 105f3bd
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions pages/project/virginia-hospital-ownership/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,27 @@ const Map = () => {
});

// Change the cursor to a pointer when the mouse is over the states layer.
map.current.on('mouseenter', 'voronoi', () => {
map.current.on('mouseenter', 'voronoi', (e) => {
(map.current as any).getCanvas().style.cursor = 'pointer';
});

map.current.on('mousemove', 'voronoi', (e) => {
(map.current as any).setPaintProperty(
"voronoi",
'fill-opacity',
['match', ['get', 'operator'], e?.features?.[0]?.properties?.operator, 0.5, 0.1]
);
});


// Change it back to a pointer when it leaves.
map.current.on('mouseleave', 'voronoi', () => {
(map.current as any).getCanvas().style.cursor = '';
(map.current as any).setPaintProperty(
"voronoi",
'fill-opacity',
0.5
);
});

map.current.fitBounds([
Expand All @@ -162,16 +176,11 @@ const Map = () => {
const colorMap: any = {}

voronoi.features.forEach((e) => {
if (e.properties.operator == "UNKNOWN") {
// console.log("UNKNOWN!!!", e.properties.name)
// colorMap[e.properties.name] = e.properties.color
} else {
if (e.properties.operator !== "UNKNOWN") {
colorMap[e.properties.operator] = e.properties.color
}
})

console.log(showInfoModal)

return (
<div className="map-wrap">
<InfoModal show={showInfoModal} handleClose={() => setShowInfoModal(false)}></InfoModal>
Expand Down Expand Up @@ -239,7 +248,7 @@ export async function getStaticProps() {
return {
props: {
opengraph: {
title: "Drive Time to Nearest Hospital in Virginia",
title: "Hospital Ownership in Virginia",
image: "https://wcedmisten.fyi/og-images/virginia-hospital-ownership.png",
type: "website",
url: "https://wcedmisten.fyi/project/virginia-hospital-ownership"
Expand Down

0 comments on commit 105f3bd

Please sign in to comment.