#486: move a panel into its own native window (multiple monitors)
Problem: floating panels lived inside the main window only, so on a two-screen setup no panel could go onto the second monitor (#486). Fix: panel menu > Move Panel to New Window (and the agent/control command `window.panelWindow {panel, window?}`) undocks the panel if needed and shows its floating group in a native egui viewport the user can drag to any screen; Move Panel to Main Window or closing the window brings it back. The window's place and size are kept in the workspace (sanitised against hostile values) and restored on the next start. Browser and test builds, which embed viewports, show it as an in-app window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9a7d3e7699
commit
e7ada5bd16
@@ -127,6 +127,7 @@ pub const UI_COMMANDS: &[UiCommand] = &[
|
||||
uic!("window.dockPanel", "Dock Panel", [], None),
|
||||
uic!("window.floatPanel", "Undock Panel", [], None),
|
||||
uic!("window.closePanel", "Close Panel", [], None),
|
||||
uic!("window.panelWindow", "Move Panel to New Window", [], None),
|
||||
];
|
||||
|
||||
pub fn panel_command_id(p: PanelKind) -> String {
|
||||
@@ -442,6 +443,22 @@ pub fn invoke(app: &mut EffectcraftApp, ctx: &egui::Context, id: &str, params: V
|
||||
}
|
||||
return Ok(Value::Null);
|
||||
}
|
||||
// Multiple monitors: {panel, window?: bool} moves a panel into its own native window (or
|
||||
// back into the main window; no `window` toggles).
|
||||
if id == "window.panelWindow" {
|
||||
// A panel name ("Info", "Effect Controls") or its serialized form ({"Viewer": 2}).
|
||||
let value = params.get("panel").ok_or("panelWindow: need `panel`")?;
|
||||
let panel = match value.as_str() {
|
||||
Some(name) => PanelKind::from_name(name).ok_or(format!("unknown panel `{name}`"))?,
|
||||
None => serde_json::from_value::<PanelKind>(value.clone()).map_err(|_| "panelWindow: unknown `panel`".to_string())?,
|
||||
};
|
||||
let window = match params.get("window") {
|
||||
None | Some(Value::Null) => None,
|
||||
Some(value) => Some(value.as_bool().ok_or("panelWindow: `window` must be true or false")?),
|
||||
};
|
||||
let window = app.set_panel_window(ctx, panel, window)?;
|
||||
return Ok(json!({"window": window}));
|
||||
}
|
||||
// A UI-only command (not in the engine's menus), so `frontend` gets it from here.
|
||||
if id == "window.maximizeApp" {
|
||||
return frontend(app, ctx, id, params);
|
||||
|
||||
Reference in New Issue
Block a user