Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix the issue that rotation control jumps during orientation change #433

Merged
merged 2 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/Mantis/CropView/CropView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,12 @@ final class CropView: UIView {
rotationControlView.frame.origin.x = cropAuxiliaryIndicatorView.frame.origin.x +
(cropAuxiliaryIndicatorView.frame.width - rotationControlView.frame.width) / 2
rotationControlView.frame.origin.y = cropAuxiliaryIndicatorView.frame.maxY
} else if Orientation.isLandscapeLeft {
} else if Orientation.isLandscapeRight {
rotationControlView.transform = CGAffineTransform(rotationAngle: -CGFloat.pi / 2)
rotationControlView.frame.origin.x = cropAuxiliaryIndicatorView.frame.maxX
rotationControlView.frame.origin.y = cropAuxiliaryIndicatorView.frame.origin.y +
(cropAuxiliaryIndicatorView.frame.height - rotationControlView.frame.height) / 2
} else if Orientation.isLandscapeRight {
} else if Orientation.isLandscapeLeft {
rotationControlView.transform = CGAffineTransform(rotationAngle: CGFloat.pi / 2)
rotationControlView.frame.origin.x = cropAuxiliaryIndicatorView.frame.minX - rotationControlView.frame.width
rotationControlView.frame.origin.y = cropAuxiliaryIndicatorView.frame.origin.y +
Expand Down Expand Up @@ -483,7 +483,7 @@ extension CropView {
contentRect.size.height = rect.height - 2 * cropViewPadding

contentRect.origin.y = rect.origin.y + cropViewPadding
if Orientation.isLandscapeLeft {
if Orientation.isLandscapeRight {
contentRect.origin.x = rect.origin.x + cropViewPadding
} else {
contentRect.origin.x = rect.origin.x + cropViewPadding + rotationControlViewHeight
Expand Down
4 changes: 2 additions & 2 deletions Sources/Mantis/RotationDial/SlideDial/SlideDial.swift
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ final class SlideDial: UIView, RotationControlViewProtocol {

if Orientation.treatAsPortrait {
indicator.transform = CGAffineTransform(rotationAngle: 0)
} else if Orientation.isLandscapeLeft {
indicator.transform = CGAffineTransform(rotationAngle: CGFloat.pi / 2)
} else if Orientation.isLandscapeRight {
indicator.transform = CGAffineTransform(rotationAngle: CGFloat.pi / 2)
} else if Orientation.isLandscapeLeft {
indicator.transform = CGAffineTransform(rotationAngle: -CGFloat.pi / 2)
}
}
Expand Down