This commit is contained in:
Sebastien Riviere
2026-02-13 00:22:29 +01:00
parent eb72a1e5da
commit 5f16500634
11 changed files with 79 additions and 37 deletions

View File

@@ -15,7 +15,7 @@ export function MapPan({center, zoom, animate=false}) {
return null;
}
export function MapEventListener({ onLeftClick, onRightClick, onMouseMove, onDragStart }) {
export function MapEventListener({ onLeftClick, onRightClick, onMouseMove, onDragStart, onWheel }) {
const map = useMap();
// TODO use useMapEvents instead of this + detect when zoom
@@ -93,6 +93,17 @@ export function MapEventListener({ onLeftClick, onRightClick, onMouseMove, onDra
map.off('dragstart', onDragStart);
}
}, [onDragStart]);
useEffect(() => {
if (!onWheel) return;
const container = map.getContainer();
container.addEventListener('wheel', onWheel);
return () => {
container.removeEventListener('wheel', onWheel);
}
}, [onWheel]);
// Prevent right click context menu
useEffect(() => {