Skip to content

layout: add weighted child sizing - #8

Closed
GGRei wants to merge 1 commit into
mainfrom
feature/weighted-child-layout
Closed

layout: add weighted child sizing#8
GGRei wants to merge 1 commit into
mainfrom
feature/weighted-child-layout

Conversation

@GGRei

@GGRei GGRei commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary

Add gui.weighted() for assigning proportional main-axis space to container children.

A row distributes width, while a column or circle distributes height:

gui.weighted(weight: 2, view: gui.button(...))

The implementation:

  • supports constrained 1:1:2-style layouts;
  • redistributes space correctly around minimum and maximum sizes;
  • recalculates proportions when the parent is resized;
  • preserves the existing layout path when no weights are used;
  • adds no extra Layout node and does not change the View interface;
  • rejects invalid weights and unsupported configurations explicitly;
  • includes documentation and a resizable button example.

Validation

  • Weighted layout tests pass with Clang in normal and production modes.
  • Existing layout, wrap, border, GC leak and GC lint tests pass.
  • Documentation and formatting checks pass.
  • Shape remains 200 bytes.
  • No allocations occur during distribution after warm-up.
  • examples/weighted_layout.v compiles cleanly with -W and runs successfully.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

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 automated review suggestions for this pull request.

Reviewed commit: 06ccbd96d7

ℹ️ 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
  • 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 address that feedback".

Comment thread view_weighted.v
@GGRei

GGRei commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 06ccbd96d7

ℹ️ 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
  • 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 address that feedback".

@GGRei
GGRei force-pushed the feature/weighted-child-layout branch from 06ccbd9 to f9ae8a3 Compare July 12, 2026 10:03
@GGRei GGRei closed this Jul 12, 2026
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