pub struct GraphView { /* private fields */ }Expand description
Read-only graph widget: computes (or receives) a Layout and
renders cards + canvas-stroke edges with selection, pan and
tooltips. See the module docs for the interaction vocabulary and
the relayout rule.
Implementations§
Source§impl GraphView
impl GraphView
Sourcepub fn new(desc: GraphDesc) -> GraphView
pub fn new(desc: GraphDesc) -> GraphView
A view over desc, laid out by the default layered pass.
Sourcepub fn algo(self, algo: GraphAlgo) -> GraphView
pub fn algo(self, algo: GraphAlgo) -> GraphView
Select the layout pass (default: layered with default options).
Sourcepub fn with_layout(self, layout: Layout) -> GraphView
pub fn with_layout(self, layout: Layout) -> GraphView
Render a PRECOMPUTED layout instead of running a pass (the
0430 hand-positioned seam; desc still supplies metadata —
labels, kinds, edge styles — via desc_index/id joins).
Sourcepub fn style(self, style: GraphStyle) -> GraphView
pub fn style(self, style: GraphStyle) -> GraphView
Explicit resolved ink set (default: derived from the active theme at build).
Sourcepub fn selected(self, sig: Signal<Option<String>>) -> GraphView
pub fn selected(self, sig: Signal<Option<String>>) -> GraphView
Controlled selection: bind the selected node id to an external signal (survives rebuilds; an internal signal is used otherwise and resets with the view).
Sourcepub fn on_node_press(self, f: impl FnMut(&str) + 'static) -> GraphView
pub fn on_node_press(self, f: impl FnMut(&str) + 'static) -> GraphView
Node activation callback: fires on card click and on Enter over the selected node. Disposal-safe — the callback may dispose the view’s scope.
Sourcepub fn badges(self, f: impl Fn(&str) -> Option<String> + 'static) -> GraphView
pub fn badges(self, f: impl Fn(&str) -> Option<String> + 'static) -> GraphView
Reactive badge slot: evaluated per node id inside the card’s render scope, so signal reads make badges live.
Sourcepub fn tooltips(self, delay: Duration) -> GraphView
pub fn tooltips(self, delay: Duration) -> GraphView
Enable hover tooltips (node label/kind/id) with the given
hover delay. Needs an overlay store: inside an App it
resolves from context, otherwise pass GraphView::overlays;
without either, tooltips are skipped (documented degradation).
Sourcepub fn overlays(self, overlays: &Overlays) -> GraphView
pub fn overlays(self, overlays: &Overlays) -> GraphView
Explicit overlay store for tooltips (tests, bare trees).
Sourcepub fn offset_x(self, sig: Signal<i32>) -> GraphView
pub fn offset_x(self, sig: Signal<i32>) -> GraphView
Bind the horizontal pan offset (overflow-honesty affordances: the app can derive “N cells off-screen” from offset + bounds).
Sourcepub fn layout(self, layout: LayoutStyle) -> GraphView
pub fn layout(self, layout: LayoutStyle) -> GraphView
Outer layout style (default: a growing column).