You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/masonry/docs/technical-specification/Algorithm_Tree.md
+14-6Lines changed: 14 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,9 @@
1
1
# Tower Parsing & Layout Algorithm
2
2
3
-
This document describes a **stack-based post-order traversal** that computes each brick’s SVG path, bounding box, and notch‐connection points **after** all of its children have been measured. It handles arbitrarily deep nesting, distinguishes **expression** vs. **simple** vs. **compound** bricks, and avoids JavaScript call‐stack limits.
3
+
This document describes a **stack-based post-order traversal** that computes each brick’s SVG path,
4
+
bounding box, and notch‐connection points **after** all of its children have been measured. It
5
+
handles arbitrarily deep nesting, distinguishes **expression** vs. **simple** vs. **compound**
We mark `visited = false` on first encounter (“children not yet handled”) and will re-push the same node with `visited = true` (“ready to compute”) after its children.
91
+
We mark `visited = false` on first encounter (“children not yet handled”) and will re-push the
92
+
same node with `visited = true` (“ready to compute”) after its children.
**Key invariant**: When a node’s frame is popped with `visited = true`, all of its children (and their entire subtrees) have already been computed and stored in `metricsMap`.
153
+
**Key invariant**: When a node’s frame is popped with `visited = true`, all of its children (and
154
+
their entire subtrees) have already been computed and stored in `metricsMap`.
0 commit comments