mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 13:37:00 +00:00
Internals: Renamed FindBestPopupWindowPos() to FindBestWindowPosForPopup()
This commit is contained in:
parent
e118239f69
commit
9872297a84
12
imgui.cpp
12
imgui.cpp
@ -656,7 +656,7 @@ static ImRect GetVisibleRect();
|
|||||||
static void CloseInactivePopups(ImGuiWindow* ref_window);
|
static void CloseInactivePopups(ImGuiWindow* ref_window);
|
||||||
static void ClosePopupToLevel(int remaining);
|
static void ClosePopupToLevel(int remaining);
|
||||||
static ImGuiWindow* GetFrontMostModalRootWindow();
|
static ImGuiWindow* GetFrontMostModalRootWindow();
|
||||||
static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& rect_to_avoid);
|
static ImVec2 FindBestWindowPosForPopup(const ImVec2& base_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& rect_to_avoid);
|
||||||
|
|
||||||
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data);
|
static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data);
|
||||||
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
|
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
|
||||||
@ -4026,7 +4026,7 @@ static void CheckStacksSize(ImGuiWindow* window, bool write)
|
|||||||
IM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup));
|
IM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ImVec2 FindBestPopupWindowPos(const ImVec2& base_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_avoid)
|
static ImVec2 FindBestWindowPosForPopup(const ImVec2& base_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_avoid)
|
||||||
{
|
{
|
||||||
const ImGuiStyle& style = GImGui->Style;
|
const ImGuiStyle& style = GImGui->Style;
|
||||||
|
|
||||||
@ -4150,6 +4150,8 @@ static ImVec2 CalcSizeFullWithConstraint(ImGuiWindow* window, ImVec2 new_size)
|
|||||||
new_size = data.DesiredSize;
|
new_size = data.DesiredSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Minimum size
|
||||||
if (!(window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysAutoResize)))
|
if (!(window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysAutoResize)))
|
||||||
{
|
{
|
||||||
new_size = ImMax(new_size, g.Style.WindowMinSize);
|
new_size = ImMax(new_size, g.Style.WindowMinSize);
|
||||||
@ -4534,12 +4536,12 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
rect_to_avoid = ImRect(-FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight(), FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight() + parent_window->MenuBarHeight());
|
rect_to_avoid = ImRect(-FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight(), FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight() + parent_window->MenuBarHeight());
|
||||||
else
|
else
|
||||||
rect_to_avoid = ImRect(parent_window->Pos.x + horizontal_overlap, -FLT_MAX, parent_window->Pos.x + parent_window->Size.x - horizontal_overlap - parent_window->ScrollbarSizes.x, FLT_MAX);
|
rect_to_avoid = ImRect(parent_window->Pos.x + horizontal_overlap, -FLT_MAX, parent_window->Pos.x + parent_window->Size.x - horizontal_overlap - parent_window->ScrollbarSizes.x, FLT_MAX);
|
||||||
window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
window->PosFloat = FindBestWindowPosForPopup(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
||||||
}
|
}
|
||||||
else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize)
|
else if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize)
|
||||||
{
|
{
|
||||||
ImRect rect_to_avoid(window->PosFloat.x - 1, window->PosFloat.y - 1, window->PosFloat.x + 1, window->PosFloat.y + 1);
|
ImRect rect_to_avoid(window->PosFloat.x - 1, window->PosFloat.y - 1, window->PosFloat.x + 1, window->PosFloat.y + 1);
|
||||||
window->PosFloat = FindBestPopupWindowPos(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
window->PosFloat = FindBestWindowPosForPopup(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position tooltip (always follows mouse)
|
// Position tooltip (always follows mouse)
|
||||||
@ -4547,7 +4549,7 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
|||||||
{
|
{
|
||||||
ImVec2 ref_pos = g.IO.MousePos;
|
ImVec2 ref_pos = g.IO.MousePos;
|
||||||
ImRect rect_to_avoid(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24, ref_pos.y + 24); // FIXME: Completely hard-coded. Store boxes in mouse cursor data? Scale? Center on cursor hit-point?
|
ImRect rect_to_avoid(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24, ref_pos.y + 24); // FIXME: Completely hard-coded. Store boxes in mouse cursor data? Scale? Center on cursor hit-point?
|
||||||
window->PosFloat = FindBestPopupWindowPos(ref_pos, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
window->PosFloat = FindBestWindowPosForPopup(ref_pos, window->Size, &window->AutoPosLastDirection, rect_to_avoid);
|
||||||
if (window->AutoPosLastDirection == ImGuiDir_None)
|
if (window->AutoPosLastDirection == ImGuiDir_None)
|
||||||
window->PosFloat = ref_pos + ImVec2(2,2); // If there's not enough room, for tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible.
|
window->PosFloat = ref_pos + ImVec2(2,2); // If there's not enough room, for tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible.
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user