Video avatar fixes

This commit is contained in:
Ilya Laktyushin 2020-07-16 23:17:32 +03:00
parent 0e2443a540
commit d07c24be2e
2 changed files with 17 additions and 2 deletions

View File

@ -1178,13 +1178,18 @@
[self savePaintingData];
bool resetTransform = false;
if ([self presentedForAvatarCreation] && tab == TGPhotoEditorCropTab && [currentController isKindOfClass:[TGPhotoPaintController class]]) {
resetTransform = true;
}
currentController.switchingToTab = tab;
[currentController transitionOutSwitching:true completion:^
{
[currentController removeFromParentViewController];
[currentController.view removeFromSuperview];
if ([self presentedForAvatarCreation] && tab == TGPhotoEditorCropTab) {
if (resetTransform) {
_previewView.transform = CGAffineTransformIdentity;
}
}];

View File

@ -35,6 +35,7 @@ const CGFloat TGPhotoEditorToolsLandscapePanelSize = TGPhotoEditorToolsPanelSize
bool _appeared;
bool _scheduledTransitionIn;
CGFloat _cellWidth;
int _entitiesReady;
NSArray *_allTools;
NSArray *_simpleTools;
@ -107,7 +108,12 @@ const CGFloat TGPhotoEditorToolsLandscapePanelSize = TGPhotoEditorToolsPanelSize
}
- (void)layoutEntitiesView {
if (_entitiesReady < 2 || _dismissing)
return;
_entitiesWrapperView.transform = CGAffineTransformIdentity;
_entitiesWrapperView.frame = CGRectMake(0.0, 0.0, _entitiesView.frame.size.width, _entitiesView.frame.size.height);
[_entitiesWrapperView addSubview:_entitiesView];
CGFloat paintingScale = _entitiesView.frame.size.width / _photoEditor.originalSize.width;
_entitiesView.frame = CGRectMake(-_photoEditor.cropRect.origin.x * paintingScale, -_photoEditor.cropRect.origin.y * paintingScale, _entitiesView.frame.size.width, _entitiesView.frame.size.height);
@ -121,7 +127,8 @@ const CGFloat TGPhotoEditorToolsLandscapePanelSize = TGPhotoEditorToolsPanelSize
CGFloat scale = _previewView.frame.size.width / _entitiesView.frame.size.width;
_entitiesWrapperView.transform = CGAffineTransformMakeScale(scale * cropScale, scale * cropScale);
_entitiesWrapperView.frame = CGRectMake(0.0, 0.0, _previewView.frame.size.width, _previewView.frame.size.height);
_entitiesWrapperView.frame = [_previewView convertRect:_previewView.bounds toView:_entitiesWrapperView.superview];
}
- (void)loadView
@ -502,6 +509,9 @@ const CGFloat TGPhotoEditorToolsLandscapePanelSize = TGPhotoEditorToolsPanelSize
TGPhotoEditorPreviewView *previewView = _previewView;
previewView.hidden = false;
[previewView performTransitionInIfNeeded];
_entitiesReady++;
[self layoutEntitiesView];
}
- (void)prepareForCustomTransitionOut