Fit zoom clamp: small graphs no longer balloon - #7
Merged
Conversation
Measured: a 60-node graph fit at zoom 4.3, 300 nodes at 3.3 — nodes render as balloons. Every internally issued fit (first-data, settle follow, public fitView) now carries a zoom bound: fitViewMaxZoom option, default 1.5, null disables. FitViewOptions gains maxZoom; when the natural fit zoom exceeds it, CosmosEngine centers the scene bbox at the bound with one animated setZoomTransformByPointPositions instead (headless/zero-size containers and unknown positions fall back to the native fit). Verified live: small-graph fits land at exactly 1.5. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018SeFxK217ZrHSERqK6kjcb
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.
Second half of the first-load-feel work. Measured on the sweep protocol: a 60-node graph fit at zoom 4.3, 300 nodes at 3.3 — small graphs zoom until nodes are balloons.
FitViewOptionsgainsmaxZoom; CosmosEngine honors it by centering the scene bbox at the bound with one animated transform when the natural fit would exceed it (native fit otherwise; headless containers and unknown positions fall back).fitViewMaxZoomconstruction option (default 1.5,nulldisables) through every internally issued fit: first-data fit, settle follow, publicfitView.Verified live on the same fixtures: small-graph fits land at exactly 1.5 (previously 3.1–4.3), nodes at natural scale. 4 new adapter tests + 1 core threading test; two existing fit-args assertions updated. Full check green (1,798 tests).
🤖 Generated with Claude Code
https://claude.ai/code/session_018SeFxK217ZrHSERqK6kjcb
Greptile Summary
The PR adds a configurable maximum zoom for fit operations, defaulting to 1.5 and allowing
nullto disable the clamp.maxZoom.Confidence Score: 5/5
The PR appears safe to merge with no concrete correctness or security failures identified.
The fit bound is consistently threaded through the public layers, and the Cosmos adapter retains native fallback behavior when clamped fitting cannot be safely computed.
Important Files Changed
Sequence Diagram
sequenceDiagram participant App as React/Application participant Core as GraphInstance participant Adapter as CosmosEngine participant Cosmos as Cosmos Graph App->>Core: Construct with fitViewMaxZoom Core->>Adapter: "fitView({ maxZoom, durationMs? })" Adapter->>Cosmos: Read point positions alt Natural fit exceeds maxZoom Adapter->>Cosmos: Center bbox at maxZoom else Fit is within bound or geometry unavailable Adapter->>Cosmos: Native fitView endReviews (1): Last reviewed commit: "Fit zoom clamp: small graphs no longer b..." | Re-trigger Greptile