Skip to content

Commit

Permalink
fix maplayer bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudLun committed Dec 11, 2023
1 parent 498cd80 commit 09b0ae6
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
26 changes: 25 additions & 1 deletion components/Geopanel/Geopanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,27 @@ const Geopanel = () => {
['all', ['==', ['get', "ZCTA5CE10"], selectedZipcodes]],
1, 0
])

// map?.moveLayer("background", "zipcodes")
// map?.moveLayer("background", "districts")
// map?.moveLayer("background", "pattern")
// map?.moveLayer("background", 'districts_outline')
// map?.moveLayer("background", 'districts_outline')
// map?.moveLayer("districts", 'districts_outline')
// map?.moveLayer("pattern", 'districts_outline')
// map?.moveLayer("pattern", 'districts_clicked_outline')
// map?.moveLayer("districts", "zipcodes")
// map?.moveLayer("pattern", "zipcodes")


map?.moveLayer("background", "zipcodes")
map?.moveLayer("districts", "zipcodes")
map?.moveLayer("pattern", "zipcodes")
map?.moveLayer('pattern', "zipcodes")
map?.moveLayer('districts_outline', "zipcodes")
map?.moveLayer('districts_clicked_outline', "zipcodes")



}

const countyMouseEnterHandler = (e: MouseEvent<HTMLElement>) => {
Expand All @@ -73,9 +92,14 @@ const Geopanel = () => {
['all', ['==', ['get', "name"], selectedCounty + " County"]],
1, 0
])
map?.moveLayer("background", "counties_borders")
map?.moveLayer("districts", "counties_borders")
map?.moveLayer('pattern', "counties_borders")
map?.moveLayer('pattern', "counties_labels")
map?.moveLayer('districts_outline', "counties_labels")
map?.moveLayer('districts_clicked_outline', "counties_labels")



}

Expand Down
8 changes: 7 additions & 1 deletion components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,14 @@ const Map = () => {




m.moveLayer("background", "districts")
m.moveLayer("background", "zipcodes")
m.moveLayer('districts_outline', 'districts_hovered')
m.moveLayer("districts", "members")
m.moveLayer('pattern', 'members')

m.moveLayer("districts", "zipcodes")
m.moveLayer("pattern", "zipcodes")


m.on("click", "districts", (e: MapMouseEvent & EventData) => {
Expand Down Expand Up @@ -372,6 +376,8 @@ const Map = () => {
m.moveLayer("districts_outline", "members")




})


Expand Down
5 changes: 4 additions & 1 deletion context/MapContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,12 @@ const MapProvider = ({ children }: Props) => {
m.setPaintProperty("district_label", "text-opacity", 1)




m.moveLayer("districts", "districts_clicked_outline")
m.moveLayer("districts", "members")
m.moveLayer('districts', "counties_borders")
m.moveLayer("background", "zipcodes")
m.moveLayer("districts", "zipcodes")
m.moveLayer("districts_outline", "members")
m.moveLayer('districts_outline', 'districts_clicked_outline')
Expand All @@ -121,7 +124,7 @@ const MapProvider = ({ children }: Props) => {

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

setPanelShown({ geopanelShown: true, memberpanelShown: false })
Expand Down
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
trailingSlash: true,
output: "export",
// output: "export",
};

module.exports = nextConfig;

0 comments on commit 09b0ae6

Please sign in to comment.