pub struct NodeGraph;Expand description
The node-graph widget.
Stateless; all persistent state lives in the caller-owned GraphView.
Implementations§
Source§impl NodeGraph
impl NodeGraph
Sourcepub fn fit_to_content(
view: &mut GraphView,
viewer: &dyn GraphViewer,
viewport_size: Vec2,
padding: f32,
) -> bool
pub fn fit_to_content( view: &mut GraphView, viewer: &dyn GraphViewer, viewport_size: Vec2, padding: f32, ) -> bool
Fit all canvas items into the viewport.
Computes the current world-space content bounds and updates pan and zoom
to center them with at least padding screen points where zoom limits
allow. Returns false when the graph has no canvas items.
Sourcepub fn show(
ui: &mut Ui,
view: &mut GraphView,
viewer: &dyn GraphViewer,
paint_chips: impl FnMut(&mut Ui, Rect, &[ChipHit]),
) -> GraphResponse
pub fn show( ui: &mut Ui, view: &mut GraphView, viewer: &dyn GraphViewer, paint_chips: impl FnMut(&mut Ui, Rect, &[ChipHit]), ) -> GraphResponse
Render the graph and process this frame’s input.
view holds pan/zoom/positions/selection; viewer supplies the
topology to draw. paint_chips is invoked once per node, right after
that node’s body is painted, with the canvas rect and the node’s input
value chips; the consumer paints an interactive editor over each chip
into the passed ui. Painting them inline — on the canvas layer, in
z-order, interleaved with the node bodies — lets a raised node’s body
cover the editors of anything beneath it, and lets egui route input to
the frontmost editor under the pointer (within a layer the last-painted
widget wins).