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

View File

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

View File

@ -54,7 +54,7 @@
const CGFloat TGPhotoPaintTopPanelSize = 44.0f;
const CGFloat TGPhotoPaintBottomPanelSize = 79.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;