Skip to main content

useMapRotation

function CustomFeature() {
const [rotationDegree, setRotate, resetRotation] = useMapRatation();

return <></>;
}

<div>
<MapContainer center={[126.841784, 35.191406]} width="100%" height="500px">
<CustomFeature />
</MapContainer>
</div>;
  • useMapRotation 훅을 통해 현재 사용하는 지도의 회전양, 회전함수, 초기화 함수를 받아 사용할 수 있습니다.
valuetypedescription
rotationDegreenumber현재 지도의 회전각도를 확인할 수 있습니다.
setRotate(degree: number) => voidsetRotate(90) 와 같이 인자에 넣은 각도 만큰 지도를 회전시킵니다.
resetRotation() => void실행하면 지도의 회전 각도를 0으로 초기화시킵니다.