GroupNode

open class GroupNode(val children: List<Node> = emptyList(), val bounds: SceneBounds? = null) : Node

A sub-tree of the scene graph: an ordered list of child nodes, with an optional bounds rectangle. A whole scene is just a GroupNode — the root's bounds is the viewport renderers paint into.

Groups are purely structural, with no style of their own: every ShapeNode leaf carries its own concrete style. There is no background field either — a scene backdrop is an ordinary full-bleed rectangle as the first child, prebuilt by backdrop.

The class is open, and every group-preserving operation returns through the copy hook — a subclass that overrides it comes back as its own class from each of them. Identity is exact-class and structural across children and bounds; see equals.

Constructors

Link copied to clipboard
constructor(children: List<Node> = emptyList(), bounds: SceneBounds? = null)

Builds the group over its children and optional bounds.

constructor(vararg children: Node)

Builds a group of children in the given order, without bounds.

Properties

Link copied to clipboard

The rectangle this sub-tree occupies — on a scene root, the viewport; null when unspecified.

Link copied to clipboard
open val children: List<Node>

The child nodes in source order — the order renderers paint them; open so a subclass may narrow the element type.

Functions

Link copied to clipboard
open fun copy(children: List<Node> = this.children, bounds: SceneBounds? = this.bounds): GroupNode

Returns a group with children and bounds in place of this group's own — the rebuild hook every group-preserving operation returns through.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Returns whether other is a group of the same class with equal children and bounds.

Link copied to clipboard

Returns every ShapeNode in the tree — a depth-first, source-order traversal, so the resulting order is the paint order.

Link copied to clipboard
open override fun hashCode(): Int

Returns the hash of children combined with bounds', consistent with equals.

Link copied to clipboard
inline fun <N : ShapeNode> GroupNode.single(): N

Returns the tree's single leaf narrowed to its concrete node type N.

Link copied to clipboard
open override fun toString(): String

Returns the children and bounds — the structural content equals compares.