wallsInDocument function
The walls the tools, the grips and the panel see around host (the
document adapter, Ruling 08-8): host as a WorldWall, and every
other live wall of doc (the engine's object rule, asked through
live_objects.dart: a file's group that also carries a later-registered
type is that type's object, not a wall), ascending by handle. The view
adapter (wallsInView) sees only host's neighbours; classify, cap
and obstaclesOf ignore a wall that does not join host, so the extra
walls change nothing (HF7 pins that both give the same bits). Null
when host is not a live wall.
moved stands in for the walls it names (an end drag's walls before it
is executed, spec 08 D13): each is read from it instead of doc.
Implementation
({WorldWall host, List<WorldWall> walls})? wallsInDocument(
DraftDocument doc, Handle host,
{Map<Handle, WorldWall> moved = const {}}) {
if (!isLiveObject<WallParams>(doc, host)) return null;
final p = doc.components.get<WallParams>(host)!;
return (
host:
moved[host] ?? WorldWall(host, p, doc.tree.accumulatedTransform(host)),
walls: [
for (final h in liveObjectsOf<WallParams>(doc))
if (h != host)
moved[h] ??
WorldWall(h, doc.components.get<WallParams>(h)!,
doc.tree.accumulatedTransform(h)),
],
);
}