bevyengine / bevyengine/bevy

Inject measure funcs directly into UiSurface

Open
#17,779 1 comment 0 reactions 0 assignees View on GitHub
A-UI C-Code-Quality
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

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

Atm we set measure funcs indirectly using the `ContentSize` component. If a new measure is required for some content the content's update system has to wrap the measure inside a NodeMeasure enum which is then wrapped inside an Option. In `ui_system_layout` we `take` it out the option and pass it taffy which stores it in its `node_context_data` slotmap. This seems unnecessarily overcomplicated.

## What solution would you like?

Instead the systems that update the measure funcs could just retrieve `UiSurface` and call its `update_node_context` method to inject the measure directly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.