Better implementation for disabled chat input
This commit is contained in:
@@ -578,32 +578,6 @@ public sealed class ChatLogWindow : Window
|
||||
}
|
||||
}
|
||||
|
||||
var showNovice = Plugin.Config.ShowNoviceNetwork && Plugin.Functions.IsMentor();
|
||||
if (activeTab is { InputDisabled: true })
|
||||
{
|
||||
Plugin.FontManager.FontAwesome.Push();
|
||||
var buttonSize = ImGui.CalcTextSize(FontAwesomeIcon.Cog.ToIconString());
|
||||
var spacing = ImGui.GetContentRegionAvail().X - buttonSize.X * (showNovice ? 2 : 1);
|
||||
Plugin.FontManager.FontAwesome.Pop();
|
||||
|
||||
ImGui.Dummy(buttonSize with { X = spacing });
|
||||
if (ImGui.IsItemHovered())
|
||||
ImGui.SetTooltip(Language.ChatLog_DisabledInput);
|
||||
|
||||
ImGui.SameLine(spacing);
|
||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.Cog))
|
||||
Plugin.SettingsWindow.Toggle();
|
||||
|
||||
if (!showNovice)
|
||||
return;
|
||||
|
||||
ImGui.SameLine();
|
||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.Leaf))
|
||||
Plugin.Functions.ClickNoviceNetworkButton();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var beforeIcon = ImGui.GetCursorPos();
|
||||
if (ImGuiUtil.IconButton(FontAwesomeIcon.Comment) && activeTab is not { Channel: not null })
|
||||
ImGui.OpenPopup(ChatChannelPicker);
|
||||
@@ -655,6 +629,7 @@ public sealed class ChatLogWindow : Window
|
||||
var afterIcon = ImGui.GetCursorPos();
|
||||
|
||||
var buttonWidth = afterIcon.X - beforeIcon.X;
|
||||
var showNovice = Plugin.Config.ShowNoviceNetwork && Plugin.Functions.IsMentor();
|
||||
var inputWidth = ImGui.GetContentRegionAvail().X - buttonWidth * (showNovice ? 2 : 1);
|
||||
|
||||
var inputType = TempChannel?.ToChatType() ?? activeTab?.Channel?.ToChatType() ?? Plugin.Functions.Chat.Channel.Channel.ToChatType();
|
||||
@@ -685,8 +660,13 @@ public sealed class ChatLogWindow : Window
|
||||
ImGui.SetKeyboardFocusHere();
|
||||
|
||||
var chatCopy = Chat;
|
||||
ImGui.SetNextItemWidth(inputWidth);
|
||||
ImGui.InputText("##chat2-input", ref Chat, 500, InputFlags, Callback);
|
||||
|
||||
var isChatEnabled = activeTab is { InputDisabled: false };
|
||||
using (ImRaii.Disabled(!isChatEnabled))
|
||||
{
|
||||
ImGui.SetNextItemWidth(inputWidth);
|
||||
ImGui.InputTextWithHint("##chat2-input", isChatEnabled ? "": Language.ChatLog_DisabledInput, ref Chat, 500, InputFlags, Callback);
|
||||
}
|
||||
|
||||
if (ImGui.IsItemDeactivated())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user