mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
Tabs: Fixed ShrinkWidths() redistribution of remainder leading to infinite bug + over redistribution. (#5652)
Amend c4b91017
This commit is contained in:
parent
2171375f93
commit
b137f31b8c
@ -97,6 +97,9 @@ Other Changes:
|
|||||||
next row in such state where subsequent SameLine() would move back to previous row.
|
next row in such state where subsequent SameLine() would move back to previous row.
|
||||||
- Tabs: Fixed a crash when closing multiple windows (possible with docking only) with an
|
- Tabs: Fixed a crash when closing multiple windows (possible with docking only) with an
|
||||||
appended TabItemButton(). (#5515, #3291) [@rokups]
|
appended TabItemButton(). (#5515, #3291) [@rokups]
|
||||||
|
- Tabs: Fixed shrinking policy leading to infinite loops when fed unrounded tab widths. (#5652)
|
||||||
|
- Tabs: Fixed shrinking policy sometimes erroneously making right-most tabs stray a little out
|
||||||
|
bar boundaries (bug in 1.88). (#5652).
|
||||||
- Window: Fixed a potential crash when appending to a child window. (#5515, #3496, #4797) [@rokups]
|
- Window: Fixed a potential crash when appending to a child window. (#5515, #3496, #4797) [@rokups]
|
||||||
- IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey
|
- IO: Added ImGuiKey_MouseXXX aliases for mouse buttons/wheel so all operations done on ImGuiKey
|
||||||
can apply to mouse data as well. (#4921)
|
can apply to mouse data as well. (#4921)
|
||||||
|
2
imgui.h
2
imgui.h
@ -65,7 +65,7 @@ Index of this file:
|
|||||||
// Version
|
// Version
|
||||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY99 then bounce up to XYY00, XYY01 etc. when release tagging happens)
|
||||||
#define IMGUI_VERSION "1.89 WIP"
|
#define IMGUI_VERSION "1.89 WIP"
|
||||||
#define IMGUI_VERSION_NUM 18816
|
#define IMGUI_VERSION_NUM 18817
|
||||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
|
||||||
#define IMGUI_HAS_TABLE
|
#define IMGUI_HAS_TABLE
|
||||||
|
|
||||||
|
@ -1575,8 +1575,8 @@ void ImGui::ShrinkWidths(ImGuiShrinkWidthItem* items, int count, float width_exc
|
|||||||
width_excess += items[n].Width - width_rounded;
|
width_excess += items[n].Width - width_rounded;
|
||||||
items[n].Width = width_rounded;
|
items[n].Width = width_rounded;
|
||||||
}
|
}
|
||||||
while (width_excess > 0.0f)
|
while (width_excess >= 1.0f)
|
||||||
for (int n = 0; n < count; n++)
|
for (int n = 0; n < count && width_excess >= 1.0f; n++)
|
||||||
if (items[n].Width + 1.0f <= items[n].InitialWidth)
|
if (items[n].Width + 1.0f <= items[n].InitialWidth)
|
||||||
{
|
{
|
||||||
items[n].Width += 1.0f;
|
items[n].Width += 1.0f;
|
||||||
@ -7596,7 +7596,7 @@ static void ImGui::TabBarLayout(ImGuiTabBar* tab_bar)
|
|||||||
width_excess = (section_0_w + section_2_w) - tab_bar->BarRect.GetWidth(); // Excess used to shrink leading/trailing section
|
width_excess = (section_0_w + section_2_w) - tab_bar->BarRect.GetWidth(); // Excess used to shrink leading/trailing section
|
||||||
|
|
||||||
// With ImGuiTabBarFlags_FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore
|
// With ImGuiTabBarFlags_FittingPolicyScroll policy, we will only shrink leading/trailing if the central section is not visible anymore
|
||||||
if (width_excess > 0.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible))
|
if (width_excess >= 1.0f && ((tab_bar->Flags & ImGuiTabBarFlags_FittingPolicyResizeDown) || !central_section_is_visible))
|
||||||
{
|
{
|
||||||
int shrink_data_count = (central_section_is_visible ? sections[1].TabCount : sections[0].TabCount + sections[2].TabCount);
|
int shrink_data_count = (central_section_is_visible ? sections[1].TabCount : sections[0].TabCount + sections[2].TabCount);
|
||||||
int shrink_data_offset = (central_section_is_visible ? sections[0].TabCount + sections[2].TabCount : 0);
|
int shrink_data_offset = (central_section_is_visible ? sections[0].TabCount + sections[2].TabCount : 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user