diff --git a/src/assets/ts/modules/spinImg.mts b/src/assets/ts/modules/spinImg.mts index 6c2530f..f52727e 100644 --- a/src/assets/ts/modules/spinImg.mts +++ b/src/assets/ts/modules/spinImg.mts @@ -1,7 +1,7 @@ import imgStore from '@ts/imgStore.ts'; import { DOMElements } from '@ts/app.ts'; -const { width, height } = DOMElements.selectedImg; +const { offsetWidth, offsetHeight } = DOMElements.selectedImg; export default function spinImg(event: Event = null) { if (event?.target !== event?.currentTarget) { @@ -13,7 +13,7 @@ export default function spinImg(event: Event = null) { const { selectedImg } = DOMElements; const { verticalFlip, horizontalFlip, rotationDeg } = imgStore.state; - selectedImg.style.width = imgStore.isLandscape ? `${height}px` : '100%'; - selectedImg.style.height = imgStore.isLandscape ? `${width}px` : '100%'; + selectedImg.style.width = imgStore.isLandscape ? `${offsetHeight}px` : '100%'; + selectedImg.style.height = imgStore.isLandscape ? `${offsetWidth}px` : '100%'; selectedImg.style.transform = `scale(${verticalFlip}, ${horizontalFlip}) rotate(${rotationDeg}deg)`; }