mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-29 03:21:29 +00:00
Video avatar fixes
This commit is contained in:
parent
4e563ce105
commit
71fc6c67d6
@ -1155,6 +1155,10 @@
|
|||||||
{
|
{
|
||||||
[currentController removeFromParentViewController];
|
[currentController removeFromParentViewController];
|
||||||
[currentController.view removeFromSuperview];
|
[currentController.view removeFromSuperview];
|
||||||
|
|
||||||
|
if ([self presentedForAvatarCreation] && tab == TGPhotoEditorCropTab) {
|
||||||
|
_previewView.transform = CGAffineTransformIdentity;
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
|
|
||||||
transitionReferenceFrame = [currentController transitionOutReferenceFrame];
|
transitionReferenceFrame = [currentController transitionOutReferenceFrame];
|
||||||
@ -1343,8 +1347,8 @@
|
|||||||
if (strongSelf == nil)
|
if (strongSelf == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (strongSelf->_currentTabController.finishedTransitionIn != nil)
|
strongSelf->_fullPaintingView.hidden = true;
|
||||||
{
|
if (strongSelf->_currentTabController.finishedTransitionIn != nil) {
|
||||||
strongSelf->_currentTabController.finishedTransitionIn();
|
strongSelf->_currentTabController.finishedTransitionIn();
|
||||||
strongSelf->_currentTabController.finishedTransitionIn = nil;
|
strongSelf->_currentTabController.finishedTransitionIn = nil;
|
||||||
}
|
}
|
||||||
@ -1455,7 +1459,6 @@
|
|||||||
|
|
||||||
case TGPhotoEditorPaintTab:
|
case TGPhotoEditorPaintTab:
|
||||||
{
|
{
|
||||||
_fullPaintingView.hidden = true;
|
|
||||||
TGPhotoPaintController *paintController = [[TGPhotoPaintController alloc] initWithContext:_context photoEditor:_photoEditor previewView:_previewView];
|
TGPhotoPaintController *paintController = [[TGPhotoPaintController alloc] initWithContext:_context photoEditor:_photoEditor previewView:_previewView];
|
||||||
paintController.stickersContext = _stickersContext;
|
paintController.stickersContext = _stickersContext;
|
||||||
paintController.toolbarLandscapeSize = TGPhotoEditorToolbarSize;
|
paintController.toolbarLandscapeSize = TGPhotoEditorToolbarSize;
|
||||||
|
|||||||
@ -431,68 +431,70 @@ const CGFloat TGPhotoPaintStickerKeyboardSize = 260.0f;
|
|||||||
|
|
||||||
- (void)setupCanvas
|
- (void)setupCanvas
|
||||||
{
|
{
|
||||||
__weak TGPhotoPaintController *weakSelf = self;
|
if (_canvasView == nil) {
|
||||||
_canvasView = [[TGPaintCanvas alloc] initWithFrame:CGRectZero];
|
__weak TGPhotoPaintController *weakSelf = self;
|
||||||
_canvasView.pointInsideContainer = ^bool(CGPoint point)
|
_canvasView = [[TGPaintCanvas alloc] initWithFrame:CGRectZero];
|
||||||
{
|
_canvasView.pointInsideContainer = ^bool(CGPoint point)
|
||||||
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
|
||||||
if (strongSelf == nil)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return [strongSelf->_containerView pointInside:[strongSelf->_canvasView convertPoint:point toView:strongSelf->_containerView] withEvent:nil];
|
|
||||||
};
|
|
||||||
_canvasView.shouldDraw = ^bool
|
|
||||||
{
|
|
||||||
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
|
||||||
if (strongSelf == nil)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return ![strongSelf->_entitiesContainerView isTrackingAnyEntityView];
|
|
||||||
};
|
|
||||||
_canvasView.shouldDrawOnSingleTap = ^bool
|
|
||||||
{
|
|
||||||
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
|
||||||
if (strongSelf == nil)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
bool rotating = (strongSelf->_rotationGestureRecognizer.state == UIGestureRecognizerStateBegan || strongSelf->_rotationGestureRecognizer.state == UIGestureRecognizerStateChanged);
|
|
||||||
bool pinching = (strongSelf->_pinchGestureRecognizer.state == UIGestureRecognizerStateBegan || strongSelf->_pinchGestureRecognizer.state == UIGestureRecognizerStateChanged);
|
|
||||||
|
|
||||||
if (strongSelf->_currentEntityView != nil && !rotating && !pinching)
|
|
||||||
{
|
{
|
||||||
[strongSelf selectEntityView:nil];
|
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
||||||
return false;
|
if (strongSelf == nil)
|
||||||
}
|
return false;
|
||||||
|
|
||||||
return true;
|
return [strongSelf->_containerView pointInside:[strongSelf->_canvasView convertPoint:point toView:strongSelf->_containerView] withEvent:nil];
|
||||||
};
|
};
|
||||||
_canvasView.strokeBegan = ^
|
_canvasView.shouldDraw = ^bool
|
||||||
{
|
{
|
||||||
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
||||||
if (strongSelf != nil)
|
if (strongSelf == nil)
|
||||||
[strongSelf selectEntityView:nil];
|
return false;
|
||||||
};
|
|
||||||
_canvasView.strokeCommited = ^
|
return ![strongSelf->_entitiesContainerView isTrackingAnyEntityView];
|
||||||
{
|
};
|
||||||
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
_canvasView.shouldDrawOnSingleTap = ^bool
|
||||||
if (strongSelf != nil)
|
{
|
||||||
[strongSelf updateActionsView];
|
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
||||||
};
|
if (strongSelf == nil)
|
||||||
_canvasView.hitTest = ^UIView *(CGPoint point, UIEvent *event)
|
return false;
|
||||||
{
|
|
||||||
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
bool rotating = (strongSelf->_rotationGestureRecognizer.state == UIGestureRecognizerStateBegan || strongSelf->_rotationGestureRecognizer.state == UIGestureRecognizerStateChanged);
|
||||||
if (strongSelf == nil)
|
bool pinching = (strongSelf->_pinchGestureRecognizer.state == UIGestureRecognizerStateBegan || strongSelf->_pinchGestureRecognizer.state == UIGestureRecognizerStateChanged);
|
||||||
return nil;
|
|
||||||
|
if (strongSelf->_currentEntityView != nil && !rotating && !pinching)
|
||||||
return [strongSelf->_entitiesContainerView hitTest:[strongSelf->_canvasView convertPoint:point toView:strongSelf->_entitiesContainerView] withEvent:event];
|
{
|
||||||
};
|
[strongSelf selectEntityView:nil];
|
||||||
_canvasView.cropRect = _photoEditor.cropRect;
|
return false;
|
||||||
_canvasView.cropOrientation = _photoEditor.cropOrientation;
|
}
|
||||||
_canvasView.originalSize = _photoEditor.originalSize;
|
|
||||||
[_canvasView setPainting:_painting];
|
return true;
|
||||||
[_canvasView setBrush:_brushes.firstObject];
|
};
|
||||||
[self setCurrentSwatch:_portraitSettingsView.swatch sender:nil];
|
_canvasView.strokeBegan = ^
|
||||||
[_paintingWrapperView addSubview:_canvasView];
|
{
|
||||||
|
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
||||||
|
if (strongSelf != nil)
|
||||||
|
[strongSelf selectEntityView:nil];
|
||||||
|
};
|
||||||
|
_canvasView.strokeCommited = ^
|
||||||
|
{
|
||||||
|
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
||||||
|
if (strongSelf != nil)
|
||||||
|
[strongSelf updateActionsView];
|
||||||
|
};
|
||||||
|
_canvasView.hitTest = ^UIView *(CGPoint point, UIEvent *event)
|
||||||
|
{
|
||||||
|
__strong TGPhotoPaintController *strongSelf = weakSelf;
|
||||||
|
if (strongSelf == nil)
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
return [strongSelf->_entitiesContainerView hitTest:[strongSelf->_canvasView convertPoint:point toView:strongSelf->_entitiesContainerView] withEvent:event];
|
||||||
|
};
|
||||||
|
_canvasView.cropRect = _photoEditor.cropRect;
|
||||||
|
_canvasView.cropOrientation = _photoEditor.cropOrientation;
|
||||||
|
_canvasView.originalSize = _photoEditor.originalSize;
|
||||||
|
[_canvasView setPainting:_painting];
|
||||||
|
[_canvasView setBrush:_brushes.firstObject];
|
||||||
|
[self setCurrentSwatch:_portraitSettingsView.swatch sender:nil];
|
||||||
|
[_paintingWrapperView addSubview:_canvasView];
|
||||||
|
}
|
||||||
|
|
||||||
_canvasView.hidden = false;
|
_canvasView.hidden = false;
|
||||||
[self.view setNeedsLayout];
|
[self.view setNeedsLayout];
|
||||||
@ -1801,6 +1803,11 @@ const CGFloat TGPhotoPaintStickerKeyboardSize = 260.0f;
|
|||||||
_portraitSettingsView.layer.shouldRasterize = false;
|
_portraitSettingsView.layer.shouldRasterize = false;
|
||||||
_landscapeSettingsView.layer.shouldRasterize = false;
|
_landscapeSettingsView.layer.shouldRasterize = false;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
if (self.presentedForAvatarCreation) {
|
||||||
|
_canvasView.hidden = true;
|
||||||
|
_entitiesContainerView.hidden = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (CGRect)photoContainerFrameForParentViewFrame:(CGRect)parentViewFrame toolbarLandscapeSize:(CGFloat)toolbarLandscapeSize orientation:(UIInterfaceOrientation)orientation panelSize:(CGFloat)panelSize hasOnScreenNavigation:(bool)hasOnScreenNavigation
|
+ (CGRect)photoContainerFrameForParentViewFrame:(CGRect)parentViewFrame toolbarLandscapeSize:(CGFloat)toolbarLandscapeSize orientation:(UIInterfaceOrientation)orientation panelSize:(CGFloat)panelSize hasOnScreenNavigation:(bool)hasOnScreenNavigation
|
||||||
@ -1847,6 +1854,7 @@ const CGFloat TGPhotoPaintStickerKeyboardSize = 260.0f;
|
|||||||
}
|
}
|
||||||
|
|
||||||
[self setupCanvas];
|
[self setupCanvas];
|
||||||
|
_entitiesContainerView.hidden = false;
|
||||||
|
|
||||||
TGPhotoEditorPreviewView *previewView = _previewView;
|
TGPhotoEditorPreviewView *previewView = _previewView;
|
||||||
[previewView setPaintingHidden:true];
|
[previewView setPaintingHidden:true];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user