Skip to content

feat(flow): viewport-aware SGCR adaptive spacing (Phase 2/6) - #289

Merged
ivanmkc merged 1 commit into
masterfrom
feat/sgcr-phase2
Jul 27, 2026
Merged

feat(flow): viewport-aware SGCR adaptive spacing (Phase 2/6)#289
ivanmkc merged 1 commit into
masterfrom
feat/sgcr-phase2

Conversation

@ivanmkc

@ivanmkc ivanmkc commented Jul 27, 2026

Copy link
Copy Markdown
Owner

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.

…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.
@ivanmkc
ivanmkc merged commit fd90723 into master Jul 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants