feat(D.2b): wire UiHost input + moveable windows (UiRoot window-drag + WantCapture gate)
- UiElement: add Draggable flag; left-drag on a draggable element repositions it as a floating window instead of starting a drag-drop sequence. - UiRoot: add WantsMouse/WantsKeyboard properties (mirrors ImGui's WantCaptureMouse pattern); add FindDraggable helper; inject _windowDragTarget state machine into OnMouseDown/OnMouseMove/OnMouseUp so draggable windows track the pointer offset. - UiNineSlicePanel: set Draggable=true so retail window frames are movable by default. - GameWindow: OR _uiHost?.Root.WantsMouse|WantsKeyboard into the SilkMouseSource wantCaptureMouse/wantCaptureKeyboard delegates and the direct MouseMove gate so game actions (movement, world-pick) are suppressed while the pointer is over a retail window — no double-handling with the InputDispatcher. - GameWindow: wire all Silk Mice/Keyboards to UiHost after construction so the UiRoot tree receives live input. - Tests: 3 new UiRootInputTests covering WantsMouse hit-test, window-drag reposition, and non-draggable panel immobility. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2f4520ee12
commit
4acecffcd6
5 changed files with 124 additions and 5 deletions
|
|
@ -88,6 +88,11 @@ public abstract class UiElement
|
|||
/// <summary>Painter's-algorithm z-order within siblings. Higher = on top.</summary>
|
||||
public int ZOrder { get; set; }
|
||||
|
||||
/// <summary>If true, a left-drag on this element (or a non-draggable child of
|
||||
/// it) repositions it as a movable window. Intended for top-level panels,
|
||||
/// whose Left/Top are screen coordinates (Root sits at the origin).</summary>
|
||||
public bool Draggable { get; set; }
|
||||
|
||||
// ── Tree structure ──────────────────────────────────────────────────
|
||||
public UiElement? Parent { get; private set; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue