Skip to content

CornerRadius border radius value semantic and ergonomic improvements#25050

Open
ickshonpe wants to merge 4 commits into
bevyengine:mainfrom
ickshonpe:border-radius-coords
Open

CornerRadius border radius value semantic and ergonomic improvements#25050
ickshonpe wants to merge 4 commits into
bevyengine:mainfrom
ickshonpe:border-radius-coords

Conversation

@ickshonpe

@ickshonpe ickshonpe commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Objective

The elliptical border-radius PR was merged with a slightly half baked API.

In particular, a corner given a single radius value should be circular or square. For example, with:

Node {
    width: px(200),
    height: px(100),
    border_radius: px(100),
}

it should clamp the radius on both axes to the min half size (50) so we get circular corners, but on main atm you get an elliptical (100, 50) radius corner.

Solution

  • Val2 has the wrong semantics. Added a new struct CornerRadius { x: Val, y: Val }.
  • A CornerRadius created from a single val: Val is mapped to CornerRadius { x: val, y: Val::Auto }.
  • If either field is zero or both are auto, the corner will be square.
  • If one field is auto, the resolved radius will be circular with the radius clamped to max half of the min of the node's width or height.

Still needs a bit more bikeshedding and some additional docs.

Testing

There is a new test and an extra example case in the elliptical radius UI testbed.

`CornerRadius` has different semantics to `Val2`:
- If one field is auto, the resolved radius will be circular with the radius clamped to max half of the min of the node's width or height.
- If either field is zero or both are auto, the node will have square corners.
@ickshonpe ickshonpe added A-UI Graphical user interfaces, styles, layouts, and widgets S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged labels Jul 17, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI Jul 17, 2026
@ickshonpe ickshonpe added D-Straightforward Simple bug fixes and API improvements, docs, test and examples C-Usability A targeted quality-of-life change that makes Bevy easier to use labels Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-25050

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Your PR caused a change in the graphical output of an example or rendering test. This might be intentional, but it could also mean that something broke!
You can review it at https://pixel-eagle.com/project/B04F67C0-C054-4A6F-92EC-F599FEC2FD1D?filter=PR-25050

If it's expected, please add the M-Deliberate-Rendering-Change label.

If this change seems unrelated to your PR, you can consider updating your PR to target the latest main branch, either by rebasing or merging main into it.

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

Labels

A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Waiting-on-Author The author needs to make changes or address concerns before this can be merged

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

1 participant