@@ -22,18 +22,13 @@ function nextComponentId(session: MixAndMatchSession): ComponentId {
2222
2323/**
2424 * An in-progress build: the session document, the timeline playhead, and the state the timeline
25- * currently describes.
26- *
27- * Every user action goes through here as a timeline entry, including delete, so the whole build stays
28- * scrubbable. Nothing in this class touches the scene or physics; {@link MixAndMatchScene} watches for
29- * changes and reconciles what's rendered.
25+ * currently describes. Every user action goes through here as a timeline entry.
3026 */
3127class MixAndMatchBuild {
3228 private _session : MixAndMatchSession
3329 private _marker : number
3430 private _state : TimelineState
3531
36- /** The serialized-shape document. Treat as read-only; go through the mutators to change it. */
3732 public get session ( ) : Readonly < MixAndMatchSession > {
3833 return this . _session
3934 }
@@ -42,7 +37,6 @@ class MixAndMatchBuild {
4237 return this . _session . timeline
4338 }
4439
45- /** How many timeline entries are currently applied. Equals `timeline.length` when fully caught up. */
4640 public get marker ( ) : number {
4741 return this . _marker
4842 }
@@ -51,12 +45,10 @@ class MixAndMatchBuild {
5145 return this . _state
5246 }
5347
54- /** Whether the playhead sits before the end of the timeline. */
5548 public get isScrubbed ( ) : boolean {
5649 return this . _marker < this . _session . timeline . length
5750 }
5851
59- /** How many entries a new action would discard right now. Ask before committing over history. */
6052 public get discardedByNextEdit ( ) : number {
6153 return this . _session . timeline . length - this . _marker
6254 }
@@ -67,7 +59,6 @@ class MixAndMatchBuild {
6759 this . _state = replayTimeline ( session . timeline , this . _marker )
6860 }
6961
70- /** Moves the playhead. Does not modify the timeline; scrubbing is a preview, not an edit. */
7162 public scrubTo ( marker : number ) {
7263 const clamped = Math . max ( 0 , Math . min ( marker , this . _session . timeline . length ) )
7364 if ( clamped === this . _marker ) return
@@ -90,7 +81,7 @@ class MixAndMatchBuild {
9081
9182 /**
9283 * Welds `childId` onto `parentId`. Replaces the child's existing weld, if any: a component has
93- * exactly one active external weld, matching mira's one-parent-per-node joint tree .
84+ * exactly one active external weld.
9485 *
9586 * @returns Whether the weld was recorded. Rejected when it would weld a component to itself or
9687 * close the weld tree into a cycle.
@@ -103,7 +94,7 @@ class MixAndMatchBuild {
10394 if ( this . _state . components . get ( childId ) ?. weld ?. parentId === parentId ) return true
10495
10596 // Replay refused it, which only happens for a weld that would close the tree into a cycle.
106- // Drop the entry again so the timeline only ever holds actions that took effect .
97+ // Drop the entry again as it never took affect .
10798 this . _session . timeline . pop ( )
10899 this . _marker = this . _session . timeline . length
109100 this . refresh ( )
0 commit comments