feat(flow): viewport-aware SGCR adaptive spacing (Phase 2/6) - #289
Merged
Conversation
…ault plan)
SGCR receives the container's measured size and adapts spacing to fit:
- New `viewport?: {width, height}` on SGCROptions (types.ts)
- `adaptSpacing()` in layout.ts: when the initial layout exceeds the
viewport by >15%, computes a scale factor (floored at 0.4) and re-runs
with tighter spacing (nodeGap ≥12, channelMargin ≥6, minChannel ≥14,
trackPitch ≥10, margin ≥8). One retry only. portInset NOT scaled
(load-bearing for P5/P8).
- SgcrFlowInner passes wrapRef.clientWidth/Height as the viewport to
layoutSGCR. On significant container resize (>15%), the ResizeObserver
triggers a full re-layout with new viewport dimensions (not just refit).
- 200-graph fuzz with viewport {300,200} all pass checkInvariants.
728 viewer tests pass (+3 viewport-adaptive). tsc strict clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2: SGCR receives the container size and adapts spacing to fit. adaptSpacing() computes a scale factor and re-runs with tighter spacing when the layout overflows the viewport by >15%. 200-graph invariant fuzz with small viewports clean. 728 tests, tsc clean.