mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Merge commit '4e55e3aab0902379e2fa292582845bafdc76306a'
# Conflicts: # submodules/TelegramUI/Components/TextLoadingEffect/Sources/TextLoadingEffect.swift
This commit is contained in:
@@ -20,8 +20,8 @@ public final class TextLoadingEffectView: UIView {
|
||||
private let backgroundView: UIImageView
|
||||
private let borderBackgroundView: UIImageView
|
||||
|
||||
private let duration: Double
|
||||
private let gradientWidth: CGFloat
|
||||
private var duration: Double
|
||||
private var gradientWidth: CGFloat
|
||||
|
||||
private var size: CGSize?
|
||||
|
||||
@@ -112,6 +112,33 @@ public final class TextLoadingEffectView: UIView {
|
||||
self.borderBackgroundView.layer.add(animation, forKey: "shimmer")
|
||||
}
|
||||
|
||||
public func update(color: UIColor, rect: CGRect) {
|
||||
let maskFrame = CGRect(origin: CGPoint(), size: rect.size).insetBy(dx: -4.0, dy: -4.0)
|
||||
|
||||
self.gradientWidth = 260.0
|
||||
self.duration = 1.2
|
||||
|
||||
self.maskContentsView.backgroundColor = .clear
|
||||
|
||||
self.backgroundView.alpha = 0.25
|
||||
self.backgroundView.tintColor = color
|
||||
|
||||
self.maskContentsView.frame = maskFrame
|
||||
|
||||
let rectsSet: [CGRect] = [rect]
|
||||
|
||||
self.maskHighlightNode.updateRects(rectsSet)
|
||||
self.maskHighlightNode.frame = CGRect(origin: CGPoint(x: -maskFrame.minX, y: -maskFrame.minY), size: CGSize())
|
||||
|
||||
if self.size != maskFrame.size {
|
||||
self.size = maskFrame.size
|
||||
|
||||
self.backgroundView.frame = CGRect(origin: CGPoint(x: -self.gradientWidth, y: 0.0), size: CGSize(width: self.gradientWidth, height: maskFrame.height))
|
||||
|
||||
self.updateAnimations(size: maskFrame.size)
|
||||
}
|
||||
}
|
||||
|
||||
public func update(color: UIColor, textNode: TextNodeProtocol, range: NSRange) {
|
||||
var rectsSet: [CGRect] = []
|
||||
if let rects = textNode.textRangeRects(in: range)?.rects, !rects.isEmpty {
|
||||
|
||||
Reference in New Issue
Block a user