Map navigation.

This commit is contained in:
Eric van der Vlist 2022-11-25 17:06:07 +01:00
parent 5ae068ae43
commit 9a5808741b
1 changed files with 6 additions and 7 deletions

View File

@ -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 <div class='ol-map' ref={target} />;
};