mirror of
https://github.com/shadps4-emu/ext-imgui.git
synced 2024-11-27 12:11:34 +00:00
Windows: BeginChild(): fixed auto-fit calculation when using either (not both) ResizeX/ResizeY and double-clicking on a border. (#1710)
Calculation incorrectly didn't always account for scrollbar as it assumed the other axis would also be auto-fit.
This commit is contained in:
parent
374b9a7fb4
commit
29439bdd27
@ -56,6 +56,10 @@ Breaking changes:
|
||||
|
||||
Other changes:
|
||||
|
||||
- Windows: BeginChild(): fixed visibility of fully clipped child windows and tables to Test Engine.
|
||||
- Windows: BeginChild(): fixed auto-fit calculation when using either (not both) ResizeX/ResizeY
|
||||
and double-clicking on a border. Calculation incorrectly didn't always account for scrollbar as
|
||||
it assumed the other axis would also be auto-fit. (#1710)
|
||||
- Inputs: added Shortcut() function (w/ routing policies) in public API. (#456, #2637)
|
||||
- using ImGui::Shortcut(ImGuiMod_Ctrl | ImGuiKey_C); with default policy:
|
||||
- checks that CTRL+C is pressed,
|
||||
@ -84,7 +88,6 @@ Other changes:
|
||||
- Inputs: (OSX) Ctrl+Left Click alias as a Right click. (#2343) [@haldean, @ocornut]
|
||||
- Inputs: Fixed ImGui::GetKeyName(ImGuiKey_None) from returning "N/A" or "None" depending
|
||||
on value of IMGUI_DISABLE_OBSOLETE_KEYIO. It always returns "None".
|
||||
- Windows: BeginChild(): fixed visibility of fully clipped child windows and tables to Test Engine.
|
||||
- Nav: fixed holding Ctrl or gamepad L1 from not slowing down keyboard/gamepad tweak speed.
|
||||
Broken during a refactor refactor for 1.89. Holding Shift/R1 to speed up wasn't broken.
|
||||
- Tables: fixed cell background of fully clipped row overlapping with header. (#7575, #7041) [@prabuinet]
|
||||
|
@ -5844,6 +5844,14 @@ static ImVec2 CalcWindowAutoFitSize(ImGuiWindow* window, const ImVec2& size_cont
|
||||
ImVec2 size_max = ((window->Flags & ImGuiWindowFlags_ChildWindow) && !(window->Flags & ImGuiWindowFlags_Popup)) ? ImVec2(FLT_MAX, FLT_MAX) : ImGui::GetMainViewport()->WorkSize - style.DisplaySafeAreaPadding * 2.0f;
|
||||
ImVec2 size_auto_fit = ImClamp(size_desired, size_min, size_max);
|
||||
|
||||
// FIXME: CalcWindowAutoFitSize() doesn't take into account that only one axis may be auto-fit when calculating scrollbars,
|
||||
// we may need to compute/store three variants of size_auto_fit, for x/y/xy.
|
||||
// Here we implement a workaround for child windows only, but a full solution would apply to normal windows as well:
|
||||
if ((window->ChildFlags & ImGuiChildFlags_ResizeX) && !(window->ChildFlags & ImGuiChildFlags_ResizeY))
|
||||
size_auto_fit.y = window->SizeFull.y;
|
||||
else if (!(window->ChildFlags & ImGuiChildFlags_ResizeX) && (window->ChildFlags & ImGuiChildFlags_ResizeY))
|
||||
size_auto_fit.x = window->SizeFull.x;
|
||||
|
||||
// When the window cannot fit all contents (either because of constraints, either because screen is too small),
|
||||
// we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than ViewportSize-WindowPadding.
|
||||
ImVec2 size_auto_fit_after_constraint = CalcWindowSizeAfterConstraint(window, size_auto_fit);
|
||||
@ -6049,6 +6057,7 @@ static int ImGui::UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& si
|
||||
if (held && g.IO.MouseDoubleClicked[0])
|
||||
{
|
||||
// Double-clicking bottom or right border auto-fit on this axis
|
||||
// FIXME: CalcWindowAutoFitSize() doesn't take into account that only one side may be auto-fit when calculating scrollbars.
|
||||
// FIXME: Support top and right borders: rework CalcResizePosSizeFromAnyCorner() to be reusable in both cases.
|
||||
if (border_n == 1 || border_n == 3) // Right and bottom border
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user