mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Retain current zoom when switching campaigns
This commit is contained in:
parent
0f612ac9d9
commit
0f9781ff30
@ -25,10 +25,10 @@ export default function LiberationMap() {
|
|||||||
const map = useRef<Map>(null);
|
const map = useRef<Map>(null);
|
||||||
const mapCenter = useAppSelector(selectMapCenter);
|
const mapCenter = useAppSelector(selectMapCenter);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
map.current?.setView(mapCenter, 8, { animate: true, duration: 1 });
|
map.current?.setView(mapCenter, map.current?.getZoom() ?? 8, { animate: true, duration: 1 });
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<MapContainer zoom={8} zoomControl={false} ref={map}>
|
<MapContainer zoom={map.current?.getZoom() ?? 8} zoomControl={false} ref={map}>
|
||||||
<ScaleControl />
|
<ScaleControl />
|
||||||
<LeafletRuler />
|
<LeafletRuler />
|
||||||
<LayersControl collapsed={false}>
|
<LayersControl collapsed={false}>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user