Skip to main content

wire_groups

Macro wire_groups 

Source
macro_rules! wire_groups {
    ($window:expr, $groups:expr, $nodes:expr) => { ... };
}
Expand description

Wire node groups for a host with one node model and one group model.

Installs the three host answers the editor needs for groups:

  • NodeEditorComputations.group-in-drag: does a group move with the current drag? Answered by GroupLogic::group_moves, the same rule the commit uses, so the live preview and the committed positions agree.
  • NodeEditorComputations.group-collapsed: is a group collapsed? Members hide themselves from the answer.
  • NodeEditorEvents.group-collapse-requested: the sheet’s toggle asked for an explicit collapsed state; applied with GroupLogic::set_collapsed.

The drag commit is not wired here: build the setup with NodeEditorSetup::with_drag_commit so a node drag and a sheet drag share one rule. Node rows implement GroupMember, group rows GroupModel, and the window imports NodeEditorEvents and NodeEditorComputations from @nodeeditor. Hosts with several node models install the same three answers by hand.

§Generated-UI integration

let setup = NodeEditorSetup::with_drag_commit({
    let (nodes, groups) = (nodes.clone(), groups.clone());
    move |dragged, dx, dy| GroupLogic::commit_drag(&nodes, &groups, dragged, dx, dy)
});
wire_node_editor!(window, setup);
wire_selection!(window, setup, nodes, links, groups);
wire_groups!(window, groups, nodes);