fix: calculate height correctly in non-compact mode

This commit is contained in:
Anna 2022-02-01 16:23:00 -05:00
parent 7619d1ab56
commit 1722441968
1 changed files with 9 additions and 2 deletions

View File

@ -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()) {