fix(ui): select retained items on mouse down
Port UIElement_ListBox's press-time selection ordering through the shared retained item-list contract. Inventory, loot, paperdoll, and physical shortcuts now update canonical selection before release or drag promotion, while target-mode consumption suppresses drag and release-time activation. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
parent
2dd5cb80d2
commit
043ab10b3c
18 changed files with 292 additions and 62 deletions
|
|
@ -192,11 +192,19 @@ public class ToolbarControllerTests
|
|||
var shortcuts = new List<ShortcutEntry>
|
||||
{ new(Index: 0, ObjectId: 0x5001u, SpellId: 0) };
|
||||
uint used = 0;
|
||||
var selection = new SelectionState();
|
||||
|
||||
ToolbarController.Bind(layout, repo, () => shortcuts,
|
||||
iconIds: (_,_,_,_,_) => 0x77u, useItem: g => used = g);
|
||||
iconIds: (_,_,_,_,_) => 0x77u,
|
||||
useItem: g => used = g,
|
||||
selection: selection);
|
||||
UiItemSlot cell = slots[Row1[0]].Cell;
|
||||
cell.OnEvent(new UiEvent(0u, cell, UiEventType.MouseDown));
|
||||
|
||||
Assert.Equal(0x5001u, selection.SelectedObjectId);
|
||||
Assert.Equal(0u, used);
|
||||
// Use now fires on Click (mouse-up), not MouseDown — drag/click disambiguation.
|
||||
slots[Row1[0]].Cell.OnEvent(new UiEvent(0u, null, UiEventType.Click));
|
||||
cell.OnEvent(new UiEvent(0u, cell, UiEventType.Click));
|
||||
|
||||
Assert.Equal(0x5001u, used);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue