feat(ui): D.5.3/B.1 — UiItemSlot drag source + drop target + accept/reject overlay
- UiElement: two new virtuals GetDragPayload()/GetDragGhost() (default null) keep UiRoot item-agnostic; any leaf can opt into drag by overriding these. - UiItemSlot: SlotIndex + SourceKind properties for payload identity; two overrides return ItemDragPayload / icon ghost when the slot is occupied. FindList() walks the parent chain to locate the owning UiItemList and its registered IItemListDragHandler. - UiItemSlot.OnEvent: MouseDown now just consumes the press; use-item fires on Click (mouse-up) so a drag doesn't also trigger the use-item callback. DragEnter → ask handler, set Accept/Reject overlay. DragOver → reset to None (fires on leave). DropReleased → clear overlay + dispatch to handler when Data0 == 1 (accepted). DragBegin consumed (source). - OnDraw: accept/reject sprite overlay drawn last, guarded on id != 0 to avoid the resolve(0)-→-magenta footgun. - ToolbarControllerTests: Click_emitsUseForBoundItem changed from MouseDown to Click to match the new dispatch. - 12 new DragDropSpineTests pass; full suite 481/483 (2 pre-existing skips). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9d483468d9
commit
1672eaa620
4 changed files with 189 additions and 3 deletions
|
|
@ -203,6 +203,16 @@ public abstract class UiElement
|
|||
/// </summary>
|
||||
public virtual bool OnEvent(in UiEvent e) => false;
|
||||
|
||||
/// <summary>The data this element carries when a drag begins. <see cref="UiRoot"/>
|
||||
/// pulls this on drag-promote; a NULL return CANCELS the drag (retail:
|
||||
/// ItemList_BeginDrag only arms an occupied cell). Default null = not draggable.</summary>
|
||||
public virtual object? GetDragPayload() => null;
|
||||
|
||||
/// <summary>The texture <see cref="UiRoot"/> paints at the cursor while this element
|
||||
/// is the drag source: (GL handle, width, height). Null = no ghost. Keeps
|
||||
/// <see cref="UiRoot"/> item-agnostic. Retail analog: m_dragIcon (decomp 229738).</summary>
|
||||
public virtual (uint tex, int w, int h)? GetDragGhost() => null;
|
||||
|
||||
/// <summary>
|
||||
/// Tooltip text for this widget. Retail fires event 0x07 after
|
||||
/// ~1000ms hover, then queries the widget's virtual "GetString"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue