feat(graph): node library as a docked panel; shared dock chrome

The node library leaves the overlay and becomes a dock panel (PanelId::
NodeGraph), docked on the right the first time the graph opens and movable
like any other panel; closing it closes the graph. It follows the block
palette's layout: title bar, then a search box with New / Open / Save
beside it, then the categories, of which only Objects starts open. Entries
are clicked (placed at the canvas top-left) or dragged onto the canvas.

The title bar (title, auto-collapse pin, close, drag to re-dock), the
toolbar icon button and the panel frame were copied across Properties,
Block Palette, External References and Browser; they are now
dock::title_bar, dock::tool_button and dock::frame, used by all of them.
Block Palette's two tool buttons gain tooltips, and External References'
Auto / Close tooltips are now translated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-09-25 10:17:44 +03:00
1 parent 857f2f2e58
commit 3013c1b570
9 files changed
+245 -314

No files matched your search

+16 -1
View File
@@ -170,6 +170,21 @@ impl OpenCADStudio {
GraphMsg::Toggle => {
self.show_node_graph = !self.show_node_graph;
if self.show_node_graph {
// The node library docks on the right on first use; after
// that it stays wherever the user moved it.
let id = crate::ui::dock::PanelId::NodeGraph;
if self.dock.location(id).is_none() {
self.dock
.dock(id, crate::app::config::DockSide::Right, usize::MAX);
}
self.dock_expanded = Some(id);
return self.graph_run(i);
}
}
GraphMsg::PaletteRelease => {
if let Some(Drag::Palette(item)) = self.tabs[i].graph.drag.take() {
let pos = self.tabs[i].graph.drop_position(false);
self.tabs[i].graph.add_node(item, Vec::new(), pos);
return self.graph_run(i);
}
}
@@ -177,7 +192,7 @@ impl OpenCADStudio {
let sections = self.graph_all_sections(i);
match self.tabs[i].graph.drag.take() {
Some(Drag::Palette(item)) => {
let pos = self.tabs[i].graph.drop_position();
let pos = self.tabs[i].graph.drop_position(true);
self.tabs[i].graph.add_node(item, Vec::new(), pos);
return self.graph_run(i);
}
+4
View File
@@ -605,6 +605,9 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
PanelId::Browser => {
self.show_browser = false;
}
PanelId::NodeGraph => {
self.show_node_graph = false;
}
PanelId::Properties => {
self.show_properties = false;
self.ribbon.set_properties(false);
@@ -708,6 +711,7 @@ pub(super) fn on_ribbon_tool_click(&mut self, tool_id: String, event: ModuleEven
PanelId::BlockPalette => self.show_block_palette,
PanelId::ExternalReferences => self.show_external_references,
PanelId::Browser => self.show_browser,
PanelId::NodeGraph => self.show_node_graph,
}
}
+2
View File
@@ -1847,6 +1847,7 @@ bg={bg_ms:.1}ms n={view_count}"
crate::ui::dock::PanelId::BlockPalette => self.show_block_palette,
crate::ui::dock::PanelId::ExternalReferences => self.show_external_references,
crate::ui::dock::PanelId::Browser => self.show_browser,
crate::ui::dock::PanelId::NodeGraph => self.show_node_graph,
}
};
let edge_stack = |side: crate::app::config::DockSide| -> Option<Element<'_, Message>> {
@@ -2950,6 +2951,7 @@ impl OpenCADStudio {
width,
auto_collapse,
),
crate::ui::dock::PanelId::NodeGraph => tab.graph.panel(width, auto_collapse),
};
let divider = dock_divider(id);
match side {