Skip to content

Commit

Permalink
fix: fix undo redo rotation issues when flipped (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyingtao committed Apr 26, 2024
1 parent 2ad6323 commit 29b6fec
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Sources/Mantis/CropView/CropView.swift
Expand Up @@ -978,12 +978,10 @@ extension CropView: CropViewProtocol {

var newTransform = getTransformInfo(byTransformInfo: cropState.transformation)

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

if viewModel.verticallyFlip {
newTransform.rotation = -newTransform.rotation
if flipOddTimes {
let localRotation = newTransform.rotation.truncatingRemainder(dividingBy: .pi/2)
let rotation90s = newTransform.rotation - localRotation
newTransform.rotation = -rotation90s + localRotation
}

if newTransform.maskFrame != .zero {
Expand Down

0 comments on commit 29b6fec

Please sign in to comment.