mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Misc: Fixed PushItemWidth(-width) (for right-side alignment) laying out certain items (button, listbox, etc.) with negative sizes if the 'width' argument was smaller than the available width at the time of item submission,
This commit is contained in:
parent
a1cf7d636d
commit
0e46d65b03
@ -53,6 +53,8 @@ Other Changes:
|
|||||||
- Window: Window close button is horizontally aligned with style.FramePadding.x.
|
- Window: Window close button is horizontally aligned with style.FramePadding.x.
|
||||||
- Columns: Fixed boundary of clipping being off by 1 pixel within the left column.
|
- Columns: Fixed boundary of clipping being off by 1 pixel within the left column.
|
||||||
- Combo, Slider, Scrollbar: Improve rendering in situation when there's only a few pixels available (<3 pixels).
|
- Combo, Slider, Scrollbar: Improve rendering in situation when there's only a few pixels available (<3 pixels).
|
||||||
|
- Misc: Fixed PushItemWidth(-width) (for right-side alignment) laying out certain items (button, listbox, etc.)
|
||||||
|
with negative sizes if the 'width' argument was smaller than the available width at the time of item submission,
|
||||||
- Misc: Added IM_MALLOC/IM_FREE macros mimicking IM_NEW/IM_DELETE so user doesn't need to revert
|
- Misc: Added IM_MALLOC/IM_FREE macros mimicking IM_NEW/IM_DELETE so user doesn't need to revert
|
||||||
to using the ImGui::MemAlloc()/MemFree() calls directly.
|
to using the ImGui::MemAlloc()/MemFree() calls directly.
|
||||||
- Metrics: Added "Show windows rectangles" tool to visualize the different rectangles.
|
- Metrics: Added "Show windows rectangles" tool to visualize the different rectangles.
|
||||||
|
@ -5789,6 +5789,7 @@ float ImGui::CalcItemWidth()
|
|||||||
// [Internal] Calculate full item size given user provided 'size' parameter and default width/height. Default width is often == CalcItemWidth().
|
// [Internal] Calculate full item size given user provided 'size' parameter and default width/height. Default width is often == CalcItemWidth().
|
||||||
// Those two functions CalcItemWidth vs CalcItemSize are awkwardly named because they are not fully symmetrical.
|
// Those two functions CalcItemWidth vs CalcItemSize are awkwardly named because they are not fully symmetrical.
|
||||||
// Note that only CalcItemWidth() is publicly exposed.
|
// Note that only CalcItemWidth() is publicly exposed.
|
||||||
|
// The 4.0f here may be changed to match CalcItemWidth() and/or BeginChild() (right now we have a mismatch which is harmless but undesirable)
|
||||||
ImVec2 ImGui::CalcItemSize(ImVec2 size, float default_w, float default_h)
|
ImVec2 ImGui::CalcItemSize(ImVec2 size, float default_w, float default_h)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||||
@ -5800,12 +5801,12 @@ ImVec2 ImGui::CalcItemSize(ImVec2 size, float default_w, float default_h)
|
|||||||
if (size.x == 0.0f)
|
if (size.x == 0.0f)
|
||||||
size.x = default_w;
|
size.x = default_w;
|
||||||
else if (size.x < 0.0f)
|
else if (size.x < 0.0f)
|
||||||
size.x = ImMax(4.0f, region_max.x - window->DC.CursorPos.x) + size.x;
|
size.x = ImMax(4.0f, region_max.x - window->DC.CursorPos.x + size.x);
|
||||||
|
|
||||||
if (size.y == 0.0f)
|
if (size.y == 0.0f)
|
||||||
size.y = default_h;
|
size.y = default_h;
|
||||||
else if (size.y < 0.0f)
|
else if (size.y < 0.0f)
|
||||||
size.y = ImMax(4.0f, region_max.y - window->DC.CursorPos.y) + size.y;
|
size.y = ImMax(4.0f, region_max.y - window->DC.CursorPos.y + size.y);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user