From b397fb507e625e0af7741e73b73d78a92b950931 Mon Sep 17 00:00:00 2001 From: ocornut Date: Tue, 13 Sep 2016 09:18:17 +0200 Subject: [PATCH] Fixed EndGroup() not restoring offset properly. breaking SameLine() offset (caused by 954c890c6782fda494a3ac36f3c5a591db584cf4) (#829) --- imgui.cpp | 3 ++- imgui_internal.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 551601fd0..657885924 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -9142,6 +9142,7 @@ void ImGui::BeginGroup() group_data.BackupCursorPos = window->DC.CursorPos; group_data.BackupCursorMaxPos = window->DC.CursorMaxPos; group_data.BackupIndentX = window->DC.IndentX; + group_data.BackupGroupOffsetX = window->DC.GroupOffsetX; group_data.BackupCurrentLineHeight = window->DC.CurrentLineHeight; group_data.BackupCurrentLineTextBaseOffset = window->DC.CurrentLineTextBaseOffset; group_data.BackupLogLinePosY = window->DC.LogLinePosY; @@ -9172,7 +9173,7 @@ void ImGui::EndGroup() window->DC.CurrentLineHeight = group_data.BackupCurrentLineHeight; window->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset; window->DC.IndentX = group_data.BackupIndentX; - window->DC.GroupOffsetX = window->DC.IndentX; + window->DC.GroupOffsetX = group_data.BackupGroupOffsetX; window->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f; if (group_data.AdvanceCursor) diff --git a/imgui_internal.h b/imgui_internal.h index dc02f719a..8a0b4824a 100644 --- a/imgui_internal.h +++ b/imgui_internal.h @@ -257,6 +257,7 @@ struct ImGuiGroupData ImVec2 BackupCursorPos; ImVec2 BackupCursorMaxPos; float BackupIndentX; + float BackupGroupOffsetX; float BackupCurrentLineHeight; float BackupCurrentLineTextBaseOffset; float BackupLogLinePosY;