From 9a5808741b4f158cc91a0ab4f0160c49585f60ee Mon Sep 17 00:00:00 2001 From: evlist Date: Fri, 25 Nov 2022 17:06:07 +0100 Subject: [PATCH] Map navigation. --- src/components/map/Map.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/map/Map.tsx b/src/components/map/Map.tsx index 38e044d..4820ea5 100644 --- a/src/components/map/Map.tsx +++ b/src/components/map/Map.tsx @@ -29,9 +29,12 @@ const Map: Component = () => { setState(params); const map = getMap(); const view = map?.getView(); - view?.setCenter([+state().lon, +state().lat]); - view?.setRotation(+state().rotation); - view?.setZoom(+state().zoom); + view?.animate({ + center: [+state().lon, +state().lat], + rotation: +state().rotation, + zoom: +state().zoom, + duration: 1000, + }); }); const navigate = useNavigate(); let target: HTMLDivElement; @@ -78,10 +81,6 @@ const Map: Component = () => { setMap(olMap); }); - useBeforeLeave((event) => { - console.log({ caller: 'Map / useBeforeLeave', event }); - }); - // @ts-ignore return
; };