Various improvements

This commit is contained in:
Ilya Laktyushin
2023-01-04 11:18:20 +04:00
parent 076129348b
commit c10f020f0a
15 changed files with 203 additions and 154 deletions

View File

@@ -235,17 +235,7 @@
{
void(^block)(void) = ^
{
CGAffineTransform transform = CGAffineTransformMakeRotation(-1 * TGRotationForInterfaceOrientation(orientation));
CGFloat scale = 1.0;
if (self.frame.size.width != 0.0) {
scale = self.frame.size.height / self.frame.size.width;
}
if (_innerInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
transform = CGAffineTransformScale(transform, scale, scale);
} else if (_innerInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
transform = CGAffineTransformScale(transform, scale, scale);
}
_wrapperView.transform = transform;
[self updateWrapperTransform];
[self layoutSubviews];
};
@@ -257,6 +247,20 @@
block();
}
- (void)updateWrapperTransform {
CGAffineTransform transform = CGAffineTransformMakeRotation(-1 * TGRotationForInterfaceOrientation(_innerInterfaceOrientation));
CGFloat scale = 1.0;
if (self.frame.size.width != 0.0) {
scale = self.frame.size.height / self.frame.size.width;
}
if (_innerInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
transform = CGAffineTransformScale(transform, scale, scale);
} else if (_innerInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {
transform = CGAffineTransformScale(transform, scale, scale);
}
_wrapperView.transform = transform;
}
- (void)layoutSubviews
{
[super layoutSubviews];
@@ -264,6 +268,8 @@
_wrapperView.bounds = CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height);
_wrapperView.center = CGPointMake(self.bounds.size.width / 2.0, self.bounds.size.height / 2.0);
[self updateWrapperTransform];
TGCameraPreviewView *previewView = _previewView;
if (previewView.superview == _wrapperView)
previewView.frame = self.bounds;