mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Panels: window.panel.dock with group or column docks the whole group
The return to where a panel floated from applies to a single panel; with group or column true the command docks the panel's group or column as craft-ui does.
This commit is contained in:
1 parent
9258857660
commit
3d4729e53d
2 files changed
+14
-1
No files matched your search
@@ -480,7 +480,9 @@ fn run(app: &mut PhotocraftApp, command: DockCommand<String>) -> Result<Value, S
|
||||
let space = FloatSpace::new(FLOAT_AREA);
|
||||
let rtl = crate::direction::is_rtl();
|
||||
let closed = match &command {
|
||||
DockCommand::Dock { panel, anchor: None, side: None, zone: None, .. } if dock_back(&mut workspace, &returns, panel)? => Vec::new(),
|
||||
DockCommand::Dock { panel, anchor: None, side: None, zone: None, group: false, column: false, .. } if dock_back(&mut workspace, &returns, panel)? => {
|
||||
Vec::new()
|
||||
}
|
||||
DockCommand::Float { panel, x, y, width, height, group: false, column: false } => {
|
||||
if let Ok(location) = workspace.layout.location(panel)
|
||||
&& location.floating.is_none()
|
||||
|
||||
@@ -53,6 +53,17 @@ fn panel_commands_group_split_reorder_float_and_restore_without_duplicate_owners
|
||||
assert_eq!(restored.docking_returns, app.ui.docking_returns);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn docking_a_floating_group_docks_all_of_its_panels() {
|
||||
let mut app = app();
|
||||
app.run("window.panel.float", json!({"panel":"paths"})).unwrap();
|
||||
app.run("window.panel.move", json!({"panel":"history", "anchor":"paths"})).unwrap();
|
||||
assert!(lay(&app).floating.iter().any(|w| w.contains("paths") && w.contains("history")));
|
||||
app.run("window.panel.dock", json!({"panel":"paths", "group": true})).unwrap();
|
||||
assert!(lay(&app).floating.iter().all(|w| !w.contains("paths") && !w.contains("history")), "{:?}", lay(&app).floating);
|
||||
assert!(lay(&app).contains(&"paths".into()) && lay(&app).contains(&"history".into()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn floating_panel_rail_toggle_closes_the_float_window() {
|
||||
let mut app = app();
|
||||
|
||||
Reference in new issue
Block a user