mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-09 16:05:56 +01:00
Windows: Add GetResizeBorderRect() version with an ImRect parameter
This commit is contained in:
parent
be374fa598
commit
c4a3796446
17
imgui.cpp
17
imgui.cpp
@ -6906,19 +6906,24 @@ static const ImGuiResizeBorderDef resize_border_def[4] =
|
||||
{ ImVec2(0, -1), ImVec2(1, 1), ImVec2(0, 1), IM_PI * 0.50f } // Down
|
||||
};
|
||||
|
||||
static ImRect GetResizeBorderRect(ImGuiWindow* window, int border_n, float perp_padding, float thickness)
|
||||
static inline ImRect GetResizeBorderRect(ImRect rect, int border_n, float perp_padding, float thickness)
|
||||
{
|
||||
ImRect rect = window->Rect();
|
||||
if (thickness == 0.0f)
|
||||
rect.Max -= ImVec2(1, 1);
|
||||
if (border_n == ImGuiDir_Left) { return ImRect(rect.Min.x - thickness, rect.Min.y + perp_padding, rect.Min.x + thickness, rect.Max.y - perp_padding); }
|
||||
if (border_n == ImGuiDir_Right) { return ImRect(rect.Max.x - thickness, rect.Min.y + perp_padding, rect.Max.x + thickness, rect.Max.y - perp_padding); }
|
||||
if (border_n == ImGuiDir_Up) { return ImRect(rect.Min.x + perp_padding, rect.Min.y - thickness, rect.Max.x - perp_padding, rect.Min.y + thickness); }
|
||||
if (border_n == ImGuiDir_Down) { return ImRect(rect.Min.x + perp_padding, rect.Max.y - thickness, rect.Max.x - perp_padding, rect.Max.y + thickness); }
|
||||
if (border_n == ImGuiDir_Left) { return ImRect(rect.Min.x - thickness, rect.Min.y + perp_padding, rect.Min.x + thickness, rect.Max.y - perp_padding); }
|
||||
if (border_n == ImGuiDir_Right) { return ImRect(rect.Max.x - thickness, rect.Min.y + perp_padding, rect.Max.x + thickness, rect.Max.y - perp_padding); }
|
||||
if (border_n == ImGuiDir_Up) { return ImRect(rect.Min.x + perp_padding, rect.Min.y - thickness, rect.Max.x - perp_padding, rect.Min.y + thickness); }
|
||||
if (border_n == ImGuiDir_Down) { return ImRect(rect.Min.x + perp_padding, rect.Max.y - thickness, rect.Max.x - perp_padding, rect.Max.y + thickness); }
|
||||
IM_ASSERT(0);
|
||||
return ImRect();
|
||||
}
|
||||
|
||||
static inline ImRect GetResizeBorderRect(ImGuiWindow* window, int border_n, float perp_padding, float thickness)
|
||||
{
|
||||
ImRect rect = window->Rect();
|
||||
return GetResizeBorderRect(rect, border_n, perp_padding, thickness);
|
||||
}
|
||||
|
||||
// 0..3: corners (Lower-right, Lower-left, Unused, Unused)
|
||||
ImGuiID ImGui::GetWindowResizeCornerID(ImGuiWindow* window, int n)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user