From df55d0269d0670cef6da64a9fae9003aae91f87f Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sun, 11 Nov 2018 22:21:44 +0400 Subject: [PATCH] Fixed context menu buttons not firing events while in landscape with keyboard on screen --- Display/ContextMenuActionNode.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Display/ContextMenuActionNode.swift b/Display/ContextMenuActionNode.swift index 9325ce0db9..9b7f81bdf9 100644 --- a/Display/ContextMenuActionNode.swift +++ b/Display/ContextMenuActionNode.swift @@ -1,11 +1,21 @@ import Foundation import AsyncDisplayKit +final private class ContextMenuActionButton: HighlightTrackingButton { + override func convert(_ point: CGPoint, from view: UIView?) -> CGPoint { + if view is UIWindow { + return super.convert(point, from: nil) + } else { + return super.convert(point, from: view) + } + } +} + final class ContextMenuActionNode: ASDisplayNode { private let textNode: ASTextNode? private let iconNode: ASImageNode? private let action: () -> Void - private let button: HighlightTrackingButton + private let button: ContextMenuActionButton var dismiss: (() -> Void)? @@ -30,7 +40,7 @@ final class ContextMenuActionNode: ASDisplayNode { } self.action = action.action - self.button = HighlightTrackingButton() + self.button = ContextMenuActionButton() super.init()