1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-24 07:40:22 +01:00

BeginMenu(): Fixed menu popup horizontal offset being off the item in the menu bar when WindowPadding=0.0f.

This commit is contained in:
omar 2018-09-14 11:27:18 +02:00
parent ca5dc0c019
commit c12da2a607
2 changed files with 2 additions and 1 deletions

View File

@ -45,6 +45,7 @@ Other Changes:
erroneously wrapped the value to one of the min/max edge. (#2024, #708, #320, #2075). erroneously wrapped the value to one of the min/max edge. (#2024, #708, #320, #2075).
- DragFloat: Disabled using power curve when one edge is FLT_MAX (broken in 1.61). (#2024) - DragFloat: Disabled using power curve when one edge is FLT_MAX (broken in 1.61). (#2024)
- DragFloat: Disabled setting a default drag speed when one edge is FLT_MAX. (#2024) - DragFloat: Disabled setting a default drag speed when one edge is FLT_MAX. (#2024)
- BeginMenu(): Fixed menu popup horizontal offset being off the item in the menu bar when WindowPadding=0.0f.
----------------------------------------------------------------------- -----------------------------------------------------------------------

View File

@ -5548,7 +5548,7 @@ bool ImGui::BeginMenu(const char* label, bool enabled)
// Menu inside an horizontal menu bar // Menu inside an horizontal menu bar
// Selectable extend their highlight by half ItemSpacing in each direction. // Selectable extend their highlight by half ItemSpacing in each direction.
// For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin() // For ChildMenu, the popup position will be overwritten by the call to FindBestWindowPosForPopup() in Begin()
popup_pos = ImVec2(pos.x - window->WindowPadding.x, pos.y - style.FramePadding.y + window->MenuBarHeight()); popup_pos = ImVec2(pos.x - 1.0f - (float)(int)(style.ItemSpacing.x * 0.5f), pos.y - style.FramePadding.y + window->MenuBarHeight());
window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f); window->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);
PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f); PushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);
float w = label_size.x; float w = label_size.x;