Class MouseGestureCapture<TRegion>
- Namespace
- SharpConsoleUI.Helpers
- Assembly
- SharpConsoleUI.dll
Sub-region gesture ownership for a control's mouse handling. On a fresh Button1 press (nothing captured) it hit-tests the region and captures it; every subsequent Button1 press/drag routes to the captured region without re-hit-testing (SGR re-sends Button1Pressed on motion, so a resent press mid- drag must NOT be treated as a fresh interaction with whatever region the cursor is now over); release ends the gesture. This is the same capture idea WindowEventDispatcher applies at the control level, applied at the sub-region level.
public sealed class MouseGestureCapture<TRegion> where TRegion : struct, Enum
Type Parameters
TRegionThe control's sub-region enum.
- Inheritance
-
MouseGestureCapture<TRegion>
- Inherited Members
- Extension Methods
Properties
CapturedRegion
The region currently captured, or null if no gesture is active.
public TRegion? CapturedRegion { get; }
Property Value
- TRegion?
IsCapturing
Whether a gesture is currently captured.
public bool IsCapturing { get; }
Property Value
Methods
Reset()
Clears any active capture, abandoning the current gesture.
public void Reset()
Route(MouseEventArgs, Func<MouseEventArgs, TRegion>)
Routes a mouse event to the correct region for the current gesture state.
public GestureRoute<TRegion> Route(MouseEventArgs args, Func<MouseEventArgs, TRegion> hitTest)
Parameters
argsMouseEventArgsThe mouse event arguments.
hitTestFunc<MouseEventArgs, TRegion>Resolves the region under the cursor. Called only on a fresh press (when nothing is captured); never re-invoked mid-gesture.
Returns
- GestureRoute<TRegion>
The gesture phase and the region the event routes to.