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
|
|
@ -89,8 +89,8 @@ public class ToolbarControllerTests
|
|||
|
||||
ToolbarController.Bind(layout, repo, () => shortcuts,
|
||||
iconIds: (_,_,_,_,_) => 0x77u, useItem: g => used = g);
|
||||
// UiEvent is a positional record struct: (SourceId, Target, Type, Data0..3, Payload)
|
||||
slots[Row1[0]].Cell.OnEvent(new UiEvent(0u, null, UiEventType.MouseDown));
|
||||
// Use now fires on Click (mouse-up), not MouseDown — drag/click disambiguation.
|
||||
slots[Row1[0]].Cell.OnEvent(new UiEvent(0u, null, UiEventType.Click));
|
||||
|
||||
Assert.Equal(0x5001u, used);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue