Make right palette collapse arrow interactive (fix #617) (#640)

Squash of PR #640 by @rangoDJ.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rangoDJandClaude Opus 5.5 authored and GitHub committed 2026-10-11 19:53:05 -04:00
1 parent c5ebf4d1cd
commit 9b3674e01f
7 files changed
+53 -1

No files matched your search

+3
View File
@@ -22,6 +22,9 @@ real_name = "Brandon Thomas"
display_name = "Brandon Thomas"
sync_github_name = false
[people.rangoDJ]
sync_github_name = true
[people.Tru10]
display_name = "by Truitt"
sync_github_name = false
+1
View File
@@ -108,6 +108,7 @@
Close All Alle schließen
Closed Geschlossen
Coincident Koinzident
Collapse Palettes Paletten einklappen
Collapse Tool Sets Werkzeuggruppen einklappen
Collinear Kollinear
Color Farbe
1 # CADCraft German interface catalog — original translations by the CADCraft contributors.
108
109
110
111
112
113
114
+1
View File
@@ -108,6 +108,7 @@
Close All Cerrar todo
Closed Cerrada
Coincident Coincidente
Collapse Palettes Contraer paletas
Collapse Tool Sets Contraer herramientas de dibujo
Collinear Colineal
Color Color
1 # CADCraft Spanish interface catalog — original translations.
108
109
110
111
112
113
114
+1
View File
@@ -108,6 +108,7 @@
Close All Fechar tudo
Closed Fechada
Coincident Coincidente
Collapse Palettes Recolher paletas
Collapse Tool Sets Recolher conjuntos de ferramentas
Collinear Colinear
Color Cor
1 # CADCraft Brazilian Portuguese (pt-BR) interface catalog.
108
109
110
111
112
113
114
+1
View File
@@ -144,6 +144,7 @@
Closed Замкнений
Close Comparison Закрити порівняння
Coincident Збіг
Collapse Palettes Згорнути палітри
Collapse Tool Sets Згорнути набори інструментів
Collinear Колінеарність
Color Колір
1 # CADCraft Ukrainian interface catalog — original translations by @dmatviichuk.
144
145
146
147
148
149
150
+10 -1
View File
@@ -274,6 +274,9 @@ fn swatch(p: &egui::Painter, r: Rect, c: Color) {
}
pub fn right_palettes(app: &mut CadApp, ui: &mut egui::Ui) {
if !app.ui.show_palettes {
return;
}
let t = Tokens::get();
egui::Panel::right("cc_palettes").exact_size(300.0).resizable(false).frame(egui::Frame::NONE.fill(t.panel)).show(ui, |ui| {
let r = ui.max_rect();
@@ -285,7 +288,13 @@ pub fn right_palettes(app: &mut CadApp, ui: &mut egui::Ui) {
let br = Rect::from_center_size(pos2(r.left() + 30.0 + i as f32 * 52.0, r.top() + tab_h / 2.0), vec2(20.0, 20.0));
icons::paint(&p, br, *icon, false);
}
icons::paint(&p, Rect::from_center_size(pos2(r.right() - 14.0, r.top() + tab_h / 2.0), vec2(14.0, 14.0)), Icon::ChevronRight, false);
let cr = Rect::from_center_size(pos2(r.right() - 14.0, r.top() + tab_h / 2.0), vec2(14.0, 14.0));
let cresp = ui.interact(cr, ui.id().with("palettes_collapse"), Sense::click());
icons::paint(&p, cr, Icon::ChevronRight, false);
icons::describe_control(ui, &cresp, "Collapse Palettes", None, false);
if cresp.on_hover_text(crate::tl!("Collapse Palettes")).clicked() {
app.ui.show_palettes = false;
}
let body = Rect::from_min_max(pos2(r.left(), r.top() + tab_h), r.max);
ui.scope_builder(egui::UiBuilder::new().max_rect(body), |ui| {
egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {
+36
View File
@@ -114,6 +114,42 @@ fn drafting_palette_pointer_and_keyboard_start_the_same_commands() {
}
}
#[test]
fn right_palettes_collapse_arrow_hides_menu() {
let mut h = Harness::builder().with_size(vec2(1600.0, 1000.0)).build_ui_state(
|ui, app: &mut CadApp| {
app.logic(&ui.ctx().clone());
cadcraft_ui_egui::palettes::right_palettes(app, ui);
},
app(),
);
h.run_steps(5);
assert!(h.state().ui.show_palettes);
// Collapsing palettes on the right hides palettes.
h.get_by_label("Collapse Palettes").click();
h.run_steps(3);
assert!(!h.state().ui.show_palettes);
}
#[test]
fn toolsets_collapse_arrow_hides_menu() {
let mut h = Harness::builder().with_size(vec2(1600.0, 1000.0)).build_ui_state(
|ui, app: &mut CadApp| {
app.logic(&ui.ctx().clone());
cadcraft_ui_egui::palettes::toolsets(app, ui);
},
app(),
);
h.run_steps(5);
assert!(h.state().ui.show_toolsets);
// Collapsing toolsets on the left hides toolsets.
h.get_by_label("Collapse Tool Sets").click();
h.run_steps(3);
assert!(!h.state().ui.show_toolsets);
}
#[test]
fn shared_controls_visuals() {
let Some(directory) = std::env::var_os("CRAFT_UI_SUITE_SHOTS").map(std::path::PathBuf::from) else { return };