From 61243096ec3eec40b1034ac40556ae61d0a494e3 Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 4 Feb 2022 05:14:37 -0500 Subject: [PATCH] feat: add hide option to message context menu --- ChatTwo/PayloadHandler.cs | 4 ++++ ChatTwo/Ui/ChatLog.cs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChatTwo/PayloadHandler.cs b/ChatTwo/PayloadHandler.cs index 1fc9fc3..4a3a8d0 100755 --- a/ChatTwo/PayloadHandler.cs +++ b/ChatTwo/PayloadHandler.cs @@ -90,6 +90,10 @@ internal sealed class PayloadHandler { ImGui.Checkbox("Screenshot mode", ref this.Ui.ScreenshotMode); + if (ImGui.Selectable("Hide chat")) { + this.Log.UserHide(); + } + if (chunk.Message is { } message) { if (ImGui.BeginMenu("Copy")) { var text = message.Sender diff --git a/ChatTwo/Ui/ChatLog.cs b/ChatTwo/Ui/ChatLog.cs index d277f07..56111b3 100755 --- a/ChatTwo/Ui/ChatLog.cs +++ b/ChatTwo/Ui/ChatLog.cs @@ -487,7 +487,7 @@ internal sealed class ChatLog : IUiComponent { try { if (ImGui.Selectable("Hide chat")) { - this._hideState = HideState.User; + this.UserHide(); } } finally { ImGui.PopStyleColor(); @@ -517,6 +517,10 @@ internal sealed class ChatLog : IUiComponent { ImGui.End(); } + internal void UserHide() { + this._hideState = HideState.User; + } + private void DrawMessageLog(Tab tab, float childHeight, bool switchedTab) { if (ImGui.BeginChild("##chat2-messages", new Vector2(-1, childHeight))) { ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero);