mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various improvements
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user