简体   繁体   中英

NSView loses mouseMoved/mouseDragged if dragged in from subview

A = the parent NSView; B = the child NSView;

B has a small NSTrackingArea; B is a small subview of A;

A correctly receives mouseMoved and mouseDragged events if moved,clicked, dragged in a empty area.

If i click in B and drag the mouse outside of its bounds into A, A does not receive any mouseMoved or mouseDragged events.

Can someone point me to what i could do to get the superview A to react to this drag?

I've observed this and I was able to solve it by doing as follows:

  1. Create a NSViewController and set viewA as its "view" property.
  2. In my case, I implemented mouseDragged in the view-controller but you can try on the view and see what results you get. mouseEntered and mouseExited were implemented in the view subclass.

Tip: Make sure you're updating the tracking area bounds as needed. Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM