Skip to content

Commit

Permalink
🩹 fix: fix image size on rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayanTheNerd committed Feb 8, 2024
1 parent 5b65b6c commit 67a2f40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/assets/ts/modules/spinImg.mts
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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)`;
}

0 comments on commit 67a2f40

Please sign in to comment.