Limit left-panel scrollview to the file tree (#185)

* Limit left-panel scrollview to the file tree

Removes the redundant build button

* Expand ScrollArea to full side panel width

* Use auto_shrink(false) instead of set_width

---------

Co-authored-by: Luke Street <luke@street.dev>
This commit is contained in:
Steven Casper 2025-04-01 14:35:17 -04:00 committed by GitHub
parent b9ba5796ed
commit 9b557e4c8e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 29 deletions

View File

@ -775,9 +775,7 @@ impl eframe::App for App {
if side_panel_available { if side_panel_available {
egui::SidePanel::left("side_panel").show_animated(ctx, *show_side_panel, |ui| { egui::SidePanel::left("side_panel").show_animated(ctx, *show_side_panel, |ui| {
egui::ScrollArea::both().show(ui, |ui| { config_ui(ui, state, show_project_config, config_state, appearance);
config_ui(ui, state, show_project_config, config_state, appearance);
});
}); });
} }

View File

@ -297,27 +297,36 @@ pub fn config_ui(
node_open = NodeOpen::Open; node_open = NodeOpen::Open;
} }
CollapsingHeader::new(RichText::new("🗀 Objects").font(FontId { egui::ScrollArea::both().auto_shrink(false).show(ui, |ui| {
size: appearance.ui_font.size, CollapsingHeader::new(RichText::new("🗀 Objects").font(FontId {
family: appearance.code_font.family.clone(), size: appearance.ui_font.size,
})) family: appearance.code_font.family.clone(),
.open(root_open) }))
.default_open(true) .open(root_open)
.show(ui, |ui| { .default_open(true)
let search = config_state.object_search.to_ascii_lowercase(); .show(ui, |ui| {
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend); let search = config_state.object_search.to_ascii_lowercase();
for node in object_nodes.iter().filter_map(|node| { ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
filter_node( for node in object_nodes.iter().filter_map(|node| {
objects, filter_node(
node, objects,
&search, node,
config_state.filter_diffable, &search,
config_state.filter_incomplete, config_state.filter_diffable,
config_state.show_hidden, config_state.filter_incomplete,
) config_state.show_hidden,
}) { )
display_node(ui, &mut new_selected_index, objects, &node, appearance, node_open); }) {
} display_node(
ui,
&mut new_selected_index,
objects,
&node,
appearance,
node_open,
);
}
});
}); });
} }
if new_selected_index != selected_index { if new_selected_index != selected_index {
@ -327,11 +336,6 @@ pub fn config_ui(
state_guard.set_selected_obj(config); state_guard.set_selected_obj(config);
} }
} }
if state_guard.config.selected_obj.is_some()
&& ui.add_enabled(!config_state.build_running, egui::Button::new("Build")).clicked()
{
config_state.queue_build = true;
}
} }
fn display_unit( fn display_unit(