Various fixes

This commit is contained in:
Ilya Laktyushin 2022-12-19 13:35:23 +04:00
parent 76cf224611
commit 8d87d569a7
2 changed files with 9 additions and 9 deletions

View File

@ -697,6 +697,8 @@ final class DrawingTextEntityView: DrawingEntityView, UITextViewDelegate {
func getRenderSubEntities() -> [DrawingStickerEntity] { func getRenderSubEntities() -> [DrawingStickerEntity] {
let textSize = self.textView.bounds.size let textSize = self.textView.bounds.size
let textPosition = self.textEntity.position let textPosition = self.textEntity.position
let scale = self.textEntity.scale
let rotation = self.textEntity.rotation
let itemSize: CGFloat = floor(24.0 * self.displayFontSize * 0.8 / 17.0) let itemSize: CGFloat = floor(24.0 * self.displayFontSize * 0.8 / 17.0)
@ -709,10 +711,12 @@ final class DrawingTextEntityView: DrawingEntityView, UITextViewDelegate {
let entity = DrawingStickerEntity(file: file) let entity = DrawingStickerEntity(file: file)
entity.referenceDrawingSize = CGSize(width: itemSize * 2.5, height: itemSize * 2.5) entity.referenceDrawingSize = CGSize(width: itemSize * 2.5, height: itemSize * 2.5)
entity.scale = self.textEntity.scale entity.scale = scale
entity.position = textPosition.offsetBy(dx: emojiTextPosition.x, dy: emojiTextPosition.y) entity.position = textPosition.offsetBy(
entity.rotation = self.textEntity.rotation dx: (emojiTextPosition.x * cos(rotation) + emojiTextPosition.y * sin(rotation)) * scale,
dy: (emojiTextPosition.y * cos(rotation) + emojiTextPosition.x * sin(rotation)) * scale
)
entity.rotation = rotation
entities.append(entity) entities.append(entity)
} }
return entities return entities

View File

@ -123,7 +123,7 @@ final class PenTool: DrawingElement {
self.renderLineWidth = lineWidth self.renderLineWidth = lineWidth
self.renderArrowLength = lineWidth * 3.0 self.renderArrowLength = lineWidth * 3.0
self.renderArrowLineWidth = lineWidth self.renderArrowLineWidth = lineWidth * 0.8
self.renderLine = StrokeLine(color: color.toUIColor(), minLineWidth: minLineWidth + (lineWidth - minLineWidth) * 0.3, lineWidth: lineWidth) self.renderLine = StrokeLine(color: color.toUIColor(), minLineWidth: minLineWidth + (lineWidth - minLineWidth) * 0.3, lineWidth: lineWidth)
} }
@ -162,10 +162,6 @@ final class PenTool: DrawingElement {
if let previousPoint, point.location.distance(to: previousPoint) < filterDistance, state == .changed, self.renderLine.ready { if let previousPoint, point.location.distance(to: previousPoint) < filterDistance, state == .changed, self.renderLine.ready {
return return
} }
print("vel: \(point.velocity)")
if let previousPoint {
print("dist: \(point.location.distance(to: previousPoint))")
}
self.previousPoint = point.location self.previousPoint = point.location
let rect = self.renderLine.draw(at: point) let rect = self.renderLine.draw(at: point)