Various fixes

This commit is contained in:
Ilya Laktyushin 2023-09-17 17:25:55 +04:00
parent dd21063493
commit 59940ae1ba
6 changed files with 28 additions and 4 deletions

View File

@ -149,6 +149,7 @@ public final class DrawingStickerEntityView: DrawingEntityView {
if file.isAnimatedSticker || file.isVideoSticker || file.mimeType == "video/webm" {
if self.animationNode == nil {
let animationNode = DefaultAnimatedStickerNodeImpl()
animationNode.clipsToBounds = true
animationNode.autoplay = false
self.animationNode = animationNode
animationNode.started = { [weak self, weak animationNode] in
@ -354,7 +355,7 @@ public final class DrawingStickerEntityView: DrawingEntityView {
self.imageNode.frame = imageFrame
if let animationNode = self.animationNode {
if self.isReaction {
animationNode.cornerRadius = floor(imageSize.width * 0.03)
animationNode.cornerRadius = floor(imageSize.width * 0.1)
}
animationNode.frame = imageFrame
animationNode.updateLayout(size: imageSize)

View File

@ -1120,6 +1120,9 @@ public extension MediaEditorValues {
if !self.entities.isEmpty {
return true
}
if self.additionalVideoPath != nil {
return true
}
return false
}
}

View File

@ -483,7 +483,7 @@ public final class MediaEditorVideoExport {
kCVPixelBufferMetalCompatibilityKey as String: true,
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 {
self.setupComposer()
}

View File

@ -3461,6 +3461,8 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
let stickerEntity = DrawingStickerEntity(content: .file(reaction.stillAnimation, .reaction(.builtin(heart), .white)))
self.interaction?.insertEntity(stickerEntity, scale: 1.175)
}
self.mediaEditor?.play()
}
}
self.stickerScreen = controller

View File

@ -337,6 +337,7 @@ final class VideoScrubberComponent: Component {
return self.audioContainerView.bounds.contains(location)
}
var ignoreScrollUpdates = false
private func updateAudioOffset(done: Bool) {
guard self.audioScrollView.contentSize.width > 0.0, let component = self.component, let duration = self.component?.audioData?.duration else {
return
@ -353,6 +354,9 @@ final class VideoScrubberComponent: Component {
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
guard !self.ignoreScrollUpdates else {
return
}
self.updateAudioOffset(done: false)
}
@ -490,8 +494,12 @@ final class VideoScrubberComponent: Component {
var trimDuration = component.duration
var isFirstTime = false
var audioChanged = false
var animateAudioAppearance = false
if let previousComponent {
if let previousAudioData = previousComponent.audioData, previousAudioData.title != component.audioData?.title {
audioChanged = true
}
if previousComponent.audioData == nil, component.audioData != nil {
self.positionAnimation = nil
animateAudioAppearance = true
@ -588,12 +596,20 @@ final class VideoScrubberComponent: Component {
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)))
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 {
let contentOffset = offset * audioTotalWidth / duration
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)

View File

@ -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),
pointSize: CGSize(width: min(256, itemSize.width), height: min(256, itemSize.height))
)
customEmojiView.clipsToBounds = true
customEmojiView.updateTextColor(flags.contains(.isDark) ? .white : .black)
self.customEmojiLoadDisposable?.dispose()
@ -491,6 +492,7 @@ final class StoryItemOverlaysView: UIView {
stickerTransition.setPosition(view: customEmojiView, position: stickerFrame.center)
stickerTransition.setBounds(view: customEmojiView, bounds: CGRect(origin: CGPoint(), size: stickerFrame.size))
stickerTransition.setScale(view: customEmojiView, scale: stickerScale)
customEmojiView.layer.cornerRadius = stickerFrame.size.width * 0.1
customEmojiView.isActive = isActive
}