1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-25 16:20:28 +01:00

Merged from Navigation branch

This commit is contained in:
omar 2017-08-29 17:09:56 +08:00
parent c9298c2657
commit aef041f948

View File

@ -4255,24 +4255,27 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
bool hovered, held; bool hovered, held;
ButtonBehavior(resize_rect, resize_id, &hovered, &held, ImGuiButtonFlags_FlattenChilds); ButtonBehavior(resize_rect, resize_id, &hovered, &held, ImGuiButtonFlags_FlattenChilds);
resize_col = GetColorU32(held ? ImGuiCol_ResizeGripActive : hovered ? ImGuiCol_ResizeGripHovered : ImGuiCol_ResizeGrip); resize_col = GetColorU32(held ? ImGuiCol_ResizeGripActive : hovered ? ImGuiCol_ResizeGripHovered : ImGuiCol_ResizeGrip);
if (hovered || held) if (hovered || held)
g.MouseCursor = ImGuiMouseCursor_ResizeNWSE; g.MouseCursor = ImGuiMouseCursor_ResizeNWSE;
ImVec2 size_target(FLT_MAX,FLT_MAX);
if (g.HoveredWindow == window && held && g.IO.MouseDoubleClicked[0]) if (g.HoveredWindow == window && held && g.IO.MouseDoubleClicked[0])
{ {
// Manual auto-fit when double-clicking // Manual auto-fit when double-clicking
ApplySizeFullWithConstraint(window, size_auto_fit); size_target = size_auto_fit;
MarkIniSettingsDirty(window);
ClearActiveID(); ClearActiveID();
} }
else if (held) else if (held)
{ {
// We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position // We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position
ApplySizeFullWithConstraint(window, (g.IO.MousePos - g.ActiveIdClickOffset + resize_rect.GetSize()) - window->Pos); size_target = (g.IO.MousePos - g.ActiveIdClickOffset + resize_rect.GetSize()) - window->Pos;
MarkIniSettingsDirty(window);
} }
if (size_target.x != FLT_MAX && size_target.y != FLT_MAX)
{
ApplySizeFullWithConstraint(window, size_target);
MarkIniSettingsDirty(window);
}
window->Size = window->SizeFull; window->Size = window->SizeFull;
title_bar_rect = window->TitleBarRect(); title_bar_rect = window->TitleBarRect();
} }