Skip to content

FlexBox and Grid Layouts support - #169

Open
kunitoki wants to merge 2 commits into
mainfrom
dev/layouts
Open

FlexBox and Grid Layouts support#169
kunitoki wants to merge 2 commits into
mainfrom
dev/layouts

Conversation

@kunitoki

Copy link
Copy Markdown
Owner
image

This pull request introduces a comprehensive and flexible CSS-like layout system to the codebase, centered around new FlexBox and FlexItem classes. It also adds an extensive Layout example to the graphics demos and brings several improvements and bug fixes to layout behavior, especially for flex and grid containers.

The most important changes are:

New Layout System:

  • Introduced FlexBox and FlexItem classes, providing a CSS Flexbox-inspired layout engine for arranging components with flexible sizing, alignment, wrapping, and ordering. Includes full API documentation and helper methods for common layout patterns. (modules/yup_gui/layout/yup_FlexBox.h [1] modules/yup_gui/layout/yup_FlexItem.h [2] modules/yup_gui/layout/yup_FlexItem.cpp [3]

Examples and Demo Integration:

  • Added a new Layout example to examples/graphics, showcasing FlexBox and Grid layout features such as direction, wrapping, alignment, flexible sizing, grid track sizing, placement, and nesting. Integrated this example into the graphics demo selector. (CHANGELOG.md [1] examples/graphics/source/main.cpp [2] [3]

Layout Engine Improvements and Bug Fixes:

  • Fixed a bug in FlexBox where the gap was incorrectly applied after the last item on each line, which previously caused overflow and clipping issues. (CHANGELOG.md CHANGELOG.mdR155)
  • Enhanced FlexBox and Grid behavior: flex-shrink is now correctly applied on overflow, wrapReverse is supported, min/max constraints are clamped for all alignments, and items with unspecified sizes now default to the component's bounds rather than collapsing. Added percentage sizing support and improved baseline alignment. Grid auto-placement and sizing fields were also introduced. (CHANGELOG.md CHANGELOG.mdR331-R338)

These changes significantly improve the flexibility, correctness, and usability of the GUI layout system, enabling advanced UI layouts in applications.

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.02128% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.70%. Comparing base (3167a0c) to head (6bbe6fb).

Files with missing lines Patch % Lines
modules/yup_gui/layout/yup_FlexBox.cpp 93.00% 17 Missing ⚠️
modules/yup_gui/layout/yup_Grid.cpp 91.84% 15 Missing ⚠️
modules/yup_gui/layout/yup_FlexItem.cpp 81.42% 13 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #169      +/-   ##
==========================================
+ Coverage   80.58%   80.70%   +0.12%     
==========================================
  Files         777      781       +4     
  Lines       80278    80842     +564     
==========================================
+ Hits        64689    65243     +554     
- Misses      15589    15599      +10     
Files with missing lines Coverage Δ
modules/yup_gui/layout/yup_GridItem.cpp 100.00% <100.00%> (ø)
modules/yup_gui/layout/yup_FlexItem.cpp 81.42% <81.42%> (ø)
modules/yup_gui/layout/yup_Grid.cpp 91.84% <91.84%> (ø)
modules/yup_gui/layout/yup_FlexBox.cpp 93.00% <93.00%> (ø)

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3167a0c...6bbe6fb. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant