fix: preserve locked aspect ratio within size constraints - #278
sameerdeolalikar wants to merge 1 commit into
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughResizable now applies compatible minimum and maximum constraints along the locked aspect-ratio line. When the bounds cannot satisfy the ratio, it retains independent minimum-then-maximum clamping. Tests cover drag sequences and incompatible bounds. ChangesAspect-ratio constraints
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to The change appears ready to merge after normal checks; no unresolved issue is identified. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change is confined to resize calculations and their tests. It improves bounded aspect-ratio behavior without an identified new security path, but downstream consumer behavior has not been verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #277
When
lockAspectRatiois combined with independent size constraints, dragging a 300 × 150 component toward 600 × 300 with a maximum width of 420 produces 420 × 300. This patch intersects the width and height bounds on the aspect-ratio line, producing 420 × 210 and preserving the ratio through subsequent drag callbacks.If no size can satisfy both the ratio and the constraints, existing size-constraint precedence is preserved. Unlocked resizing retains the existing clamp path. No dependency, generated-file or public API changes.
Validation:
ResizableBox.test.tsx.The regression tests exercise bound overshoot, return and a subsequent gesture through the component's drag callback, following the existing test conventions. They are not a claim of browser/device coverage.
Implementation and regression tests were prepared with AI assistance. The checks above were executed against this branch.
Summary by CodeRabbit