mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-30 18:25:34 +01:00
Merge pull request #10096 from dotCooCoo/fix/drop-floated-from-icons
Docking: drop the icon-column float workaround now that craft-libs expands it
This commit is contained in:
1 file changed
+1
-24
@@ -521,22 +521,6 @@ fn flyout_tab(layout: &Layout<String>, panel: &str) -> Option<String> {
|
||||
.map(|front| front.to_string())
|
||||
}
|
||||
|
||||
/// The actions that expand each floating window the pass made from part of a column collapsed to
|
||||
/// icons, so a group or tab dragged out of an icon column floats as an expanded panel with its tabs
|
||||
/// in the window. A whole icon column floated stays collapsed.
|
||||
fn floated_from_icons(before: &Layout<String>, after: &Layout<String>) -> Vec<Action<String>> {
|
||||
after
|
||||
.floating
|
||||
.iter()
|
||||
.filter(|window| window.column.iconic && !before.floating.iter().any(|old| old.id == window.id))
|
||||
.filter_map(|window| {
|
||||
let first = window.panels().next()?;
|
||||
let (_, column) = column_of(before, first)?;
|
||||
(column.iconic && column.panels().count() > window.panels().count()).then(|| Action::set_iconic(first.clone(), false))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Show `panel` as `window.panel` does, but leave it be when it can be seen already ([`visible`]):
|
||||
/// a command that opens a panel to work in (Edit › Color Settings…) never puts it away. A flyout
|
||||
/// keeps the name of the icon that opened it after another of its tabs is clicked, so a panel whose
|
||||
@@ -1393,20 +1377,13 @@ pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui, keeps_tools: boo
|
||||
app.dock_rt.rails = rails;
|
||||
// A workspace a command switched to or changed in this pass (`Workspace::replace`) stays; the
|
||||
// pass's edits were to the one it replaced.
|
||||
let mut expand = Vec::new();
|
||||
if app.ui.dock_workspace.revision() == revision {
|
||||
let before = std::mem::replace(&mut app.ui.dock_workspace, workspace);
|
||||
expand = floated_from_icons(before.layout(), layout_of(&app.ui));
|
||||
app.ui.dock_workspace = workspace;
|
||||
}
|
||||
// A command of this pass that opened or closed a flyout wins over the area's own change.
|
||||
if app.ui.open_panel == flyout_before {
|
||||
app.ui.open_panel = flyout;
|
||||
}
|
||||
if !expand.is_empty()
|
||||
&& let Err(error) = apply(app, None, expand)
|
||||
{
|
||||
app.status(error);
|
||||
}
|
||||
if output.error.is_some() {
|
||||
Arc::make_mut(&mut app.ui.dock_workspace).replace(default_workspace(&[]));
|
||||
app.status(tl!("Invalid panel layout; restored the default dock").to_string());
|
||||
|
||||
Reference in new issue
Block a user