diff --git a/modules/juce_gui_basics/native/juce_NSViewComponentPeer_mac.mm b/modules/juce_gui_basics/native/juce_NSViewComponentPeer_mac.mm index 7c13bec982..e39eb373a5 100644 --- a/modules/juce_gui_basics/native/juce_NSViewComponentPeer_mac.mm +++ b/modules/juce_gui_basics/native/juce_NSViewComponentPeer_mac.mm @@ -540,12 +540,20 @@ public: if (! isWindowAtPoint (viewWindow, screenPoint)) return false; - } } - NSView* v = [view hitTest: NSMakePoint (viewFrame.origin.x + localPos.getX(), - viewFrame.origin.y + localPos.getY())]; + const auto pointInSuperview = std::invoke ([&] + { + const auto local = NSMakePoint (localPos.x, localPos.y); + + if (auto* superview = [view superview]) + return [view convertPoint: local toView: superview]; + + return local; + }); + + NSView* v = [view hitTest: pointInSuperview]; return trueIfInAChildWindow ? (v != nil) : (v == view);