From 0f9781ff303b520db841a8d69dfe7da34a214f1f Mon Sep 17 00:00:00 2001 From: Raffson Date: Sat, 18 May 2024 20:24:55 +0200 Subject: [PATCH] Retain current zoom when switching campaigns --- client/src/components/liberationmap/LiberationMap.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/components/liberationmap/LiberationMap.tsx b/client/src/components/liberationmap/LiberationMap.tsx index 24253f73..97cfe342 100644 --- a/client/src/components/liberationmap/LiberationMap.tsx +++ b/client/src/components/liberationmap/LiberationMap.tsx @@ -25,10 +25,10 @@ export default function LiberationMap() { const map = useRef(null); const mapCenter = useAppSelector(selectMapCenter); useEffect(() => { - map.current?.setView(mapCenter, 8, { animate: true, duration: 1 }); + map.current?.setView(mapCenter, map.current?.getZoom() ?? 8, { animate: true, duration: 1 }); }); return ( - +