1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-12 02:00:58 +01:00

Menus: Tweak for first-level menu windows to be positioned regardless of MenuBarHeight() which is not stored in window, allowing undocumented modification of the menu bar height).

This commit is contained in:
omar 2020-03-02 20:18:43 +01:00
parent 8c683de33f
commit 897704cb49
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ Other Changes:
branch pressing arrow keys while dragging a window from a tab could trigger an assert. (#3025)
- ColorButton: Added ImGuiColorEditFlags_NoBorder flag to remove the border normally enforced
by default for standalone ColorButton.
- BeginMenu: Using same ID multiple times appends content to a menu. (#1207)
- BeginMenu: Using same ID multiple times appends content to a menu. (#1207) [@rokups]
- BeginMenu: Fixed a bug where SetNextWindowXXX data before a BeginMenu() would not be cleared
when the menu is not open. (#3030)
- InputText: Fixed password fields displaying ASCII spaces as blanks instead of using the '*'

View File

@ -7830,7 +7830,7 @@ ImVec2 ImGui::FindBestWindowPosForPopup(ImGuiWindow* window)
float horizontal_overlap = g.Style.ItemInnerSpacing.x; // We want some overlap to convey the relative depth of each menu (currently the amount of overlap is hard-coded to style.ItemSpacing.x).
ImRect r_avoid;
if (parent_window->DC.MenuBarAppending)
r_avoid = ImRect(-FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight(), FLT_MAX, parent_window->Pos.y + parent_window->TitleBarHeight() + parent_window->MenuBarHeight());
r_avoid = ImRect(-FLT_MAX, parent_window->ClipRect.Min.y, FLT_MAX, parent_window->ClipRect.Max.y); // Avoid parent menu-bar. If we wanted multi-line menu-bar, we may instead want to have the calling window setup e.g. a NextWindowData.PosConstraintAvoidRect field
else
r_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);
return FindBestWindowPosForPopupEx(window->Pos, window->Size, &window->AutoPosLastDirection, r_outer, r_avoid);