From 770430ad9eedbf9b188bc6cc0192fdef516a72d4 Mon Sep 17 00:00:00 2001 From: Zeh Fernando Date: Sat, 14 Oct 2023 20:47:12 -0400 Subject: [PATCH] Menus: slack triangle for submenu opening has better fit Don't move the corners of the triangle horizontally anymore. This gives more accurate angles for quick mouse moves --- imgui_widgets.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 9b2b9707ba15..705929616971 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -7512,9 +7512,6 @@ bool ImGui::BeginMenuEx(const char* label, const char* icon, bool enabled) ImVec2 tb = (child_dir > 0.0f) ? next_window_rect.GetTL() : next_window_rect.GetTR(); ImVec2 tc = (child_dir > 0.0f) ? next_window_rect.GetBL() : next_window_rect.GetBR(); float extra = ImClamp(ImFabs(ta.x - tb.x) * 0.30f, ref_unit * 0.5f, ref_unit * 2.5f); // add a bit of extra slack. - ta.x += child_dir * -0.5f; - tb.x += child_dir * ref_unit; - tc.x += child_dir * ref_unit; tb.y = ta.y + ImMax((tb.y - extra) - ta.y, -ref_unit * 8.0f); // triangle has maximum height to limit the slope and the bias toward large sub-menus tc.y = ta.y + ImMin((tc.y + extra) - ta.y, +ref_unit * 8.0f); moving_toward_child_menu = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos);