Fix right click not showing the context menu in AHelps, players tab and objects tab (#22798)

* Fix right clicks in AHelp window

* Fix player tab right click

* Fix objects tab right click
This commit is contained in:
DrSmugleaf
2023-12-20 22:32:52 -08:00
committed by GitHub
parent 5ee01ce900
commit 0273bbcbf3
5 changed files with 47 additions and 36 deletions

View File

@@ -23,6 +23,7 @@ public sealed class ListContainer : Control
public bool Toggle { get; set; }
public Action<ListData, ListContainerButton>? GenerateItem;
public Action<BaseButton.ButtonEventArgs?, ListData?>? ItemPressed;
public Action<GUIBoundKeyEventArgs, ListData?>? ItemKeyBindDown;
public IReadOnlyList<ListData> Data => _data;
private const int DefaultSeparation = 3;
@@ -135,6 +136,11 @@ public sealed class ListContainer : Control
ItemPressed?.Invoke(args, button.Data);
}
private void OnItemKeyBindDown(ListContainerButton button, GUIBoundKeyEventArgs args)
{
ItemKeyBindDown?.Invoke(args, button.Data);
}
[Pure]
private Vector2 GetScrollValue()
{
@@ -256,6 +262,7 @@ public sealed class ListContainer : Control
{
button = new ListContainerButton(data);
button.OnPressed += OnItemPressed;
button.OnKeyBindDown += args => OnItemKeyBindDown(button, args);
button.ToggleMode = Toggle;
button.Group = _buttonGroup;