Skip to content

FlexBox and Grid Layouts support - #169

Merged
kunitoki merged 6 commits into
mainfrom
dev/layouts
Sep 8, 2026
Merged

FlexBox and Grid Layouts support#169
kunitoki merged 6 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 96.78431% with 41 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.87%. Comparing base (94dfafe) to head (456674e).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
modules/yup_gui/layout/yup_Grid.cpp 95.72% 19 Missing ⚠️
modules/yup_gui/layout/yup_FlexBox.cpp 96.71% 12 Missing ⚠️
...odules/yup_python/bindings/yup_YupGui_bindings.cpp 96.86% 8 Missing ⚠️
modules/yup_gui/layout/yup_LayoutDistribution.h 92.85% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #169      +/-   ##
==========================================
+ Coverage   81.49%   81.87%   +0.38%     
==========================================
  Files         798      807       +9     
  Lines       83336    84613    +1277     
==========================================
+ Hits        67911    69274    +1363     
+ Misses      15425    15339      -86     
Files with missing lines Coverage Δ
...odules/yup_graphics/formats/yup_PngImageFormat.cpp 83.74% <100.00%> (+0.73%) ⬆️
modules/yup_gui/layout/yup_FlexBox.h 100.00% <100.00%> (ø)
modules/yup_gui/layout/yup_FlexItem.cpp 100.00% <100.00%> (ø)
modules/yup_gui/layout/yup_FlexItem.h 100.00% <100.00%> (ø)
modules/yup_gui/layout/yup_Grid.h 100.00% <100.00%> (ø)
modules/yup_gui/layout/yup_GridItem.cpp 100.00% <100.00%> (ø)
modules/yup_gui/layout/yup_GridItem.h 100.00% <100.00%> (ø)
modules/yup_gui/layout/yup_LayoutDistribution.h 92.85% <92.85%> (ø)
...odules/yup_python/bindings/yup_YupGui_bindings.cpp 97.69% <96.86%> (+2.63%) ⬆️
modules/yup_gui/layout/yup_FlexBox.cpp 96.71% <96.71%> (ø)
... and 1 more

... and 22 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 88e95d5...456674e. 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.

@kunitoki
kunitoki merged commit 6389f3b into main Sep 8, 2026
41 checks passed
@kunitoki
kunitoki deleted the dev/layouts branch September 8, 2026 13:20
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