Nested Nodes
Nested nodes (often called Group Nodes) allow you to physically place one node inside another. In yh-flow, this is achieved via the parentId attribute. A child node's coordinates are relative to the top-left corner of its parent, making it easy to move groups of nodes as a single unit.
Nesting Example
Try dragging the outer "Parent Container" node; you'll notice the inner child nodes follow its movement naturally. You can also independently drag the children within the parent's boundaries.
Logical Hierarchy
Mechanics
- Hierarchy Definition: Establish relationships by pointing a node's
parentIdto a parent'sid. - Coordinate Inheritance: Child
positionvalues are relative to the parent's top-left origin (0,0). When the parent moves, children move along with it automatically. - Rendering Order: The engine optimizes stacking context. Parent nodes are rendered with lower
z-indexvalues to ensure they stay behind their children.
TIP
Dynamic Nesting: You can use drag-end events to calculate spatial intersections and dynamically assign/remove parentId to implement "drag-and-drop into group" functionality.