mirror of
https://github.com/xemu-project/imgui.git
synced 2024-11-23 10:19:46 +00:00
Menus: Fixed vertical alignments of MenuItem() calls within a menu bar. (broken by f8fae022
). (#4538)
This commit is contained in:
parent
82754561e2
commit
7b8bc864e9
@ -56,6 +56,7 @@ Other Changes:
|
||||
the arrow section of TreeNode(), the +/- buttons of InputInt()/InputFloat(), Selectable() with
|
||||
ImGuiSelectableFlags_SelectOnRelease. More generally: any direct use of ButtonBehavior() with
|
||||
the PressedOnClick/PressedOnDoubleClick/PressedOnRelease button policy.
|
||||
- Menus: Fixed vertical alignments of MenuItem() calls within a menu bar. (broken in 1.84). (#4538)
|
||||
- Menus: Adjust closing logic to accomodate for varying font size and dpi.
|
||||
- Menus: Fixed crash when navigating left inside a child window inside a sub-menu. (#4510).
|
||||
- Drag and Drop: Fixed using BeginDragDropSource() inside a BeginChild() that returned false. (#4515)
|
||||
|
@ -379,6 +379,7 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
ImGui::MenuItem("Documents", NULL, &show_app_documents);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
//if (ImGui::MenuItem("MenuItem")) {} // You can also use MenuItem() inside a menu bar!
|
||||
if (ImGui::BeginMenu("Tools"))
|
||||
{
|
||||
ImGui::MenuItem("Metrics/Debugger", NULL, &show_app_metrics);
|
||||
|
@ -6851,7 +6851,7 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Menu inside a menu
|
||||
// Menu inside a regular/vertical menu
|
||||
// (In a typical menu window where all items are BeginMenu() or MenuItem() calls, extra_w will always be 0.0f.
|
||||
// Only when they are other items sticking out we're going to add spacing, yet only register minimum width into the layout system.
|
||||
popup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);
|
||||
@ -7007,10 +7007,11 @@ bool ImGui::MenuItemEx(const char* label, const char* icon, const char* shortcut
|
||||
// Note that in this situation: we don't render the shortcut, we render a highlight instead of the selected tick mark.
|
||||
float w = label_size.x;
|
||||
window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * 0.5f);
|
||||
ImVec2 text_pos(window->DC.CursorPos.x + offsets->OffsetLabel, window->DC.CursorPos.y + window->DC.CurrLineTextBaseOffset);
|
||||
PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x * 2.0f, style.ItemSpacing.y));
|
||||
pressed = Selectable("", selected, flags, ImVec2(w, 0.0f));
|
||||
PopStyleVar();
|
||||
RenderText(pos + ImVec2(offsets->OffsetLabel, 0.0f), label);
|
||||
RenderText(text_pos, label);
|
||||
window->DC.CursorPos.x += IM_FLOOR(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user