expand method

List<SceneNode> expand(
  1. SceneNode child
)

What to draw for one child slot: the node itself, and one copy per FURTHER item when it repeats.

The first item is not a copy — it is the node, holding the authored values, so it keeps its identity: its fx writers, its selection outline and the rect the editor drags by are all still its own. The copies are pictures, renamed <name>#1, #2… so no key or measured rect of theirs can be mistaken for the template's.

Implementation

List<SceneNode> expand(SceneNode child) {
  if (child is! FrameNode) return [child];
  var rep = child.repeated;
  if (rep == null) return [child];
  // No data, nothing drawn — the honest answer for a table of an empty
  // list, and the reason the mockup in the file is not empty.
  if (rep.items.isEmpty) return const [];
  return [
    child,
    for (var i = 1; i < rep.items.length; i++) _drawnRow(child, rep, i),
  ];
}