fix(core): use full border width for inner content offset in LayoutEngine to prevent child widgets overlapping border#691
Conversation
…gine to prevent child widgets overlapping border Closes Karanjot786#682
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR fixes a layout positioning bug in the core engine where child widgets within bordered containers were positioned with an incorrect offset. The inner content origin now correctly uses full border thickness instead of half-border thickness when calculating where flex layout content starts. ChangesBorder Offset Calculation Fix
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@Karanjot786 You may review and merge |
Description
The layout engine computes the inner content area's x/y offset as
padding + border / 2. For a 1-cell border,border.horizontal / 2 = 0.5, which becomes0afterMath.floor(). Child widgets are placed at the parent's top-left corner, directly overlapping the border characters.Root Cause
LayoutEngine.ts:88-89usedborder.horizontal / 2andborder.vertical / 2for the inner content offset, which afterMath.floor()rounded to 0 for standard 1-cell borders.Fix
Changed
border.horizontal / 2→border.horizontalandborder.vertical / 2→border.verticalso the inner content starts at the correct position after the border.Changes
packages/core/src/layout/LayoutEngine.ts:88-89— use full border width for inner content offsetCloses #682
Summary by CodeRabbit