-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🩹 fix: fix minor editing issues & improve UX
- Loading branch information
1 parent
e8b4bfb
commit 5b65b6c
Showing
8 changed files
with
30 additions
and
18 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
import imgStore from '@ts/imgStore.ts'; | ||
import { DOMElements } from '@ts/app.ts'; | ||
|
||
const { width, height } = DOMElements.selectedImg; | ||
|
||
export default function spinImg(event: Event = null) { | ||
if (event?.target !== event?.currentTarget) { | ||
const target = event.target as HTMLButtonElement; | ||
const spinBtn = target.closest('button') as HTMLButtonElement; | ||
const spinType: string = spinBtn.title.toLowerCase(); | ||
const spinType: string = spinBtn.title.toLowerCase().trim(); | ||
imgStore.spin = spinType; | ||
} | ||
|
||
const { selectedImg } = DOMElements; | ||
const { verticalFlip, horizontalFlip, rotationDeg } = imgStore.state; | ||
DOMElements.selectedImg.style.transform = `scale(${verticalFlip}, ${horizontalFlip}) rotate(${rotationDeg}deg)`; | ||
selectedImg.style.width = imgStore.isLandscape ? `${height}px` : '100%'; | ||
selectedImg.style.height = imgStore.isLandscape ? `${width}px` : '100%'; | ||
selectedImg.style.transform = `scale(${verticalFlip}, ${horizontalFlip}) rotate(${rotationDeg}deg)`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters