bevyengine / bevyengine/bevy

`Val` variants based on the size of the root UI node

Open
#16,130 0 comments 0 reactions 0 assignees View on GitHub
A-UI C-Feature D-Modest S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

Bevy's support for responsive UI coordinates is still very limited. There's no way to add a `Val::Calc` variant at the moment and no support for responsive font sizes.

`Val` has `Vw`, `Vh`, `VMin` and `VMax` responsive coordinate variants that wrap percentage values that are resolved to physical coordinates during layout computation based on the size of the UI camera.

Maybe it would be useful for users to have an option for responsive coordinates resolved based on the size of the root UI node entity instead (or a size they set themselves).

## What solution would you like?

Solutions that come to mind are:

* Corresponding `Rw`, `Rh`, `RMin` and `RMax` responsive coordinate variants that are based on the size of the root UI element.
* A `ViewportSizeOverride` (or whatever) component you could place on a root UI entity that allows you to specify what size the responsive viewport values should be based on.

The `Rw/Rh/RMin/RMax` variants seem less confusing, but harder to maintain as there are a lot of `Val` helper and resolver functions that would need to be updated.

`ViewportSizeOverride` would be trivial to implement but might be a bit obscure and confusing and it wouldn't support both coordinate types together in one layout,

Another thing would be to leave the viewport coords as they are, add the `R*` variants and implement the override for the `R*` variants.

## Alternatives

Do nothing, I'm not certain this would be that useful.

Contributor guide

Open the contributing guide

Research direction

No specific file or test is named. Start by locating Val's Vw, Vh, VMin, and VMax definitions, helper functions, and layout resolvers, then compare the proposed root-node sizing and ViewportSizeOverride approaches. Done requires an agreed design and responsive values that resolve from the intended root UI size without breaking existing viewport-based coordinates.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.