Skip to content

Commit

Permalink
add zomm in level in NYC area
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudLun committed Nov 30, 2023
1 parent 50e9aa1 commit bb25171
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
28 changes: 10 additions & 18 deletions components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,33 +216,25 @@ const Map = () => {
m.moveLayer("districts_outline", "zipcodes")
m.moveLayer("districts", "members")
m.moveLayer("districts_outline", "members")


m.on("click", "districts", (e: MapMouseEvent & EventData) => {
setSelectedDistrictFeatures(e.features[0])
setSelectedDistrictOverlappedData((districts === "senate" ? senateOverlapped : assemblyOverlapped).filter(d => +d.district === +e.features[0]?.properties.District)[0])
mapClickHandler(m, e, legislations)

})

m.on('click', "members", (e: MapMouseEvent & EventData) => {
setSelectedMemberFeatures(e.features[0])
setPanelShown({ geopanelShown: false, memberpanelShown: true })
m.flyTo({
center: [e.features[0].properties.lon, e.features[0].properties.lat],
zoom: 9.5
})

// m.setPaintProperty("members", "circle-color", [
// 'case',
// ['all', ["==", ['get', "Name"], e.features[0].properties.Name]],
// "#ffe57f",
// ["in", `Member`, ["get", "Membership Status"]],
// "#802948", "#ffffff"
// ])

// m.setPaintProperty("members", "circle-stroke-color", [
// 'case',
// ['all', ["==", ['get', "Name"], e.features[0].properties.Name]],
// "#ffe57f", "#802948"
// ])
console.log([e.features[0].properties.lon, e.features[0].properties.lat])
// m.flyTo({
// center: [e.features[0].properties.lon, e.features[0].properties.lat],
// zoom: e.features[0].properties.lon > -74.15 && e.features[0].properties.lat < 41.05 ? 12 : 3
// })



})

Expand Down
4 changes: 3 additions & 1 deletion context/MapContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ const MapProvider = ({ children }: Props) => {
]
}

console.log(targetCentroid)

/* @ts-ignore */
m.getSource("district_label").setData({
type: "FeatureCollection",
Expand All @@ -114,7 +116,7 @@ const MapProvider = ({ children }: Props) => {

m.flyTo({
center: targetCentroid as [number, number],
zoom: 8
zoom: targetCentroid[0] > -74.15 && targetCentroid[1] < 41.05 ? 12 : 8
})

setPanelShown({ geopanelShown: true, memberpanelShown: false })
Expand Down

0 comments on commit bb25171

Please sign in to comment.