Another fix

This commit is contained in:
Ali 2020-11-15 20:42:55 +04:00
parent bd1a625db0
commit b003339efd
2 changed files with 13 additions and 1 deletions

View File

@ -69,6 +69,18 @@ public enum ContainedViewLayoutTransition {
} }
} }
public extension CGRect {
var ensuredValid: CGRect {
if !ASIsCGRectValidForLayout(CGRect(origin: CGPoint(), size: self.size)) {
return CGRect()
}
if !ASIsCGPositionValidForLayout(self.origin) {
return CGRect()
}
return self
}
}
public extension ContainedViewLayoutTransition { public extension ContainedViewLayoutTransition {
func updateFrame(node: ASDisplayNode, frame: CGRect, force: Bool = false, beginWithCurrentState: Bool = false, delay: Double = 0.0, completion: ((Bool) -> Void)? = nil) { func updateFrame(node: ASDisplayNode, frame: CGRect, force: Bool = false, beginWithCurrentState: Bool = false, delay: Double = 0.0, completion: ((Bool) -> Void)? = nil) {
if frame.origin.x.isNaN { if frame.origin.x.isNaN {

View File

@ -680,7 +680,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
let arguments = TransformImageArguments(corners: corners, imageSize: drawingSize, boundingSize: boundingSize, intrinsicInsets: UIEdgeInsets(), resizeMode: isInlinePlayableVideo ? .fill(.black) : .blurBackground, emptyColor: emptyColor, custom: patternArguments) let arguments = TransformImageArguments(corners: corners, imageSize: drawingSize, boundingSize: boundingSize, intrinsicInsets: UIEdgeInsets(), resizeMode: isInlinePlayableVideo ? .fill(.black) : .blurBackground, emptyColor: emptyColor, custom: patternArguments)
let imageFrame = CGRect(origin: CGPoint(x: -arguments.insets.left, y: -arguments.insets.top), size: arguments.drawingSize) let imageFrame = CGRect(origin: CGPoint(x: -arguments.insets.left, y: -arguments.insets.top), size: arguments.drawingSize).ensuredValid
let imageApply = imageLayout(arguments) let imageApply = imageLayout(arguments)