-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat(autolayout): add snap-to-grid support #3031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile OverviewGreptile SummaryThis PR adds snap-to-grid functionality to the autolayout system and removes the unused YAML autolayout API route. Key Changes:
Implementation Quality: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant API as API Route
participant AL as applyAutoLayout
participant PCD as prepareContainerDimensions
participant LBC as layoutBlocksCore
participant CP as calculatePositions
participant NP as normalizePositions
participant SNG as snapNodesToGrid
participant LC as layoutContainers
API->>API: Parse request with gridSize
API->>AL: applyAutoLayout(blocks, edges, options)
AL->>PCD: prepareContainerDimensions(blocks, edges, gridSize)
loop For each container (bottom-up)
PCD->>LBC: layoutBlocksCore(childBlocks, {gridSize})
LBC->>CP: calculatePositions(layers, edges)
CP-->>LBC: positioned nodes
LBC->>NP: normalizePositions(nodes)
NP-->>LBC: normalized dimensions
LBC->>SNG: snapNodesToGrid(nodes, gridSize)
SNG-->>LBC: updated dimensions
LBC-->>PCD: {nodes, dimensions}
PCD->>PCD: Update container width/height
end
PCD-->>AL: containers sized
AL->>LBC: layoutBlocksCore(rootBlocks, {gridSize})
LBC->>CP: calculatePositions(layers, edges)
CP-->>LBC: positioned nodes
LBC->>NP: normalizePositions(nodes)
NP-->>LBC: normalized dimensions
LBC->>SNG: snapNodesToGrid(nodes, gridSize)
SNG-->>LBC: snapped dimensions
LBC-->>AL: {nodes, dimensions}
AL->>LC: layoutContainers(blocks, edges, {gridSize})
loop For each container
LC->>LBC: layoutBlocksCore(childBlocks, {gridSize})
LBC->>CP: calculatePositions(layers, edges)
CP-->>LBC: positioned nodes
LBC->>NP: normalizePositions(nodes)
NP-->>LBC: normalized dimensions
LBC->>SNG: snapNodesToGrid(nodes, gridSize)
SNG-->>LBC: snapped dimensions
LBC-->>LC: {nodes, dimensions}
LC->>LC: Apply positions & update container dims
end
LC-->>AL: containers laid out
AL-->>API: {blocks: layoutedBlocks, success: true}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 2 comments
|
@greptile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
6bdd8dc to
99386e8
Compare
|
@greptile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files reviewed, no comments
Summary
gridSizeoption to autolayout that snaps block positions to grid multiplesType of Change
Testing
Tested manually
Checklist