Skip to content

Commit b5d2d14

Browse files
Stop painting on mouse out/leave (#182)
1 parent 60153d5 commit b5d2d14

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

app/src/app/utils/events/mapEvents.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,19 @@ export const handleMapMouseLeave = (
120120
e: MapLayerMouseEvent | MapLayerTouchEvent,
121121
map: MapLibreMap | null
122122
) => {
123-
const mapStore = useMapStore.getState();
124-
const activeTool = mapStore.activeTool;
125-
const sourceLayer = mapStore.mapDocument?.parent_layer;
126-
const setHoverFeatures = mapStore.setHoverFeatures;
123+
const {setHoverFeatures, setIsPainting} = useMapStore.getState();
127124
setHoverFeatures([]);
125+
setIsPainting(false)
128126
};
129127

130128
export const handleMapMouseOut = (
131129
e: MapLayerMouseEvent | MapLayerTouchEvent,
132130
map: MapLibreMap | null
133-
) => {};
131+
) => {
132+
const {setHoverFeatures, setIsPainting} = useMapStore.getState();
133+
setHoverFeatures([]);
134+
setIsPainting(false)
135+
};
134136

135137
export const handleMapMouseMove = (
136138
e: MapLayerMouseEvent | MapLayerTouchEvent,

0 commit comments

Comments
 (0)