-
Notifications
You must be signed in to change notification settings - Fork 3
add support for bounds packing #49
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Codex Review: Here are some suggestions.
Reply with @codex fix comments
to fix any unresolved comments.
About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".
let viableBounds = { | ||
minX: largestRectBounds.minX - componentBounds.minX * segmentNormAbs.x, | ||
minY: largestRectBounds.minY - componentBounds.minY * segmentNormAbs.y, | ||
maxX: largestRectBounds.maxX - componentBounds.maxX * segmentNormAbs.x, | ||
maxY: largestRectBounds.maxY - componentBounds.maxY * segmentNormAbs.y, | ||
} | ||
|
||
if (this.globalBounds) { | ||
viableBounds = { | ||
minX: Math.max(viableBounds.minX, this.globalBounds.minX), | ||
minY: Math.max(viableBounds.minY, this.globalBounds.minY), | ||
maxX: Math.min(viableBounds.maxX, this.globalBounds.maxX), | ||
maxY: Math.min(viableBounds.maxY, this.globalBounds.maxY), |
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.
[P1] Intersecting with global bounds ignores component size
When global bounds are provided, viableBounds
is intersected with those limits directly but without shrinking them by the component’s extents. For axes where segmentNormAbs
is 0 (e.g., a vertical outline segment), the viable center range still spans the full largestRectBounds
on that axis, so the resulting candidate can have its center at globalBounds.maxX
or minX
while the component’s body extends past the edge. If the user specifies tight board bounds, the solver will now generate placements that protrude outside the bounds even though it claims to respect them. Intersecting should subtract the component’s min/max offsets from this.globalBounds
before clamping.
Useful? React with 👍 / 👎.
No description provided.