mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Various fixes
This commit is contained in:
@@ -37,12 +37,76 @@ public final class ContextExtractedContentContainingNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
public final class ContextExtractedContentNode: ASDisplayNode {
|
||||
public var customHitTest: ((CGPoint) -> UIView?)?
|
||||
public final class ContextExtractedContentContainingView: UIView {
|
||||
public let contentView: ContextExtractedContentView
|
||||
public var contentRect: CGRect = CGRect()
|
||||
public var isExtractedToContextPreview: Bool = false
|
||||
public var willUpdateIsExtractedToContextPreview: ((Bool, ContainedViewLayoutTransition) -> Void)?
|
||||
public var isExtractedToContextPreviewUpdated: ((Bool) -> Void)?
|
||||
public var updateAbsoluteRect: ((CGRect, CGSize) -> Void)?
|
||||
public var applyAbsoluteOffset: ((CGPoint, ContainedViewLayoutTransitionCurve, Double) -> Void)?
|
||||
public var applyAbsoluteOffsetSpring: ((CGFloat, Double, CGFloat) -> Void)?
|
||||
public var layoutUpdated: ((CGSize, ListViewItemUpdateAnimation) -> Void)?
|
||||
public var updateDistractionFreeMode: ((Bool) -> Void)?
|
||||
public var requestDismiss: (() -> Void)?
|
||||
|
||||
public override init(frame: CGRect) {
|
||||
self.contentView = ContextExtractedContentView()
|
||||
|
||||
super.init(frame: frame)
|
||||
|
||||
self.addSubview(self.contentView)
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
let result = self.view.hitTest(point, with: event)
|
||||
if result === self.view {
|
||||
if self.contentView.superview === self {
|
||||
return self.contentView.hitTest(self.convert(point, to: self.contentView), with: event)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final class ContextExtractedContentNode: ASDisplayNode {
|
||||
private var viewImpl: ContextExtractedContentView {
|
||||
return self.view as! ContextExtractedContentView
|
||||
}
|
||||
|
||||
public var customHitTest: ((CGPoint) -> UIView?)? {
|
||||
didSet {
|
||||
if self.isNodeLoaded {
|
||||
self.viewImpl.customHitTest = self.customHitTest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override public init() {
|
||||
super.init()
|
||||
|
||||
self.setViewBlock {
|
||||
return ContextExtractedContentView(frame: CGRect())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final class ContextExtractedContentView: UIView {
|
||||
public var customHitTest: ((CGPoint) -> UIView?)?
|
||||
|
||||
override public init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
let result = super.hitTest(point, with: event)
|
||||
if result === self {
|
||||
return nil
|
||||
} else {
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user