Skip to content

Commit a932a86

Browse files
fix : mobile initial zoom
1 parent 218065b commit a932a86

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

frontend/src/features/try-fair/components/map/draggable-grid.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ export const TryFairDraggableGrid = ({
6969

7070
useEffect(() => {
7171
if (!isSmallViewport || !map) return;
72-
const recenter = () => {
72+
const recenter = (e: { originalEvent?: unknown }) => {
73+
if (!e.originalEvent) return;
7374
const { lng, lat } = map.getCenter();
7475
setAnchor((prev) => {
7576
const next = computeCenteredAnchor({ lng, lat }, tileZoom);
7677
return prev && prev.x === next.x && prev.y === next.y ? prev : next;
7778
});
7879
};
79-
recenter();
8080
map.on("move", recenter);
8181
return () => {
8282
map.off("move", recenter);

0 commit comments

Comments
 (0)