mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-30 04:37:29 -06:00
Fix #4542: Edit › Color Settings… and Assign Profile… show the Separations Preview panel
The commands opened the panel as an icon column's flyout, but Separations Preview isn't in an icon column, so the dock dropped the request on the next frame and nothing showed. They now show it the way Window › Separations Preview does (in its group, its remembered place, or floating), and leave it showing when it already does.
This commit is contained in:
@@ -175,11 +175,11 @@ fn run_ui_part2(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<
|
||||
crate::prefs_dialog::open(app, s("category").as_deref());
|
||||
Ok(Value::Null)
|
||||
}
|
||||
// Edit → Color Settings… / Assign Profile… (no params): show the colour-management panel.
|
||||
// Edit → Color Settings… / Assign Profile… (no params): show the colour-management panel
|
||||
// wherever it is, as Window › Separations Preview does (it isn't in an icon column, so a
|
||||
// flyout for it never opened: #4542).
|
||||
"edit.colorSettings" | "edit.assignProfile" if p.as_object().is_none_or(|o| o.is_empty()) => {
|
||||
app.ui.open_panel = Some("separations".into());
|
||||
app.ui.dock = true;
|
||||
app.session.execute(id, p).map_err(|e| e.to_string())
|
||||
crate::panel_docking::reveal_panel(app, "separations").and_then(|_| app.session.execute(id, p).map_err(|e| e.to_string()))
|
||||
}
|
||||
"view.outline" => flag(&mut app.ui.view.outline),
|
||||
_ => return None,
|
||||
|
||||
@@ -283,6 +283,20 @@ fn panel_ids_are_case_insensitive_and_labels_work() {
|
||||
app.ui.dock_collapsed = false;
|
||||
}
|
||||
|
||||
/// #4542: Edit › Color Settings… and Assign Profile… show the Separations Preview panel, which
|
||||
/// isn't in an icon column, and leave it showing when it already does.
|
||||
#[test]
|
||||
fn color_settings_and_assign_profile_show_the_separations_panel() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
app.run("file.new", json!({})).unwrap();
|
||||
let shown = |app: &VectorcraftApp| checked(app, "window.panel", &json!({"panel": "separations"})).unwrap();
|
||||
assert!(!shown(&app));
|
||||
for id in ["edit.colorSettings", "edit.colorSettings", "edit.assignProfile"] {
|
||||
app.run(id, json!({})).unwrap();
|
||||
assert!(shown(&app), "{id} shows the panel");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn saved_views_store_and_restore_the_view() {
|
||||
let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default());
|
||||
|
||||
@@ -345,6 +345,16 @@ fn show_panel(app: &mut VectorcraftApp, params: &Value) -> Result<Value, String>
|
||||
})
|
||||
}
|
||||
|
||||
/// Show `panel` as `window.panel` does, but leave it be when it already shows ([`showing`]): a
|
||||
/// command that opens a panel to work in (Edit › Color Settings…) never puts it away.
|
||||
pub(crate) fn reveal_panel(app: &mut VectorcraftApp, panel: &str) -> Result<Value, String> {
|
||||
if showing(&app.ui, panel) {
|
||||
app.ui.dock = true;
|
||||
return Ok(json!({"open": panel}));
|
||||
}
|
||||
show_panel(app, &json!({ "panel": panel }))
|
||||
}
|
||||
|
||||
/// `window.collapseDock {collapsed?}`: collapse every dock column to icons, or expand the outer
|
||||
/// one; without `collapsed` it toggles the outer column.
|
||||
pub(crate) fn collapse_dock(app: &mut VectorcraftApp, collapsed: Option<bool>) -> Result<Value, String> {
|
||||
|
||||
Reference in New Issue
Block a user