mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various improvements
This commit is contained in:
@@ -426,11 +426,13 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
||||
public let context: AccountContext
|
||||
public let fileId: Int64
|
||||
public let file: TelegramMediaFile?
|
||||
public let emptyCorner: Bool
|
||||
|
||||
public init(context: AccountContext, fileId: Int64, file: TelegramMediaFile?) {
|
||||
public init(context: AccountContext, fileId: Int64, file: TelegramMediaFile?, emptyCorner: Bool = false) {
|
||||
self.context = context
|
||||
self.fileId = fileId
|
||||
self.file = file
|
||||
self.emptyCorner = emptyCorner
|
||||
}
|
||||
|
||||
public static func ==(lhs: Pattern, rhs: Pattern) -> Bool {
|
||||
@@ -446,7 +448,9 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
||||
if lhs.file?.fileId != rhs.file?.fileId {
|
||||
return false
|
||||
}
|
||||
|
||||
if lhs.emptyCorner != rhs.emptyCorner {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -771,8 +775,13 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
||||
patternContentLayer.frame = CGRect(origin: CGPoint(x: patternOrigin.x - placement.position.x / 3.0 - itemSize.width * 0.5, y: patternOrigin.y + placement.position.y / 3.0 - itemSize.height * 0.5), size: itemSize)
|
||||
var alphaFraction = abs(placement.position.x / 3.0) / min(500.0, size.width)
|
||||
alphaFraction = min(1.0, max(0.0, alphaFraction))
|
||||
patternContentLayer.opacity = 0.3 * Float(1.0 - alphaFraction) * Float(patternAlpha)
|
||||
|
||||
if maxIndex == 1 && params.pattern?.emptyCorner == true {
|
||||
patternContentLayer.opacity = 0.0
|
||||
} else {
|
||||
patternContentLayer.opacity = 0.3 * Float(1.0 - alphaFraction) * Float(patternAlpha)
|
||||
}
|
||||
|
||||
maxIndex += 1
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user