From 5c42f14d0ea4481b6604a4d8aa97313ca2e1f64c Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Thu, 2 Apr 2026 22:26:31 +0800 Subject: [PATCH] fix: tighten top run toolbar chrome --- editor/src/panels/MenuBar.cpp | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/editor/src/panels/MenuBar.cpp b/editor/src/panels/MenuBar.cpp index cf58cdd1..89d4ffe1 100644 --- a/editor/src/panels/MenuBar.cpp +++ b/editor/src/panels/MenuBar.cpp @@ -17,10 +17,10 @@ namespace Editor { namespace { -constexpr float kRunToolbarHeight = 40.0f; -constexpr float kRunToolbarButtonExtent = 28.0f; -constexpr float kRunToolbarButtonSpacing = 10.0f; -constexpr float kRunToolbarIconInset = 5.0f; +constexpr float kRunToolbarHeight = 30.0f; +constexpr float kRunToolbarButtonExtent = 26.0f; +constexpr float kRunToolbarButtonSpacing = 8.0f; +constexpr float kRunToolbarIconInset = 4.0f; std::string BuildRunToolbarIconPath(const char* fileName) { const std::filesystem::path exeDir( @@ -53,8 +53,7 @@ bool DrawRunToolbarIconButton( const char* id, const Actions::ActionBinding& action, const std::string& iconPath, - const char* fallbackGlyph, - const char* disabledHint = nullptr) { + const char* fallbackGlyph) { ImGui::BeginDisabled(!action.enabled); ImGui::PushID(id); @@ -88,17 +87,6 @@ bool DrawRunToolbarIconButton( } } - if (hovered) { - UI::BeginTitledTooltip(action.label.c_str()); - if (!action.shortcutLabel.empty()) { - ImGui::Text("Shortcut: %s", action.shortcutLabel.c_str()); - } - if (!action.enabled && disabledHint && disabledHint[0] != '\0') { - ImGui::TextUnformatted(disabledHint); - } - UI::EndTitledTooltip(); - } - ImGui::PopID(); ImGui::EndDisabled(); return action.enabled && pressed; @@ -147,7 +135,7 @@ void MenuBar::RenderRunToolbar() { ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoNavFocus; - ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(12.0f, 6.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(12.0f, 2.0f)); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); ImGui::PushStyleColor(ImGuiCol_WindowBg, UI::ToolbarBackgroundColor()); @@ -182,8 +170,7 @@ void MenuBar::RenderRunToolbar() { "Play", playAction, GetRunToolbarIconPath(0), - "P", - "Play requires Edit mode with an active scene.")) { + "P")) { Actions::RequestTogglePlayMode(*m_context); } @@ -192,8 +179,7 @@ void MenuBar::RenderRunToolbar() { "Pause", pauseAction, GetRunToolbarIconPath(1), - "||", - "Available while runtime is playing or paused.")) { + "||")) { Actions::RequestTogglePauseMode(*m_context); } @@ -202,12 +188,9 @@ void MenuBar::RenderRunToolbar() { "Step", stepAction, GetRunToolbarIconPath(2), - ">", - "Available while runtime is paused.")) { + ">")) { Actions::RequestStepPlayMode(*m_context); } - - UI::DrawCurrentWindowBottomBorder(); } ImGui::End();