Various improvements

This commit is contained in:
Ilya Laktyushin
2023-08-24 17:56:41 +04:00
parent b53be04a2e
commit 55411b1d06
32 changed files with 1686 additions and 199 deletions

View File

@@ -7,6 +7,7 @@ import AccountContext
import MediaEditor
import ComponentFlow
import LottieAnimationComponent
import ReactionSelectionNode
public func decodeDrawingEntities(data: Data) -> [DrawingEntity] {
if let codableEntities = try? JSONDecoder().decode([CodableDrawingEntity].self, from: data) {
@@ -36,6 +37,9 @@ private func makeEntityView(context: AccountContext, entity: DrawingEntity) -> D
}
private func prepareForRendering(entityView: DrawingEntityView) {
if let entityView = entityView as? DrawingStickerEntityView {
entityView.entity.renderImage = entityView.getRenderImage()
}
if let entityView = entityView as? DrawingBubbleEntityView {
entityView.entity.renderImage = entityView.getRenderImage()
}
@@ -70,6 +74,8 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
public var getEntityInitialRotation: () -> CGFloat = { return 0.0 }
public var getEntityAdditionalScale: () -> CGFloat = { return 1.0 }
public var getAvailableReactions: () -> [ReactionItem] = { return [] }
public var hasSelectionChanged: (Bool) -> Void = { _ in }
var selectionChanged: (DrawingEntity?) -> Void = { _ in }
var requestedMenuForEntityView: (DrawingEntityView, Bool) -> Void = { _, _ in }
@@ -654,6 +660,8 @@ public final class DrawingEntitiesView: UIView, TGPhotoDrawingEntitiesView {
} else {
return
}
} else if let stickerEntityView = selectedEntityView as? DrawingStickerEntityView {
stickerEntityView.onDeselection()
}
self.selectedEntityView = nil