-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Paint by county #74
Paint by county #74
Changes from all commits
69eaae7
69eb2ab
c0f6cfc
26adc29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,11 @@ import { | |
BLOCK_HOVER_LAYER_ID, | ||
} from "../constants/layers"; | ||
import type { UseQueryResult } from "@tanstack/react-query"; | ||
import { LayerVisibility } from "../utils/helpers"; | ||
import { | ||
LayerVisibility, | ||
PaintEventHandler, | ||
getFeaturesInBbox, | ||
} from "../utils/helpers"; | ||
|
||
export interface MapStore { | ||
mapRef: MutableRefObject<maplibregl.Map | null> | null; | ||
|
@@ -45,6 +49,8 @@ export interface MapStore { | |
setBrushSize: (size: number) => void; | ||
isPainting: boolean; | ||
setIsPainting: (isPainting: boolean) => void; | ||
paintFunction: PaintEventHandler; | ||
setPaintFunction: (paintFunction: PaintEventHandler) => void; | ||
clearMapEdits: () => void; | ||
freshMap: boolean; | ||
setFreshMap: (resetMap: boolean) => void; | ||
|
@@ -121,6 +127,8 @@ export const useMapStore = create( | |
setBrushSize: (size) => set({ brushSize: size }), | ||
isPainting: false, | ||
setIsPainting: (isPainting) => set({ isPainting }), | ||
paintFunction: getFeaturesInBbox, | ||
setPaintFunction: (paintFunction) => set({ paintFunction }), | ||
Comment on lines
+130
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using this pattern made it really easy to handle different behaviors on hover without messing with map events. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i like it! |
||
clearMapEdits: () => | ||
set({ | ||
zoneAssignments: new Map(), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of an ugly hack for
queryRenderedFeatures
to work but was fine with it.