Method HandleMouseGrab
HandleMouseGrab(View?, Mouse)
INTERNAL: Handles mouse grab logic for a mouse event, routing events to the grabbed view if one exists.
bool HandleMouseGrab(View? deepestViewUnderMouse, Mouse mouse)
Parameters
deepestViewUnderMouseViewThe deepest view under the mouse according to normal hit-testing. This parameter is not used when a view has the mouse grabbed, but is included for context.
mouseMouseThe mouse event to handle. If a view has the grab, coordinates are converted to the grabbed view's viewport and the event is delivered to that view via NewMouseEvent(Mouse).
Returns
- bool
true if a view had the mouse grabbed and the event was routed to it (regardless of whether the grabbed view marked it as handled); false if no view has the grab and normal mouse routing should proceed.
Remarks
This method is called by RaiseMouseEvent(Mouse) early in the mouse event processing pipeline. When a view has grabbed the mouse:
- The event coordinates are converted to the grabbed view's viewport coordinates.
- The event is delivered directly to the grabbed view via NewMouseEvent(Mouse).
- true is returned to prevent further event propagation.
This ensures that during drag operations, only the grabbing view receives mouse events, preventing other views from interfering with the drag (e.g., receiving Enter/Leave events).