Various fixes

This commit is contained in:
Ilya Laktyushin 2022-12-04 15:22:44 +04:00
parent 02e06779ef
commit 71e396f0b6
3 changed files with 8 additions and 17 deletions

View File

@ -675,13 +675,14 @@ public final class DrawingView: UIView, UIGestureRecognizerDelegate, TGPhotoDraw
} }
private func prepareNewElement() -> DrawingElement? { private func prepareNewElement() -> DrawingElement? {
let scale = 1.0 / self.zoomScale
let element: DrawingElement? let element: DrawingElement?
switch self.tool { switch self.tool {
case .pen: case .pen:
let penTool = PenTool( let penTool = PenTool(
drawingSize: self.imageSize, drawingSize: self.imageSize,
color: self.toolColor, color: self.toolColor,
lineWidth: self.toolBrushSize, lineWidth: self.toolBrushSize * scale,
arrow: self.toolHasArrow arrow: self.toolHasArrow
) )
element = penTool element = penTool
@ -689,7 +690,7 @@ public final class DrawingView: UIView, UIGestureRecognizerDelegate, TGPhotoDraw
let markerTool = MarkerTool( let markerTool = MarkerTool(
drawingSize: self.imageSize, drawingSize: self.imageSize,
color: self.toolColor, color: self.toolColor,
lineWidth: self.toolBrushSize, lineWidth: self.toolBrushSize * scale,
arrow: self.toolHasArrow arrow: self.toolHasArrow
) )
markerTool.metalView = self.metalView markerTool.metalView = self.metalView
@ -698,14 +699,14 @@ public final class DrawingView: UIView, UIGestureRecognizerDelegate, TGPhotoDraw
element = NeonTool( element = NeonTool(
drawingSize: self.imageSize, drawingSize: self.imageSize,
color: self.toolColor, color: self.toolColor,
lineWidth: self.toolBrushSize, lineWidth: self.toolBrushSize * scale,
arrow: self.toolHasArrow arrow: self.toolHasArrow
) )
case .pencil: case .pencil:
let pencilTool = PencilTool( let pencilTool = PencilTool(
drawingSize: self.imageSize, drawingSize: self.imageSize,
color: self.toolColor, color: self.toolColor,
lineWidth: self.toolBrushSize, lineWidth: self.toolBrushSize * scale,
arrow: self.toolHasArrow arrow: self.toolHasArrow
) )
pencilTool.metalView = self.metalView pencilTool.metalView = self.metalView
@ -714,7 +715,7 @@ public final class DrawingView: UIView, UIGestureRecognizerDelegate, TGPhotoDraw
let blurTool = BlurTool( let blurTool = BlurTool(
drawingSize: self.imageSize, drawingSize: self.imageSize,
color: self.toolColor, color: self.toolColor,
lineWidth: self.toolBrushSize, lineWidth: self.toolBrushSize * scale,
arrow: false) arrow: false)
blurTool.getFullImage = { [weak self] in blurTool.getFullImage = { [weak self] in
return self?.preparredEraserImage return self?.preparredEraserImage
@ -724,7 +725,7 @@ public final class DrawingView: UIView, UIGestureRecognizerDelegate, TGPhotoDraw
let eraserTool = EraserTool( let eraserTool = EraserTool(
drawingSize: self.imageSize, drawingSize: self.imageSize,
color: self.toolColor, color: self.toolColor,
lineWidth: self.toolBrushSize, lineWidth: self.toolBrushSize * scale,
arrow: false) arrow: false)
eraserTool.getFullImage = { [weak self] in eraserTool.getFullImage = { [weak self] in
return self?.preparredEraserImage return self?.preparredEraserImage

View File

@ -218,16 +218,6 @@
[self.view setNeedsLayout]; [self.view setNeedsLayout];
} }
- (void)viewDidLoad
{
[super viewDidLoad];
// PGPhotoEditor *photoEditor = _photoEditor;
// if (!_skipEntitiesSetup) {
// [_entitiesView setupWithPaintingData:photoEditor.paintingData];
// }
}
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
{ {
[super viewDidAppear:animated]; [super viewDidAppear:animated];

View File

@ -54,7 +54,7 @@
const CGFloat TGPhotoPaintTopPanelSize = 44.0f; const CGFloat TGPhotoPaintTopPanelSize = 44.0f;
const CGFloat TGPhotoPaintBottomPanelSize = 79.0f; const CGFloat TGPhotoPaintBottomPanelSize = 79.0f;
const CGSize TGPhotoPaintingLightMaxSize = { 1280.0f, 1280.0f }; const CGSize TGPhotoPaintingLightMaxSize = { 1280.0f, 1280.0f };
const CGSize TGPhotoPaintingMaxSize = { 1920.0f, 1920.0f }; const CGSize TGPhotoPaintingMaxSize = { 2560.0f, 2560.0f };
const CGFloat TGPhotoPaintStickerKeyboardSize = 260.0f; const CGFloat TGPhotoPaintStickerKeyboardSize = 260.0f;