DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Docking trial: craft-ui bfda13d, accept MovePanel
aiongg37e80a4ae2f1
diff --git a/Cargo.lock b/Cargo.lockindex 85374c054..ac705b0f6 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -849,7 +849,7 @@ dependencies = [[[package]]name = "craft-ui"version = "0.1.0"-source = "git+https://github.com/aiongg/craft-libs?rev=c715d3f25fdfd615ae1685daa328776e9d7ad9a8#c715d3f25fdfd615ae1685daa328776e9d7ad9a8"+source = "git+https://github.com/aiongg/craft-libs?rev=bfda13d2afd92947f2fe0f671385d350b4d5932a#bfda13d2afd92947f2fe0f671385d350b4d5932a"dependencies = ["egui","serde",diff --git a/Cargo.toml b/Cargo.tomlindex 52f732973..7b148b927 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -126,4 +126,4 @@ hayro-jbig2 = { git = "https://github.com/storytold/pdfcraft", rev = "b5467d93a0# Docking trial: craft-ui from the craft-libs `docking` branch.[patch."https://github.com/storytold/craft-libs"]-craft-ui = { git = "https://github.com/aiongg/craft-libs", rev = "c715d3f25fdfd615ae1685daa328776e9d7ad9a8" }+craft-ui = { git = "https://github.com/aiongg/craft-libs", rev = "bfda13d2afd92947f2fe0f671385d350b4d5932a" }diff --git a/crates/ui-egui/src/panel_docking.rs b/crates/ui-egui/src/panel_docking.rsindex 7edc2705d..f55f50187 100644--- a/crates/ui-egui/src/panel_docking.rs+++ b/crates/ui-egui/src/panel_docking.rs@@ -603,7 +603,7 @@ fn known(action: &Action<String>) -> bool {| Action::SetStackOpen { panel, .. }| Action::ResizeStack { panel, .. } => registered(panel),Action::ResizeSplit { path, .. } => path.len() <= craft_ui::docking::MAX_DEPTH,- Action::MoveGroup { panel, to } | Action::MoveColumn { panel, to } | Action::MoveWindow { panel, to } => {+ Action::MovePanel { panel, to } | Action::MoveGroup { panel, to } | Action::MoveColumn { panel, to } | Action::MoveWindow { panel, to } => {registered(panel)&& match to {Target::At { anchor, placement } => registered(anchor) && tab(placement),diff --git a/crates/ui-egui/src/panel_docking_tests.rs b/crates/ui-egui/src/panel_docking_tests.rsindex b410f76ac..f95b93648 100644--- a/crates/ui-egui/src/panel_docking_tests.rs+++ b/crates/ui-egui/src/panel_docking_tests.rs@@ -868,6 +868,13 @@ fn shared_panel_commands_float_dock_and_reject_atomically() {}),"Dock Panel returns it where it floated from");+ // A docked panel that shares its group leaves it for a new dock at the start edge.+ let mut tabbed = self::app();+ tabbed.run("window.panel.dock", json!({"panel": "layers", "side": "Start"})).unwrap();+ let layout = tabbed.ui.docking.clone().unwrap();+ assert_eq!(tab_group(&layout, "pages"), ["properties", "pages"]);+ assert!(matches!(&layout.root, Some(Node::Split { first, .. }) if matches!(&**first, Node::Dock { side: Side::Start, .. })));+ assert_eq!(tab_group(&layout, "layers"), ["layers"]);// A whole group, by any of its panels, then into a new column of the end dock.app.run("window.panel.float", json!({"panel": "pages", "group": true, "x": 80, "y": 80, "width": 300, "height": 400})).unwrap();let layout = app.ui.docking.clone().unwrap();