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
|
|
@ -138,6 +138,7 @@ public sealed class ToolbarController : IItemListDragHandler, IRetainedPanelCont
|
|||
if (_slots[i] is { } list)
|
||||
{
|
||||
WireClick(list);
|
||||
list.PrimaryItemPressed = PressItem;
|
||||
list.ExamineItemRequested = ExamineItem;
|
||||
// B.1 drag-drop spine: this controller is the drop handler for every
|
||||
// toolbar slot list; each cell knows its slot index + that it's a
|
||||
|
|
@ -532,6 +533,19 @@ public sealed class ToolbarController : IItemListDragHandler, IRetainedPanelCont
|
|||
};
|
||||
}
|
||||
|
||||
private bool PressItem(uint itemId)
|
||||
{
|
||||
if (_itemInteraction?.OfferPrimaryClick(itemId)
|
||||
is not null and not ItemPrimaryClickResult.NotActive)
|
||||
return true;
|
||||
|
||||
if (_selectItem is not null)
|
||||
_selectItem(itemId);
|
||||
else
|
||||
_selection?.Select(itemId, SelectionChangeSource.Toolbar);
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ExamineItem(uint itemId)
|
||||
{
|
||||
if (_selectItem is not null)
|
||||
|
|
@ -777,7 +791,10 @@ public sealed class ToolbarController : IItemListDragHandler, IRetainedPanelCont
|
|||
_selection.Changed -= OnSelectionChanged;
|
||||
foreach (UiItemList? list in _slots)
|
||||
if (list is not null)
|
||||
{
|
||||
list.PrimaryItemPressed = null;
|
||||
list.ExamineItemRequested = null;
|
||||
}
|
||||
_repo.ObjectAdded -= OnRepositoryObjectChanged;
|
||||
_repo.ObjectUpdated -= OnRepositoryObjectChanged;
|
||||
_repo.ObjectRemoved -= OnRepositoryObjectChanged;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue