fix(ui): ImGui ID collisions and missing popup-open trigger
- Util/SearchSelector.cs ImRaii.PushId(id) collapsed every row in the filtered list to the same ImGui ID, leaving the ID stack ambiguous for click resolution. Mix the row index into the pushed id so every Selectable has a distinct ImGui identifier - Ui/SettingsTabs/Chat.cs blocked-emote add-button never opened the selector popup because SearchSelector.SelectorPopup is wrapped in ImRaii.ContextPopupItem (right-click semantics). Detect the IsItemClicked() event after the button and call ImGui.OpenPopup explicitly so left-click opens the picker too
This commit is contained in:
@@ -169,6 +169,13 @@ internal sealed class Chat : ISettingsTab
|
||||
using (Plugin.FontManager.FontAwesome.Push())
|
||||
ImGui.Button(FontAwesomeIcon.Plus.ToIconString(), new Vector2(buttonWidth, 0));
|
||||
|
||||
// Open the selector popup on left-click; SelectorPopup uses
|
||||
// ImRaii.ContextPopupItem internally which only opens on right-
|
||||
// click otherwise — without this OpenPopup the button looked
|
||||
// active but the popup never appeared on a normal click.
|
||||
if (ImGui.IsItemClicked())
|
||||
ImGui.OpenPopup("WordAddPopup");
|
||||
|
||||
if (SearchSelector.SelectorPopup("WordAddPopup", out var newWord, WordPopupOptions))
|
||||
{
|
||||
Mutable.BlockedEmotes.Add(newWord);
|
||||
|
||||
@@ -84,7 +84,11 @@ public static class SearchSelector
|
||||
foreach (var i in clipper.Rows)
|
||||
{
|
||||
var searched = FilteredSearchSheet[i];
|
||||
using var pushedId = ImRaii.PushId(id);
|
||||
// Mix the row index into the ImGui ID so each Selectable in
|
||||
// the loop has a distinct ID — using the same id for every
|
||||
// row collapsed all rows to a single ID-stack entry and made
|
||||
// selection ambiguous.
|
||||
using var pushedId = ImRaii.PushId($"{id}##{i}");
|
||||
if (!drawSelectable(searched, options.IsSelected(searched)))
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user