mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
SplitterBehavior: Fix for when the sizes are already under the minimum desired size.
This commit is contained in:
parent
341ebd961b
commit
ac39c4b2a8
26
imgui.cpp
26
imgui.cpp
@ -13050,17 +13050,25 @@ bool ImGui::SplitterBehavior(const ImRect& bb, ImGuiID id, ImGuiAxis axis, float
|
|||||||
float mouse_delta = (axis == ImGuiAxis_Y) ? mouse_delta_2d.y : mouse_delta_2d.x;
|
float mouse_delta = (axis == ImGuiAxis_Y) ? mouse_delta_2d.y : mouse_delta_2d.x;
|
||||||
|
|
||||||
// Minimum pane size
|
// Minimum pane size
|
||||||
if (mouse_delta < min_size1 - *size1)
|
float size_1_maximum_delta = ImMax(0.0f, *size1 - min_size1);
|
||||||
mouse_delta = min_size1 - *size1;
|
float size_2_maximum_delta = ImMax(0.0f, *size2 - min_size2);
|
||||||
if (mouse_delta > *size2 - min_size2)
|
if (mouse_delta < -size_1_maximum_delta)
|
||||||
mouse_delta = *size2 - min_size2;
|
mouse_delta = -size_1_maximum_delta;
|
||||||
|
if (mouse_delta > size_2_maximum_delta)
|
||||||
|
mouse_delta = size_2_maximum_delta;
|
||||||
|
|
||||||
// Apply resize
|
// Apply resize
|
||||||
*size1 += mouse_delta;
|
if (mouse_delta != 0.0f)
|
||||||
*size2 -= mouse_delta;
|
{
|
||||||
bb_render.Translate((axis == ImGuiAxis_X) ? ImVec2(mouse_delta, 0.0f) : ImVec2(0.0f, mouse_delta));
|
if (mouse_delta < 0.0f)
|
||||||
|
IM_ASSERT(*size1 + mouse_delta >= min_size1);
|
||||||
MarkItemValueChanged(id);
|
if (mouse_delta > 0.0f)
|
||||||
|
IM_ASSERT(*size2 - mouse_delta >= min_size2);
|
||||||
|
*size1 += mouse_delta;
|
||||||
|
*size2 -= mouse_delta;
|
||||||
|
bb_render.Translate((axis == ImGuiAxis_X) ? ImVec2(mouse_delta, 0.0f) : ImVec2(0.0f, mouse_delta));
|
||||||
|
MarkItemValueChanged(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
|
Loading…
Reference in New Issue
Block a user