mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Various fixes
This commit is contained in:
@@ -301,10 +301,16 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
return CGSize(width: width, height: width)
|
||||
}
|
||||
|
||||
public func prepareNewEntity(_ entity: DrawingEntity, setup: Bool = true, relativeTo: DrawingEntity? = nil) {
|
||||
let center = self.startPosition(relativeTo: relativeTo, onlyVertical: entity is DrawingTextEntity)
|
||||
public func prepareNewEntity(_ entity: DrawingEntity, setup: Bool = true, relativeTo: DrawingEntity? = nil, scale: CGFloat? = nil, position: CGPoint? = nil) {
|
||||
var center = self.startPosition(relativeTo: relativeTo, onlyVertical: entity is DrawingTextEntity)
|
||||
if let position {
|
||||
center = position
|
||||
}
|
||||
let rotation = self.getEntityInitialRotation()
|
||||
let zoomScale = 1.0 / (self.drawingView?.zoomScale ?? 1.0)
|
||||
var zoomScale = 1.0 / (self.drawingView?.zoomScale ?? 1.0)
|
||||
if let scale {
|
||||
zoomScale = scale
|
||||
}
|
||||
|
||||
if let shape = entity as? DrawingSimpleShapeEntity {
|
||||
shape.position = center
|
||||
@@ -357,7 +363,7 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
if setup {
|
||||
location.rotation = rotation
|
||||
location.referenceDrawingSize = self.size
|
||||
location.width = floor(self.size.width * 0.9)
|
||||
location.width = floor(self.size.width * 0.85)
|
||||
location.scale = zoomScale
|
||||
}
|
||||
}
|
||||
@@ -471,7 +477,7 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
|
||||
return newEntity
|
||||
}
|
||||
|
||||
func remove(uuid: UUID, animated: Bool = false, announce: Bool = true) {
|
||||
public func remove(uuid: UUID, animated: Bool = false, announce: Bool = true) {
|
||||
if let view = self.getView(for: uuid) {
|
||||
if self.selectedEntityView === view {
|
||||
self.selectedEntityView = nil
|
||||
|
||||
Reference in New Issue
Block a user