mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Media editor improvements
This commit is contained in:
@@ -3149,13 +3149,27 @@ public final class DrawingToolsInteraction {
|
||||
}
|
||||
#if DEBUG
|
||||
if isRectangleImage {
|
||||
actions.append(ContextMenuAction(content: .text(title: "Cut Out", accessibilityLabel: "Cut Out"), action: { [weak self, weak entityView] in
|
||||
actions.append(ContextMenuAction(content: .text(title: presentationData.strings.Paint_CutOut, accessibilityLabel: presentationData.strings.Paint_CutOut), action: { [weak self, weak entityView] in
|
||||
if let self, let entityView, let entity = entityView.entity as? DrawingStickerEntity, case let .image(image, _) = entity.content {
|
||||
let _ = (cutoutStickerImage(from: image)
|
||||
|> deliverOnMainQueue).start(next: { result in
|
||||
if let result {
|
||||
|> deliverOnMainQueue).start(next: { [weak entity] result in
|
||||
if let result, let entity {
|
||||
let newEntity = DrawingStickerEntity(content: .image(result, .sticker))
|
||||
self.insertEntity(newEntity)
|
||||
newEntity.referenceDrawingSize = entity.referenceDrawingSize
|
||||
newEntity.scale = entity.scale
|
||||
newEntity.position = entity.position
|
||||
newEntity.rotation = entity.rotation
|
||||
newEntity.mirrored = entity.mirrored
|
||||
let newEntityView = self.entitiesView.add(newEntity)
|
||||
|
||||
if let newEntityView = newEntityView as? DrawingStickerEntityView {
|
||||
newEntityView.playCutoffAnimation()
|
||||
}
|
||||
self.entitiesView.selectEntity(newEntity, animate: false)
|
||||
if let entityView = entityView as? DrawingStickerEntityView {
|
||||
entityView.playDissolveAnimation()
|
||||
self.entitiesView.remove(uuid: entity.uuid, animated: false)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -3198,6 +3212,11 @@ public final class DrawingToolsInteraction {
|
||||
self.insertEntity(DrawingStickerEntity(content: .image(image, isSticker ? .sticker : .rectangle)), scale: 2.5)
|
||||
}
|
||||
}
|
||||
textEntityView.replaceWithAnimatedImage = { [weak self] data, thumbnailImage in
|
||||
if let self {
|
||||
self.insertEntity(DrawingStickerEntity(content: .animatedImage(data, thumbnailImage)), scale: 2.5)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if self.isVideo {
|
||||
entityView.seek(to: 0.0)
|
||||
|
||||
Reference in New Issue
Block a user