fix(files): center path and tree toggles
This commit is contained in:
@@ -1707,14 +1707,13 @@ void draw_file_toolbar(bool show_view_all) {
|
||||
};
|
||||
const char* path_label = ICON_TB_BARS " Path";
|
||||
const char* tree_label = ICON_TB_TREE " Tree";
|
||||
float controls_width = button_width(tree_label);
|
||||
if (show_path) controls_width += button_width(path_label);
|
||||
if (show_view_all) {
|
||||
controls_width += ImGui::GetStyle().ItemSpacing.x + ImGui::GetFontSize() +
|
||||
ImGui::GetStyle().ItemInnerSpacing.x + ImGui::CalcTextSize("View all files").x;
|
||||
}
|
||||
const float controls_right = ImGui::GetContentRegionMax().x - ui(5.0f);
|
||||
ImGui::SameLine(std::max(ImGui::GetCursorPosX() + ui(8), controls_right - controls_width));
|
||||
float toggle_width = button_width(tree_label);
|
||||
if (show_path) toggle_width += button_width(path_label);
|
||||
if (show_path) toggle_width += ImGui::GetStyle().ItemSpacing.x;
|
||||
const float row_left = ImGui::GetCursorPosX();
|
||||
const float row_width = ImGui::GetContentRegionAvail().x;
|
||||
const float toggle_x = row_left + std::max(0.0f, (row_width - toggle_width) * 0.5f);
|
||||
ImGui::SameLine(std::max(ImGui::GetCursorPosX() + ui(8), toggle_x));
|
||||
if (show_path) {
|
||||
const bool path_selected = g_file_view_mode == FileViewMode::path;
|
||||
if (path_selected) ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.15f, 0.28f, 0.46f, 1));
|
||||
|
||||
Reference in New Issue
Block a user