Selection filter in the SELECT panel: select bodies (a face picks and highlights its body), faces, edges, vertices, sketch geometry
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
This commit is contained in:
1 parent
656502b882
commit
24627d4f0a
3 files changed
+49
-5
No files matched your search
@@ -248,7 +248,7 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let cmds: Vec<_> = specs.iter().filter(|c| c.tab == tab && c.panel == *panel).collect();
|
||||
let n = promoted(&tab, panel).min(cmds.len()).max(if cmds.is_empty() { 1 } else { 0 });
|
||||
let width = (n as f32 * 40.0).max(64.0) + 8.0;
|
||||
let enabled_panel = !cmds.is_empty();
|
||||
let enabled_panel = !cmds.is_empty() || *panel == "SELECT";
|
||||
for (i, c) in cmds.iter().take(n).enumerate() {
|
||||
let br = Rect::from_min_size(pos2(px + 4.0 + i as f32 * 40.0, top + 2.0), vec2(38.0, 38.0));
|
||||
let info = c.info(&app.session);
|
||||
@@ -305,7 +305,9 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let area = egui::Area::new(popup_id).fixed_pos(lr.left_bottom()).order(egui::Order::Foreground).show(ui.ctx(), |ui| {
|
||||
egui::Frame::popup(ui.style()).show(ui, |ui| {
|
||||
ui.set_min_width(200.0);
|
||||
if cmds.is_empty() {
|
||||
if *panel == "SELECT" {
|
||||
selection_filter(app, ui);
|
||||
} else if cmds.is_empty() {
|
||||
ui.label(egui::RichText::new("Not available yet").color(t.text_dim));
|
||||
}
|
||||
for c in &cmds {
|
||||
@@ -335,6 +337,22 @@ pub fn toolbar(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
});
|
||||
}
|
||||
|
||||
/// The SELECT panel: what a click in the view picks.
|
||||
fn selection_filter(app: &mut SolveApp, ui: &mut egui::Ui) {
|
||||
let t = Tokens::get();
|
||||
ui.label(egui::RichText::new("Selection filter").color(t.text_dim).size(11.0));
|
||||
ui.checkbox(&mut app.ui.pick_bodies, "Select bodies (a face picks its body)");
|
||||
for (k, label) in [("faces", "Faces"), ("edges", "Edges"), ("vertices", "Vertices"), ("sketch", "Sketch geometry and profiles")] {
|
||||
let mut on = !app.ui.pick_off.iter().any(|x| x == k);
|
||||
if ui.checkbox(&mut on, label).changed() {
|
||||
app.ui.pick_off.retain(|x| x != k);
|
||||
if !on {
|
||||
app.ui.pick_off.push(k.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A small drop-down caret.
|
||||
fn caret(p: &egui::Painter, c: egui::Pos2, col: Color32) {
|
||||
p.add(egui::Shape::convex_polygon(vec![pos2(c.x - 3.5, c.y - 2.0), pos2(c.x + 3.5, c.y - 2.0), pos2(c.x, c.y + 2.5)], col, Stroke::NONE));
|
||||
|
||||
Reference in new issue
Block a user