Map navigation.
This commit is contained in:
parent
5ae068ae43
commit
9a5808741b
|
@ -29,9 +29,12 @@ const Map: Component = () => {
|
||||||
setState(params);
|
setState(params);
|
||||||
const map = getMap();
|
const map = getMap();
|
||||||
const view = map?.getView();
|
const view = map?.getView();
|
||||||
view?.setCenter([+state().lon, +state().lat]);
|
view?.animate({
|
||||||
view?.setRotation(+state().rotation);
|
center: [+state().lon, +state().lat],
|
||||||
view?.setZoom(+state().zoom);
|
rotation: +state().rotation,
|
||||||
|
zoom: +state().zoom,
|
||||||
|
duration: 1000,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
let target: HTMLDivElement;
|
let target: HTMLDivElement;
|
||||||
|
@ -78,10 +81,6 @@ const Map: Component = () => {
|
||||||
setMap(olMap);
|
setMap(olMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
useBeforeLeave((event) => {
|
|
||||||
console.log({ caller: 'Map / useBeforeLeave', event });
|
|
||||||
});
|
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return <div class='ol-map' ref={target} />;
|
return <div class='ol-map' ref={target} />;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue