fix: tighten top run toolbar chrome

This commit is contained in:
2026-04-02 22:26:31 +08:00
parent 3f9e286637
commit 5c42f14d0e

View File

@@ -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();