| 12881 | new_size.x = layout->Size.x; |
| 12882 | if (!auto_height) |
| 12883 | new_size.y = layout->Size.y; |
| 12884 | |
| 12885 | layout->CurrentSize = new_size; |
| 12886 | |
| 12887 | ImVec2 measured_size = new_size; |
| 12888 | if ((auto_width || auto_height) && layout->Parent) |
| 12889 | { |
| 12890 | if (layout->Type == ImGuiLayoutType_Horizontal && auto_width && layout->Parent->CurrentSize.x > 0) |
| 12891 | layout->CurrentSize.x = layout->Parent->CurrentSize.x; |
| 12892 | else if (layout->Type == ImGuiLayoutType_Vertical && auto_height && layout->Parent->CurrentSize.y > 0) |
| 12893 | layout->CurrentSize.y = layout->Parent->CurrentSize.y; |
| 12894 | |
| 12895 | BalanceLayoutSprings(*layout); |
| 12896 | |
| 12897 | measured_size = layout->CurrentSize; |
| 12898 | } |
| 12899 | |
| 12900 | layout->CurrentSize = new_size; |
| 12901 | layout->MeasuredSize = measured_size; |
| 12902 | |
| 12903 | PopID(); |
| 12904 | |
| 12905 | ImVec2 current_layout_item_max = ImVec2(0.0f, 0.0f); |
| 12906 | if (window->DC.CurrentLayoutItem) |
| 12907 | current_layout_item_max = ImMax(window->DC.CurrentLayoutItem->MeasuredBounds.Max, layout->StartPos + new_size); |
| 12908 | |
| 12909 | window->DC.CursorPos = layout->StartPos; |
| 12910 | window->DC.CursorMaxPos = layout->StartCursorMaxPos; |
| 12911 | ItemSize(new_size); |
| 12912 | ItemAdd(ImRect(layout->StartPos, layout->StartPos + measured_size), 0); |
| 12913 | |
| 12914 | if (window->DC.CurrentLayoutItem) |
| 12915 | window->DC.CurrentLayoutItem->MeasuredBounds.Max = current_layout_item_max; |
| 12916 | |
| 12917 | if (layout->Parent == NULL) |
| 12918 | BalanceChildLayouts(*layout); |
| 12919 | |
| 12920 | EndLayoutClipRect(*layout); |
| 12921 | |
| 12922 | //window->DrawList->AddRect(layout->StartPos, layout->StartPos + measured_size, IM_COL32(0,255,0,255)); // [DEBUG] |
| 12923 | //window->DrawList->AddRect(window->DC.LastItemRect.Min, window->DC.LastItemRect.Max, IM_COL32(255,255,0,255)); // [DEBUG] |
| 12924 | } |
| 12925 | |
| 12926 | static ImVec2 ImGui::CalculateLayoutSize(ImGuiLayout& layout, bool collapse_springs) |
| 12927 | { |
| 12928 | ImVec2 bounds = ImVec2(0.0f, 0.0f); |
| 12929 | |
| 12930 | if (layout.Type == ImGuiLayoutType_Vertical) |
| 12931 | { |
| 12932 | for (int i = 0; i < layout.Items.Size; i++) |
| 12933 | { |
| 12934 | ImGuiLayoutItem& item = layout.Items[i]; |
| 12935 | ImVec2 item_size = item.MeasuredBounds.GetSize(); |
| 12936 | |
| 12937 | if (item.Type == ImGuiLayoutItemType_Item) |
| 12938 | { |
| 12939 | bounds.x = ImMax(bounds.x, item_size.x); |
| 12940 | bounds.y += item_size.y; |
nothing calls this directly
no test coverage detected