Video avatar fixes

This commit is contained in:
Ilya Laktyushin 2020-07-03 14:00:58 +03:00
parent bb8595a0ee
commit ee407ca0e2
4 changed files with 9 additions and 3 deletions

View File

@ -86,7 +86,6 @@ const CGFloat TGPhotoAvatarCropViewCurtainMargin = 200;
_fullPaintingView = fullPaintingView;
_fullPaintingView.frame = _fullPreviewView.frame;
_fullPaintingView.transform = CGAffineTransformMakeScale(self.cropMirrored ? -1.0 : 1.0, 1.0);
[_wrapperView addSubview:_fullPreviewView];
[_wrapperView addSubview:_fullPaintingView];
@ -458,7 +457,6 @@ const CGFloat TGPhotoAvatarCropViewCurtainMargin = 200;
CGSize fittedSize = TGScaleToSize(_originalSize, CGSizeMake(1024, 1024));
CGFloat scale = _imageView.bounds.size.width / fittedSize.width;
_fullPreviewView.transform = CGAffineTransformMakeScale(self.cropMirrored ? -scale : scale, scale);
_fullPaintingView.transform = CGAffineTransformMakeScale(self.cropMirrored ? -1.0 : 1.0, 1.0);
}
- (void)invalidateCropRect

View File

@ -332,6 +332,8 @@
[self updatePreviewView:true];
if ([self presentedForAvatarCreation]) {
_previewView.applyMirror = true;
CGSize fittedSize = TGScaleToSize(_photoEditor.originalSize, CGSizeMake(1024, 1024));
_fullPreviewView = [[PGPhotoEditorView alloc] initWithFrame:CGRectMake(0, 0, fittedSize.width, fittedSize.height)];
_photoEditor.additionalOutputs = @[_fullPreviewView];
@ -1223,6 +1225,7 @@
{
case TGPhotoEditorCropTab:
{
_fullPaintingView.hidden = false;
[self updatePreviewView:true];
__block UIView *initialBackgroundView = nil;
@ -1452,6 +1455,7 @@
case TGPhotoEditorPaintTab:
{
_fullPaintingView.hidden = true;
TGPhotoPaintController *paintController = [[TGPhotoPaintController alloc] initWithContext:_context photoEditor:_photoEditor previewView:_previewView];
paintController.stickersContext = _stickersContext;
paintController.toolbarLandscapeSize = TGPhotoEditorToolbarSize;

View File

@ -13,6 +13,9 @@
@property (nonatomic, copy) void(^touchedUp)(void);
@property (nonatomic, copy) void(^interactionEnded)(void);
@property (nonatomic, readonly) bool applyMirror;
@property (nonatomic, readonly) bool isTracking;
@property (nonatomic, assign) bool customTouchDownHandling;

View File

@ -286,7 +286,8 @@
}
CGFloat rotation = TGRotationForOrientation(_cropOrientation);
_paintingContainerView.transform = CGAffineTransformMakeRotation(rotation);
CGAffineTransform transform = CGAffineTransformMakeScale(_cropMirrored && self.applyMirror ? -1.0 : 1.0, 1.0);
_paintingContainerView.transform = CGAffineTransformRotate(transform, rotation);
_paintingContainerView.frame = self.bounds;
CGFloat width = TGOrientationIsSideward(_cropOrientation, NULL) ? self.bounds.size.height : self.bounds.size.width;