mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge commit 'e7c717867c4222ab97e237daa4a822900cb31696'
This commit is contained in:
commit
c9772c5fd7
@ -398,6 +398,7 @@ public final class DrawingView: UIView, UIGestureRecognizerDelegate, UIPencilInt
|
|||||||
|
|
||||||
if let context = DrawingContext(size: image.size, scale: 1.0, opaque: false) {
|
if let context = DrawingContext(size: image.size, scale: 1.0, opaque: false) {
|
||||||
context.withFlippedContext { context in
|
context.withFlippedContext { context in
|
||||||
|
context.clear(CGRect(origin: .zero, size: image.size))
|
||||||
if let cgImage = image.cgImage {
|
if let cgImage = image.cgImage {
|
||||||
context.draw(cgImage, in: CGRect(origin: .zero, size: image.size))
|
context.draw(cgImage, in: CGRect(origin: .zero, size: image.size))
|
||||||
}
|
}
|
||||||
|
@ -811,7 +811,12 @@ public class PremiumLimitsListScreen: ViewController {
|
|||||||
let bottomInset: CGFloat = layout.intrinsicInsets.bottom > 0.0 ? layout.intrinsicInsets.bottom + 5.0 : bottomPanelPadding
|
let bottomInset: CGFloat = layout.intrinsicInsets.bottom > 0.0 ? layout.intrinsicInsets.bottom + 5.0 : bottomPanelPadding
|
||||||
let panelHeight: CGFloat = bottomPanelPadding + 50.0 + bottomInset + 28.0
|
let panelHeight: CGFloat = bottomPanelPadding + 50.0 + bottomInset + 28.0
|
||||||
|
|
||||||
return layout.size.height - layout.size.width - 178.0 - panelHeight
|
var additionalInset: CGFloat = 0.0
|
||||||
|
if let order = self.controller?.order, order.count == 1 {
|
||||||
|
additionalInset = 20.0
|
||||||
|
}
|
||||||
|
|
||||||
|
return layout.size.height - layout.size.width - 178.0 - panelHeight + additionalInset
|
||||||
} else {
|
} else {
|
||||||
return 210.0
|
return 210.0
|
||||||
}
|
}
|
||||||
|
@ -1852,6 +1852,21 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
|
|
||||||
self.entitiesView.add(mediaEntity, announce: false)
|
self.entitiesView.add(mediaEntity, announce: false)
|
||||||
|
|
||||||
|
let initialValues: MediaEditorValues?
|
||||||
|
if case let .draft(draft, _) = subject {
|
||||||
|
initialValues = draft.values
|
||||||
|
|
||||||
|
for entity in draft.values.entities {
|
||||||
|
self.entitiesView.add(entity.entity, announce: false)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let drawingData = initialValues?.drawing?.pngData() {
|
||||||
|
self.drawingView.setup(withDrawing: drawingData)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
initialValues = nil
|
||||||
|
}
|
||||||
|
|
||||||
if let entityView = self.entitiesView.getView(for: mediaEntity.uuid) as? DrawingMediaEntityView {
|
if let entityView = self.entitiesView.getView(for: mediaEntity.uuid) as? DrawingMediaEntityView {
|
||||||
self.entitiesView.sendSubviewToBack(entityView)
|
self.entitiesView.sendSubviewToBack(entityView)
|
||||||
entityView.previewView = self.previewView
|
entityView.previewView = self.previewView
|
||||||
@ -1863,18 +1878,14 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
self.mediaEditor?.setCrop(offset: positionDelta, scale: scaleDelta, rotation: rotationDelta, mirroring: false)
|
self.mediaEditor?.setCrop(offset: positionDelta, scale: scaleDelta, rotation: rotationDelta, mirroring: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let initialValues {
|
||||||
|
mediaEntity.position = mediaEntity.position.offsetBy(dx: initialValues.cropOffset.x, dy: initialValues.cropOffset.y)
|
||||||
|
mediaEntity.rotation = mediaEntity.rotation + initialValues.cropRotation
|
||||||
|
mediaEntity.scale = mediaEntity.scale * initialValues.cropScale
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let initialValues: MediaEditorValues?
|
|
||||||
if case let .draft(draft, _) = subject {
|
|
||||||
initialValues = draft.values
|
|
||||||
|
|
||||||
for entity in draft.values.entities {
|
|
||||||
entitiesView.add(entity.entity, announce: false)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
initialValues = nil
|
|
||||||
}
|
|
||||||
let mediaEditor = MediaEditor(subject: subject.editorSubject, values: initialValues, hasHistogram: true)
|
let mediaEditor = MediaEditor(subject: subject.editorSubject, values: initialValues, hasHistogram: true)
|
||||||
if let initialVideoPosition = self.controller?.initialVideoPosition {
|
if let initialVideoPosition = self.controller?.initialVideoPosition {
|
||||||
mediaEditor.seek(initialVideoPosition, andPlay: true)
|
mediaEditor.seek(initialVideoPosition, andPlay: true)
|
||||||
|
@ -18,6 +18,8 @@ final class StoryItemLoadingEffectView: UIView {
|
|||||||
private let borderContainerView: UIView
|
private let borderContainerView: UIView
|
||||||
private let borderMaskLayer: SimpleShapeLayer
|
private let borderMaskLayer: SimpleShapeLayer
|
||||||
|
|
||||||
|
private var didPlayOnce = false
|
||||||
|
|
||||||
init(effectAlpha: CGFloat, duration: Double, hasBorder: Bool, playOnce: Bool) {
|
init(effectAlpha: CGFloat, duration: Double, hasBorder: Bool, playOnce: Bool) {
|
||||||
self.hierarchyTrackingLayer = HierarchyTrackingLayer()
|
self.hierarchyTrackingLayer = HierarchyTrackingLayer()
|
||||||
|
|
||||||
@ -89,7 +91,7 @@ final class StoryItemLoadingEffectView: UIView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func updateAnimations(size: CGSize) {
|
private func updateAnimations(size: CGSize) {
|
||||||
if self.backgroundView.layer.animation(forKey: "shimmer") != nil {
|
if self.backgroundView.layer.animation(forKey: "shimmer") != nil || (self.playOnce && self.didPlayOnce) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,6 +99,8 @@ final class StoryItemLoadingEffectView: UIView {
|
|||||||
animation.repeatCount = self.playOnce ? 1 : Float.infinity
|
animation.repeatCount = self.playOnce ? 1 : Float.infinity
|
||||||
self.backgroundView.layer.add(animation, forKey: "shimmer")
|
self.backgroundView.layer.add(animation, forKey: "shimmer")
|
||||||
self.borderGradientView.layer.add(animation, forKey: "shimmer")
|
self.borderGradientView.layer.add(animation, forKey: "shimmer")
|
||||||
|
|
||||||
|
self.didPlayOnce = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func update(size: CGSize, transition: Transition) {
|
func update(size: CGSize, transition: Transition) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user