diff --git a/src/components/Gallery/Gallery.tsx b/src/components/Gallery/Gallery.tsx index dd660bb3..2abd3484 100644 --- a/src/components/Gallery/Gallery.tsx +++ b/src/components/Gallery/Gallery.tsx @@ -10,6 +10,7 @@ import {NavigationButton} from './components/NavigationButton/NavigationButton'; import {BODY_CONTENT_CLASS_NAME, cnGallery} from './constants'; import {GalleryContextProvider} from './contexts/GalleryContext'; import {useFullScreen} from './hooks/useFullScreen'; +import {useImageRotationState} from './hooks/useImageRotationState'; import {useMobileGestures} from './hooks/useMobileGestures/useMobileGestures'; import type {UseNavigationProps} from './hooks/useNavigation'; import {useNavigation} from './hooks/useNavigation'; @@ -70,6 +71,12 @@ export const Gallery = ({ const {fullScreen, setFullScreen} = useFullScreen(); + const {rotation, rotateLeft, rotateRight, resetRotation} = useImageRotationState(); + + React.useEffect(() => { + resetRotation(); + }, [activeItemIndex, resetRotation]); + const handleBackClick = React.useCallback(() => { onOpenChange?.(false); }, [onOpenChange]); @@ -131,80 +138,88 @@ export const Gallery = ({ overflow: mode === 'default' ? 'auto' : 'hidden', }} > -
-