Фикс: убран clipsToBounds с bubbleView, разблокирован scrubbing жест на waveform

This commit is contained in:
2026-04-13 14:48:29 +05:00
parent 472b9a23f5
commit ab9a93cb7e
2 changed files with 13 additions and 1 deletions

View File

@@ -23,6 +23,10 @@ final class MessageVoiceView: UIView {
private var totalDuration: TimeInterval = 0 // original duration for label reset private var totalDuration: TimeInterval = 0 // original duration for label reset
/// Center of play button in this view's coordinate space (for external blob positioning). /// Center of play button in this view's coordinate space (for external blob positioning).
var playButtonCenter: CGPoint { playButton.center } var playButtonCenter: CGPoint { playButton.center }
/// Whether the waveform is accepting scrub gestures (true during playback).
var isScrubbingEnabled: Bool { waveformView.enableScrubbing }
/// Frame of the waveform in this view's coordinate space.
var waveformFrame: CGRect { waveformView.frame }
// MARK: - Layout Constants (Telegram exact: ChatMessageInteractiveFileNode) // MARK: - Layout Constants (Telegram exact: ChatMessageInteractiveFileNode)

View File

@@ -319,7 +319,6 @@ final class NativeMessageCell: UICollectionViewCell {
// Raster bubble image (Telegram-exact tail) added last so it renders above outline // Raster bubble image (Telegram-exact tail) added last so it renders above outline
bubbleImageView.contentMode = .scaleToFill bubbleImageView.contentMode = .scaleToFill
bubbleView.addSubview(bubbleImageView) bubbleView.addSubview(bubbleImageView)
bubbleView.clipsToBounds = true // clips voice blob animation to bubble bounds
contentView.addSubview(bubbleView) contentView.addSubview(bubbleView)
// Text (CoreTextLabel no font/color/lines config; all baked into CoreTextTextLayout) // Text (CoreTextLabel no font/color/lines config; all baked into CoreTextTextLayout)
@@ -3088,6 +3087,15 @@ extension NativeMessageCell: UIGestureRecognizerDelegate {
override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool { override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
guard let pan = gestureRecognizer as? UIPanGestureRecognizer else { return true } guard let pan = gestureRecognizer as? UIPanGestureRecognizer else { return true }
if isInSelectionMode { return false } // No swipe in selection mode if isInSelectionMode { return false } // No swipe in selection mode
// If touch is on the waveform during playback, let the waveform's scrub gesture win
if !voiceView.isHidden, voiceView.isScrubbingEnabled {
let pointInVoice = pan.location(in: voiceView)
if voiceView.waveformFrame.contains(pointInVoice) {
return false
}
}
let velocity = pan.velocity(in: contentView) let velocity = pan.velocity(in: contentView)
// Telegram: only left swipe (negative velocity.x), clear horizontal dominance // Telegram: only left swipe (negative velocity.x), clear horizontal dominance
return velocity.x < 0 && abs(velocity.x) > abs(velocity.y) * 2.0 return velocity.x < 0 && abs(velocity.x) > abs(velocity.y) * 2.0