Panels: a double-click on the strip of a group beside another does nothing

Such a group can't collapse, so the strip queued window.panel.collapse only for the command to refuse it and leave an error in the status bar.
This commit is contained in:
Marco Arnulfo
2026-10-24 02:05:18 +07:00
committed by bflatastic
parent 0666e8e978
commit 777930fcd2
2 changed files with 25 additions and 2 deletions
+5 -2
View File
@@ -896,7 +896,8 @@ fn root_groups(ctx: &egui::Context, layout: &Layout<String>, content: egui::Rect
/// and left of its panel menu, from which Illustrator also collapses the group
/// (<https://helpx.adobe.com/illustrator/using/customizing-workspace.html>). Most of it has no
/// widget of its own, so the press is read from the input; `layer` is the dock's, so a press on a
/// floating group or a menu over the strip doesn't count. Accordions are left out.
/// floating group or a menu over the strip doesn't count. Accordions, and groups beside another
/// (which don't collapse), are left out.
fn tab_area_double_clicked(
ctx: &egui::Context,
layer: egui::LayerId,
@@ -909,7 +910,9 @@ fn tab_area_double_clicked(
return None;
}
let group = groups.iter().find(|g| g.strip.contains(at))?;
tab_group_shortens(layout, group.shown)?;
if tab_group_shortens(layout, group.shown) != Some(true) {
return None;
}
let area = egui::Id::new("vectorcraft-panel-docking");
let right = |id: egui::Id| ctx.read_response(id).map(|r| r.rect.right());
let tabs = group
+20
View File
@@ -1200,3 +1200,23 @@ fn a_group_beside_another_does_not_collapse() {
crate::panel_docking::prune_collapsed(&mut app.ui);
assert!(app.ui.docking_collapsed.is_empty());
}
/// A double-click on the strip of a group beside another does nothing, and leaves no error in the
/// status bar.
#[test]
fn a_double_click_on_the_strip_of_a_group_beside_another_does_nothing() {
let mut app = app();
app.run("file.new", json!({"width": 400, "height": 300})).unwrap();
app.run("window.panel.move", json!({"panel":"swatches", "anchor":"layers", "zone":"left"})).unwrap();
let saved = app.ui.docking.clone();
let mut h = harness(app, vec2(1280.0, 800.0));
let status = h.state().ui.status.clone();
let strip = root_groups(&h).into_iter().find(|g| g.shown == "swatches").unwrap().strip;
let tab = h.ctx.read_response(egui::Id::new("vectorcraft-panel-docking").with(("tab", &"swatches".to_string()))).unwrap().rect;
let gap = pos2(tab.right() + 4.0, strip.center().y);
assert!(gap.x < strip.right() - 24.0, "{tab:?} {strip:?}");
double_click(&mut h, gap);
assert_eq!(h.state().ui.status, status, "no error");
assert!(h.state().ui.docking_collapsed.is_empty());
assert_eq!(h.state().ui.docking, saved);
}