mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Various fixes
This commit is contained in:
@@ -3112,10 +3112,13 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
}
|
||||
self.entitiesView.canInteract = { [weak self] in
|
||||
if let self, let controller = self.controller {
|
||||
return !controller.node.recording.isActive
|
||||
} else {
|
||||
return true
|
||||
if controller.node.recording.isActive {
|
||||
return false
|
||||
} else if case .avatarEditor = controller.mode, self.drawingScreen == nil {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
self.availableReactionsDisposable = (allowedStoryReactions(context: controller.context)
|
||||
@@ -3252,11 +3255,12 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
if let mediaEntityView = self.entitiesView.add(mediaEntity, announce: false) as? DrawingMediaEntityView {
|
||||
self.entitiesView.sendSubviewToBack(mediaEntityView)
|
||||
mediaEntityView.updated = { [weak self, weak mediaEntity] in
|
||||
if let self, let mediaEntity {
|
||||
if let self, let mediaEditor = self.mediaEditor, let mediaEntity {
|
||||
let rotation = mediaEntity.rotation - initialRotation
|
||||
let position = CGPoint(x: mediaEntity.position.x - initialPosition.x, y: mediaEntity.position.y - initialPosition.y)
|
||||
let scale = mediaEntity.scale / initialScale
|
||||
self.mediaEditor?.setCrop(offset: position, scale: scale, rotation: rotation, mirroring: false)
|
||||
let mirroring = mediaEditor.values.cropMirroring
|
||||
mediaEditor.setCrop(offset: position, scale: scale, rotation: rotation, mirroring: mirroring)
|
||||
|
||||
self.updateMaskDrawingView(position: position, scale: scale, rotation: rotation)
|
||||
}
|
||||
@@ -3465,6 +3469,13 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
}
|
||||
return false
|
||||
}) as? DrawingStickerEntityView {
|
||||
#if DEBUG
|
||||
if let data = result.dayImage.pngData() {
|
||||
let path = NSTemporaryDirectory() + "\(Int(Date().timeIntervalSince1970)).png"
|
||||
try? data.write(to: URL(fileURLWithPath: path))
|
||||
}
|
||||
#endif
|
||||
|
||||
existingEntityView.isNightTheme = isNightTheme
|
||||
let messageEntity = existingEntityView.entity as! DrawingStickerEntity
|
||||
messageEntity.renderImage = result.dayImage
|
||||
@@ -5613,6 +5624,8 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
self.previousDrawingData = self.drawingView.drawingData
|
||||
self.previousDrawingEntities = self.entitiesView.entities
|
||||
|
||||
self.cropScrollView?.isUserInteractionEnabled = false
|
||||
|
||||
self.interaction?.deactivate()
|
||||
let controller = DrawingScreen(
|
||||
context: self.context,
|
||||
@@ -5668,6 +5681,8 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
|
||||
self.previousDrawingData = nil
|
||||
self.previousDrawingEntities = nil
|
||||
|
||||
self.cropScrollView?.isUserInteractionEnabled = true
|
||||
}
|
||||
controller.requestApply = { [weak controller, weak self] in
|
||||
guard let self else {
|
||||
@@ -5690,6 +5705,8 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
|
||||
self.interaction?.activate()
|
||||
self.entitiesView.selectEntity(nil)
|
||||
|
||||
self.cropScrollView?.isUserInteractionEnabled = true
|
||||
}
|
||||
self.controller?.present(controller, in: .current)
|
||||
self.animateOutToTool(tool: mode)
|
||||
@@ -7594,6 +7611,13 @@ public final class MediaEditorScreenImpl: ViewController, MediaEditorScreen, UID
|
||||
let values = mediaEditor.values.withUpdatedCoverDimensions(dimensions)
|
||||
makeEditorImageComposition(context: self.node.ciContext, postbox: self.context.account.postbox, inputImage: image, dimensions: storyDimensions, outputDimensions: dimensions.aspectFitted(CGSize(width: 1080, height: 1080)), values: values, time: .zero, textScale: 2.0, completion: { [weak self] resultImage in
|
||||
if let self, let resultImage {
|
||||
#if DEBUG
|
||||
if let data = resultImage.jpegData(compressionQuality: 0.7) {
|
||||
let path = NSTemporaryDirectory() + "\(Int(Date().timeIntervalSince1970)).jpg"
|
||||
try? data.write(to: URL(fileURLWithPath: path))
|
||||
}
|
||||
#endif
|
||||
|
||||
self.completion(MediaEditorScreenImpl.Result(media: .image(image: resultImage, dimensions: PixelDimensions(resultImage.size))), { [weak self] finished in
|
||||
self?.node.animateOut(finished: true, saveDraft: false, completion: { [weak self] in
|
||||
self?.dismiss()
|
||||
|
||||
Reference in New Issue
Block a user