Fix media selection

This commit is contained in:
Ilya Laktyushin 2021-08-28 02:46:24 +03:00
parent 92e70edef9
commit e43b4b1b02
2 changed files with 7 additions and 9 deletions

View File

@ -16,6 +16,7 @@ import ChatInterfaceState
import FastBlur
import ConfettiEffect
import WallpaperBackgroundNode
import GridMessageSelectionNode
final class VideoNavigationControllerDropContentItem: NavigationControllerDropContentItem {
let itemNode: OverlayMediaItemNode
@ -2176,7 +2177,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
switch self.chatPresentationInterfaceState.mode {
case .standard(previewing: true):
if let result = self.historyNode.view.hitTest(self.view.convert(point, to: self.historyNode.view), with: event), let node = result.asyncdisplaykit_node as? ChatMessageSelectionNode {
if let result = self.historyNode.view.hitTest(self.view.convert(point, to: self.historyNode.view), with: event), let node = result.asyncdisplaykit_node, node is ChatMessageSelectionNode || node is GridMessageSelectionNode {
return result
}
if let result = self.navigateButtons.hitTest(self.view.convert(point, to: self.navigateButtons.view), with: event) {

View File

@ -3343,17 +3343,14 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
return parent
} else if let parent = parent as? GridMessageSelectionNode, parent.bounds.contains(point) {
return parent
} else {
if let parentSubnodes = parent.subnodes {
for subnode in parentSubnodes {
let subnodeFrame = subnode.frame
if let result = traceSelectionNodes(parent: subnode, point: point.offsetBy(dx: -subnodeFrame.minX, dy: -subnodeFrame.minY)) {
return result
}
} else if let parentSubnodes = parent.subnodes {
for subnode in parentSubnodes {
if let result = traceSelectionNodes(parent: subnode, point: point.offsetBy(dx: -subnode.frame.minX + subnode.bounds.minX, dy: -subnode.frame.minY + subnode.bounds.minY)) {
return result
}
}
return nil
}
return nil
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {