mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Fixed lower-right resize grip hit box not scaling along with its rendered size (#287)
This commit is contained in:
parent
3ccbdc8423
commit
da3baebd43
11
imgui.cpp
11
imgui.cpp
@ -3972,10 +3972,12 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
||||
else
|
||||
{
|
||||
ImU32 resize_col = 0;
|
||||
const float resize_corner_size = ImMax(g.FontSize * 1.35f, window_rounding + 1.0f + g.FontSize * 0.2f);
|
||||
if (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && !(flags & ImGuiWindowFlags_NoResize))
|
||||
{
|
||||
// Manual resize
|
||||
const ImRect resize_rect(window->Rect().GetBR()-ImVec2(14,14), window->Rect().GetBR());
|
||||
const ImVec2 br = window->Rect().GetBR();
|
||||
const ImRect resize_rect(br - ImVec2(resize_corner_size * 0.75f, resize_corner_size * 0.75f), br);
|
||||
const ImGuiID resize_id = window->GetID("#RESIZE");
|
||||
bool hovered, held;
|
||||
ButtonBehavior(resize_rect, resize_id, &hovered, &held, true, ImGuiButtonFlags_FlattenChilds);
|
||||
@ -4049,12 +4051,9 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
||||
// (after the input handling so we don't have a frame of latency)
|
||||
if (!(flags & ImGuiWindowFlags_NoResize))
|
||||
{
|
||||
const float base_size = g.FontSize * 1.35f;
|
||||
const float min_size = window_rounding + 1.0f + g.FontSize * 0.2f;
|
||||
const float corner_size = ImMax(base_size, min_size);
|
||||
const ImVec2 br = window->Rect().GetBR();
|
||||
window->DrawList->PathLineTo(br + ImVec2(-corner_size, 0.0f));
|
||||
window->DrawList->PathLineTo(br + ImVec2(0.0f, -corner_size));
|
||||
window->DrawList->PathLineTo(br + ImVec2(-resize_corner_size, 0.0f));
|
||||
window->DrawList->PathLineTo(br + ImVec2(0.0f, -resize_corner_size));
|
||||
window->DrawList->PathArcToFast(ImVec2(br.x - window_rounding, br.y - window_rounding), window_rounding, 0, 3);
|
||||
window->DrawList->PathFill(resize_col);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user