mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 11:20:18 +00:00
Various fixes
This commit is contained in:
parent
dd21063493
commit
59940ae1ba
@ -149,6 +149,7 @@ public final class DrawingStickerEntityView: DrawingEntityView {
|
|||||||
if file.isAnimatedSticker || file.isVideoSticker || file.mimeType == "video/webm" {
|
if file.isAnimatedSticker || file.isVideoSticker || file.mimeType == "video/webm" {
|
||||||
if self.animationNode == nil {
|
if self.animationNode == nil {
|
||||||
let animationNode = DefaultAnimatedStickerNodeImpl()
|
let animationNode = DefaultAnimatedStickerNodeImpl()
|
||||||
|
animationNode.clipsToBounds = true
|
||||||
animationNode.autoplay = false
|
animationNode.autoplay = false
|
||||||
self.animationNode = animationNode
|
self.animationNode = animationNode
|
||||||
animationNode.started = { [weak self, weak animationNode] in
|
animationNode.started = { [weak self, weak animationNode] in
|
||||||
@ -354,7 +355,7 @@ public final class DrawingStickerEntityView: DrawingEntityView {
|
|||||||
self.imageNode.frame = imageFrame
|
self.imageNode.frame = imageFrame
|
||||||
if let animationNode = self.animationNode {
|
if let animationNode = self.animationNode {
|
||||||
if self.isReaction {
|
if self.isReaction {
|
||||||
animationNode.cornerRadius = floor(imageSize.width * 0.03)
|
animationNode.cornerRadius = floor(imageSize.width * 0.1)
|
||||||
}
|
}
|
||||||
animationNode.frame = imageFrame
|
animationNode.frame = imageFrame
|
||||||
animationNode.updateLayout(size: imageSize)
|
animationNode.updateLayout(size: imageSize)
|
||||||
|
|||||||
@ -1120,6 +1120,9 @@ public extension MediaEditorValues {
|
|||||||
if !self.entities.isEmpty {
|
if !self.entities.isEmpty {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if self.additionalVideoPath != nil {
|
||||||
|
return true
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -483,7 +483,7 @@ public final class MediaEditorVideoExport {
|
|||||||
kCVPixelBufferMetalCompatibilityKey as String: true,
|
kCVPixelBufferMetalCompatibilityKey as String: true,
|
||||||
AVVideoColorPropertiesKey: colorProperties
|
AVVideoColorPropertiesKey: colorProperties
|
||||||
]
|
]
|
||||||
if !"".isEmpty, let videoTrack = videoTracks.first, videoTrack.preferredTransform.isIdentity && !self.configuration.values.requiresComposing && additionalAsset == nil {
|
if let videoTrack = videoTracks.first, videoTrack.preferredTransform.isIdentity && !self.configuration.values.requiresComposing {
|
||||||
} else {
|
} else {
|
||||||
self.setupComposer()
|
self.setupComposer()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3461,6 +3461,8 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
|
|||||||
let stickerEntity = DrawingStickerEntity(content: .file(reaction.stillAnimation, .reaction(.builtin(heart), .white)))
|
let stickerEntity = DrawingStickerEntity(content: .file(reaction.stillAnimation, .reaction(.builtin(heart), .white)))
|
||||||
self.interaction?.insertEntity(stickerEntity, scale: 1.175)
|
self.interaction?.insertEntity(stickerEntity, scale: 1.175)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.mediaEditor?.play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.stickerScreen = controller
|
self.stickerScreen = controller
|
||||||
|
|||||||
@ -336,7 +336,8 @@ final class VideoScrubberComponent: Component {
|
|||||||
let location = gestureRecognizer.location(in: self.audioContainerView)
|
let location = gestureRecognizer.location(in: self.audioContainerView)
|
||||||
return self.audioContainerView.bounds.contains(location)
|
return self.audioContainerView.bounds.contains(location)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ignoreScrollUpdates = false
|
||||||
private func updateAudioOffset(done: Bool) {
|
private func updateAudioOffset(done: Bool) {
|
||||||
guard self.audioScrollView.contentSize.width > 0.0, let component = self.component, let duration = self.component?.audioData?.duration else {
|
guard self.audioScrollView.contentSize.width > 0.0, let component = self.component, let duration = self.component?.audioData?.duration else {
|
||||||
return
|
return
|
||||||
@ -353,6 +354,9 @@ final class VideoScrubberComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||||
|
guard !self.ignoreScrollUpdates else {
|
||||||
|
return
|
||||||
|
}
|
||||||
self.updateAudioOffset(done: false)
|
self.updateAudioOffset(done: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -490,8 +494,12 @@ final class VideoScrubberComponent: Component {
|
|||||||
var trimDuration = component.duration
|
var trimDuration = component.duration
|
||||||
|
|
||||||
var isFirstTime = false
|
var isFirstTime = false
|
||||||
|
var audioChanged = false
|
||||||
var animateAudioAppearance = false
|
var animateAudioAppearance = false
|
||||||
if let previousComponent {
|
if let previousComponent {
|
||||||
|
if let previousAudioData = previousComponent.audioData, previousAudioData.title != component.audioData?.title {
|
||||||
|
audioChanged = true
|
||||||
|
}
|
||||||
if previousComponent.audioData == nil, component.audioData != nil {
|
if previousComponent.audioData == nil, component.audioData != nil {
|
||||||
self.positionAnimation = nil
|
self.positionAnimation = nil
|
||||||
animateAudioAppearance = true
|
animateAudioAppearance = true
|
||||||
@ -588,12 +596,20 @@ final class VideoScrubberComponent: Component {
|
|||||||
|
|
||||||
self.audioScrollView.isUserInteractionEnabled = self.isAudioSelected || component.audioOnly
|
self.audioScrollView.isUserInteractionEnabled = self.isAudioSelected || component.audioOnly
|
||||||
audioTransition.setFrame(view: self.audioScrollView, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: availableSize.width, height: audioScrubberHeight)))
|
audioTransition.setFrame(view: self.audioScrollView, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: availableSize.width, height: audioScrubberHeight)))
|
||||||
self.audioScrollView.contentSize = CGSize(width: audioTotalWidth, height: audioScrubberHeight)
|
|
||||||
|
let contentSize = CGSize(width: audioTotalWidth, height: audioScrubberHeight)
|
||||||
|
self.ignoreScrollUpdates = true
|
||||||
|
if self.audioScrollView.contentSize != contentSize {
|
||||||
|
self.audioScrollView.contentSize = contentSize
|
||||||
|
}
|
||||||
|
|
||||||
if isFirstTime, let offset = component.audioData?.offset, let duration = component.audioData?.duration, duration > 0.0 {
|
if isFirstTime, let offset = component.audioData?.offset, let duration = component.audioData?.duration, duration > 0.0 {
|
||||||
let contentOffset = offset * audioTotalWidth / duration
|
let contentOffset = offset * audioTotalWidth / duration
|
||||||
self.audioScrollView.contentOffset = CGPoint(x: contentOffset, y: 0.0)
|
self.audioScrollView.contentOffset = CGPoint(x: contentOffset, y: 0.0)
|
||||||
|
} else if audioChanged {
|
||||||
|
self.audioScrollView.contentOffset = .zero
|
||||||
}
|
}
|
||||||
|
self.ignoreScrollUpdates = false
|
||||||
|
|
||||||
audioTransition.setCornerRadius(layer: self.audioClippingView.layer, cornerRadius: self.isAudioSelected ? 0.0 : 9.0)
|
audioTransition.setCornerRadius(layer: self.audioClippingView.layer, cornerRadius: self.isAudioSelected ? 0.0 : 9.0)
|
||||||
|
|
||||||
|
|||||||
@ -454,6 +454,7 @@ final class StoryItemOverlaysView: UIView {
|
|||||||
placeholderColor: flags.contains(.isDark) ? UIColor(white: 1.0, alpha: 0.1) : UIColor(white: 0.0, alpha: 0.1),
|
placeholderColor: flags.contains(.isDark) ? UIColor(white: 1.0, alpha: 0.1) : UIColor(white: 0.0, alpha: 0.1),
|
||||||
pointSize: CGSize(width: min(256, itemSize.width), height: min(256, itemSize.height))
|
pointSize: CGSize(width: min(256, itemSize.width), height: min(256, itemSize.height))
|
||||||
)
|
)
|
||||||
|
customEmojiView.clipsToBounds = true
|
||||||
customEmojiView.updateTextColor(flags.contains(.isDark) ? .white : .black)
|
customEmojiView.updateTextColor(flags.contains(.isDark) ? .white : .black)
|
||||||
|
|
||||||
self.customEmojiLoadDisposable?.dispose()
|
self.customEmojiLoadDisposable?.dispose()
|
||||||
@ -491,6 +492,7 @@ final class StoryItemOverlaysView: UIView {
|
|||||||
stickerTransition.setPosition(view: customEmojiView, position: stickerFrame.center)
|
stickerTransition.setPosition(view: customEmojiView, position: stickerFrame.center)
|
||||||
stickerTransition.setBounds(view: customEmojiView, bounds: CGRect(origin: CGPoint(), size: stickerFrame.size))
|
stickerTransition.setBounds(view: customEmojiView, bounds: CGRect(origin: CGPoint(), size: stickerFrame.size))
|
||||||
stickerTransition.setScale(view: customEmojiView, scale: stickerScale)
|
stickerTransition.setScale(view: customEmojiView, scale: stickerScale)
|
||||||
|
customEmojiView.layer.cornerRadius = stickerFrame.size.width * 0.1
|
||||||
|
|
||||||
customEmojiView.isActive = isActive
|
customEmojiView.isActive = isActive
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user