From 172244196818085b71014d3ed9680f1a446c1c1e Mon Sep 17 00:00:00 2001 From: Anna Date: Tue, 1 Feb 2022 16:23:00 -0500 Subject: [PATCH] fix: calculate height correctly in non-compact mode --- ChatTwo/Ui/ChatLog.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ChatTwo/Ui/ChatLog.cs b/ChatTwo/Ui/ChatLog.cs index 61d24f4..ce44530 100755 --- a/ChatTwo/Ui/ChatLog.cs +++ b/ChatTwo/Ui/ChatLog.cs @@ -513,7 +513,8 @@ internal sealed class ChatLog : IUiComponent { ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, Vector2.Zero); var table = tab.DisplayTimestamp && this.Ui.Plugin.Config.PrettierTimestamps; - if (this.Ui.Plugin.Config.MoreCompactPretty) { + var oldCellPaddingY = ImGui.GetStyle().CellPadding.Y; + if (this.Ui.Plugin.Config.PrettierTimestamps && this.Ui.Plugin.Config.MoreCompactPretty) { var padding = ImGui.GetStyle().CellPadding; padding.Y = 0; @@ -603,6 +604,12 @@ internal sealed class ChatLog : IUiComponent { var afterDraw = ImGui.GetCursorScreenPos(); message.Height = ImGui.GetCursorPosY() - lastPos; + if (this.Ui.Plugin.Config.PrettierTimestamps && !this.Ui.Plugin.Config.MoreCompactPretty) { + message.Height -= oldCellPaddingY * 2; + beforeDraw.Y += oldCellPaddingY; + afterDraw.Y -= oldCellPaddingY; + } + message.IsVisible = ImGui.IsRectVisible(beforeDraw, afterDraw); UpdateMessage: @@ -610,7 +617,7 @@ internal sealed class ChatLog : IUiComponent { } } finally { tab.MessagesMutex.ReleaseMutex(); - ImGui.PopStyleVar(this.Ui.Plugin.Config.MoreCompactPretty ? 2 : 1); + ImGui.PopStyleVar(this.Ui.Plugin.Config.PrettierTimestamps && this.Ui.Plugin.Config.MoreCompactPretty ? 2 : 1); } if (switchedTab || ImGui.GetScrollY() >= ImGui.GetScrollMaxY()) {