Reset Panel Layout cancels a panel drag in progress again

As before the move to the craft-ui dock, a tab held while the layout
resets is not dropped into the reset layout. The reset replaces the
workspace, so its generation changes.
This commit is contained in:
aiongg
2026-11-25 18:29:18 +00:00
parent 53d1790348
commit 433e51abc4
+12 -1
View File
@@ -444,7 +444,7 @@ fn publish_visibility(app: &mut crate::CadApp, workspace: &Workspace) {
pub fn command(app: &mut crate::CadApp, reset: bool, params: &Value) -> Result<Value, String> {
let mut workspace = app.ui.docking.clone();
if reset {
workspace = default_workspace();
workspace.replace(default_workspace());
} else {
sync(&mut workspace, app)?;
apply_command(&mut workspace, params)?;
@@ -752,4 +752,15 @@ mod tests {
assert_eq!(app.dock.raise, None);
}
#[test]
fn a_reset_replaces_the_workspace() {
let mut app = crate::CadApp::new(cadcraft_engine::Session::default(), crate::Services::default());
let start = app.ui.docking.generation();
command(&mut app, false, &json!({"operation": "open", "panel": Panel::Blocks.id()})).unwrap();
assert_eq!(app.ui.docking.generation(), start);
command(&mut app, true, &Value::Null).unwrap();
assert_ne!(app.ui.docking.generation(), start);
assert_eq!(app.ui.docking, default_workspace());
}
}