fix: tighten top run toolbar chrome
This commit is contained in:
@@ -17,10 +17,10 @@ namespace Editor {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
constexpr float kRunToolbarHeight = 40.0f;
|
constexpr float kRunToolbarHeight = 30.0f;
|
||||||
constexpr float kRunToolbarButtonExtent = 28.0f;
|
constexpr float kRunToolbarButtonExtent = 26.0f;
|
||||||
constexpr float kRunToolbarButtonSpacing = 10.0f;
|
constexpr float kRunToolbarButtonSpacing = 8.0f;
|
||||||
constexpr float kRunToolbarIconInset = 5.0f;
|
constexpr float kRunToolbarIconInset = 4.0f;
|
||||||
|
|
||||||
std::string BuildRunToolbarIconPath(const char* fileName) {
|
std::string BuildRunToolbarIconPath(const char* fileName) {
|
||||||
const std::filesystem::path exeDir(
|
const std::filesystem::path exeDir(
|
||||||
@@ -53,8 +53,7 @@ bool DrawRunToolbarIconButton(
|
|||||||
const char* id,
|
const char* id,
|
||||||
const Actions::ActionBinding& action,
|
const Actions::ActionBinding& action,
|
||||||
const std::string& iconPath,
|
const std::string& iconPath,
|
||||||
const char* fallbackGlyph,
|
const char* fallbackGlyph) {
|
||||||
const char* disabledHint = nullptr) {
|
|
||||||
ImGui::BeginDisabled(!action.enabled);
|
ImGui::BeginDisabled(!action.enabled);
|
||||||
ImGui::PushID(id);
|
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::PopID();
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
return action.enabled && pressed;
|
return action.enabled && pressed;
|
||||||
@@ -147,7 +135,7 @@ void MenuBar::RenderRunToolbar() {
|
|||||||
ImGuiWindowFlags_NoMove |
|
ImGuiWindowFlags_NoMove |
|
||||||
ImGuiWindowFlags_NoNavFocus;
|
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_WindowRounding, 0.0f);
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, UI::ToolbarBackgroundColor());
|
ImGui::PushStyleColor(ImGuiCol_WindowBg, UI::ToolbarBackgroundColor());
|
||||||
@@ -182,8 +170,7 @@ void MenuBar::RenderRunToolbar() {
|
|||||||
"Play",
|
"Play",
|
||||||
playAction,
|
playAction,
|
||||||
GetRunToolbarIconPath(0),
|
GetRunToolbarIconPath(0),
|
||||||
"P",
|
"P")) {
|
||||||
"Play requires Edit mode with an active scene.")) {
|
|
||||||
Actions::RequestTogglePlayMode(*m_context);
|
Actions::RequestTogglePlayMode(*m_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,8 +179,7 @@ void MenuBar::RenderRunToolbar() {
|
|||||||
"Pause",
|
"Pause",
|
||||||
pauseAction,
|
pauseAction,
|
||||||
GetRunToolbarIconPath(1),
|
GetRunToolbarIconPath(1),
|
||||||
"||",
|
"||")) {
|
||||||
"Available while runtime is playing or paused.")) {
|
|
||||||
Actions::RequestTogglePauseMode(*m_context);
|
Actions::RequestTogglePauseMode(*m_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,12 +188,9 @@ void MenuBar::RenderRunToolbar() {
|
|||||||
"Step",
|
"Step",
|
||||||
stepAction,
|
stepAction,
|
||||||
GetRunToolbarIconPath(2),
|
GetRunToolbarIconPath(2),
|
||||||
">",
|
">")) {
|
||||||
"Available while runtime is paused.")) {
|
|
||||||
Actions::RequestStepPlayMode(*m_context);
|
Actions::RequestStepPlayMode(*m_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
UI::DrawCurrentWindowBottomBorder();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|||||||
Reference in New Issue
Block a user