macro_rules! wire_selection {
($window:expr, $setup:expr, $nodes:expr) => { ... };
($window:expr, $setup:expr, $nodes:expr, $links:expr) => { ... };
}Expand description
Wire the editor’s selection intents, using your model rows as the store.
The editor holds no selection state: it reports gestures (node-selected,
select-link, selection-cleared, box-selection-committed) and renders
whatever selected flag it finds on the rows. This macro closes that loop
without introducing a second copy of the selection — each gesture reads the
current set back out of the rows, resolves it through
resolve_click / resolve_box, and projects the result in. There is
nothing to keep in sync, because there is only ever one record of what is
selected.
Rows need an id and a selected field.
Two arms: node selection alone, or nodes and links together. Applications
with several node models or their own gesture semantics wire the four
callbacks by hand out of the selection module — see the advanced
example.
§Generated-UI integration
This fragment assumes the generated callbacks and models from the compiled quick start.
wire_node_editor!(window, setup);
wire_selection!(window, setup, nodes);
// …or, with selectable links:
wire_selection!(window, setup, nodes, links);