feat: remove fill when district pop up is close
This commit is contained in:
parent
5808758855
commit
f4b6d19eb2
|
@ -11,7 +11,7 @@ import TimelineLayer from "./timeline-layer"
|
||||||
|
|
||||||
import type { ICrimes, IIncidentLogs } from "@/app/_utils/types/crimes"
|
import type { ICrimes, IIncidentLogs } from "@/app/_utils/types/crimes"
|
||||||
import type { IDistrictFeature } from "@/app/_utils/types/map"
|
import type { IDistrictFeature } from "@/app/_utils/types/map"
|
||||||
import { createFillColorExpression, processCrimeDataByDistrict } from "@/app/_utils/map"
|
import { createFillColorExpression, getCrimeRateColor, processCrimeDataByDistrict } from "@/app/_utils/map"
|
||||||
import UnclusteredPointLayer from "./uncluster-layer"
|
import UnclusteredPointLayer from "./uncluster-layer"
|
||||||
|
|
||||||
import { toast } from "sonner"
|
import { toast } from "sonner"
|
||||||
|
@ -156,6 +156,7 @@ export default function Layers({
|
||||||
if (map.getLayer("clusters")) {
|
if (map.getLayer("clusters")) {
|
||||||
map.getMap().setLayoutProperty("clusters", "visibility", "visible")
|
map.getMap().setLayoutProperty("clusters", "visibility", "visible")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map.getLayer("unclustered-point")) {
|
if (map.getLayer("unclustered-point")) {
|
||||||
map.getMap().setLayoutProperty("unclustered-point", "visibility", "visible")
|
map.getMap().setLayoutProperty("unclustered-point", "visibility", "visible")
|
||||||
}
|
}
|
||||||
|
@ -164,6 +165,8 @@ export default function Layers({
|
||||||
const fillColorExpression = createFillColorExpression(null, crimeDataByDistrict)
|
const fillColorExpression = createFillColorExpression(null, crimeDataByDistrict)
|
||||||
map.getMap().setPaintProperty("district-fill", "fill-color", fillColorExpression as any)
|
map.getMap().setPaintProperty("district-fill", "fill-color", fillColorExpression as any)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}, [map, crimeDataByDistrict])
|
}, [map, crimeDataByDistrict])
|
||||||
|
|
||||||
|
@ -213,6 +216,19 @@ export default function Layers({
|
||||||
0,
|
0,
|
||||||
])
|
])
|
||||||
|
|
||||||
|
map.getMap().setPaintProperty("district-extrusion", "fill-extrusion-color", [
|
||||||
|
"case",
|
||||||
|
["has", "kode_kec"],
|
||||||
|
[
|
||||||
|
"match",
|
||||||
|
["get", "kode_kec"],
|
||||||
|
focusedDistrictId || "",
|
||||||
|
"transparent",
|
||||||
|
"transparent",
|
||||||
|
],
|
||||||
|
"transparent",
|
||||||
|
])
|
||||||
|
|
||||||
if (progress < 1) {
|
if (progress < 1) {
|
||||||
animationRef.current = requestAnimationFrame(animate)
|
animationRef.current = requestAnimationFrame(animate)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue