mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-13 08:19:55 +02:00
Layout: Fixed mixing up SameLine() and SetCursorPos() together. SameLine() is a stateful.
+ minor unrelatedcomments.
This commit is contained in:
@ -1342,6 +1342,7 @@ void ImGui::NewLine()
|
||||
ImGuiContext& g = *GImGui;
|
||||
const ImGuiLayoutType backup_layout_type = window->DC.LayoutType;
|
||||
window->DC.LayoutType = ImGuiLayoutType_Vertical;
|
||||
window->DC.IsSameLine = false;
|
||||
if (window->DC.CurrLineSize.y > 0.0f) // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height.
|
||||
ItemSize(ImVec2(0, 0));
|
||||
else
|
||||
@ -1734,6 +1735,7 @@ bool ImGui::BeginComboPreview()
|
||||
window->DC.CursorPos = preview_data->PreviewRect.Min + g.Style.FramePadding;
|
||||
window->DC.CursorMaxPos = window->DC.CursorPos;
|
||||
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
|
||||
window->DC.IsSameLine = false;
|
||||
PushClipRect(preview_data->PreviewRect.Min, preview_data->PreviewRect.Max, true);
|
||||
|
||||
return true;
|
||||
@ -1759,6 +1761,7 @@ void ImGui::EndComboPreview()
|
||||
window->DC.CursorPosPrevLine = preview_data->BackupCursorPosPrevLine;
|
||||
window->DC.PrevLineTextBaseOffset = preview_data->BackupPrevLineTextBaseOffset;
|
||||
window->DC.LayoutType = preview_data->BackupLayout;
|
||||
window->DC.IsSameLine = false;
|
||||
preview_data->PreviewRect = ImRect();
|
||||
}
|
||||
|
||||
@ -6730,6 +6733,7 @@ bool ImGui::BeginMenuBar()
|
||||
// We overwrite CursorMaxPos because BeginGroup sets it to CursorPos (essentially the .EmitItem hack in EndMenuBar() would need something analogous here, maybe a BeginGroupEx() with flags).
|
||||
window->DC.CursorPos = window->DC.CursorMaxPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffset.x, bar_rect.Min.y + window->DC.MenuBarOffset.y);
|
||||
window->DC.LayoutType = ImGuiLayoutType_Horizontal;
|
||||
window->DC.IsSameLine = false;
|
||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
|
||||
window->DC.MenuBarAppending = true;
|
||||
AlignTextToFramePadding();
|
||||
@ -6773,6 +6777,7 @@ void ImGui::EndMenuBar()
|
||||
g.GroupStack.back().EmitItem = false;
|
||||
EndGroup(); // Restore position on layer 0
|
||||
window->DC.LayoutType = ImGuiLayoutType_Vertical;
|
||||
window->DC.IsSameLine = false;
|
||||
window->DC.NavLayerCurrent = ImGuiNavLayer_Main;
|
||||
window->DC.MenuBarAppending = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user