Skip to content

Commit

Permalink
fix: fix the rotation issue when undo/redo for a flipped image (#393) (
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyingtao committed Apr 25, 2024
1 parent b936dd0 commit 2ad6323
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/Mantis/CropView/CropView.swift
Expand Up @@ -976,7 +976,15 @@ extension CropView: CropViewProtocol {
viewModel.fixedImageRatio = cropState.aspectRato
flipOddTimes = cropState.flipOddTimes

let newTransform = getTransformInfo(byTransformInfo: cropState.transformation)
var newTransform = getTransformInfo(byTransformInfo: cropState.transformation)

if viewModel.horizontallyFlip {
newTransform.rotation = -newTransform.rotation
}

if viewModel.verticallyFlip {
newTransform.rotation = -newTransform.rotation
}

if newTransform.maskFrame != .zero {
viewModel.cropBoxFrame = newTransform.maskFrame
Expand Down

0 comments on commit 2ad6323

Please sign in to comment.