bevy/examples/ui
ickshonpe 8a3a8b5cfb
Only use physical coords internally in bevy_ui (#16375)
# Objective

We switch back and forwards between logical and physical coordinates all
over the place. Systems have to query for cameras and the UiScale when
they shouldn't need to. It's confusing and fragile and new scale factor
bugs get found constantly.

## Solution

* Use physical coordinates whereever possible in `bevy_ui`. 
* Store physical coords in `ComputedNode` and tear out all the unneeded
scale factor calculations and queries.
* Add an `inverse_scale_factor` field to `ComputedNode` and set nodes
changed when their scale factor changes.

## Migration Guide

`ComputedNode`'s fields and methods now use physical coordinates.
`ComputedNode` has a new field `inverse_scale_factor`. Multiplying the
physical coordinates by the `inverse_scale_factor` will give the logical
values.

---------

Co-authored-by: atlv <email@atlasdostal.com>
2024-11-22 00:45:07 +00:00
..
borders.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
box_shadow.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
button.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
display_and_visibility.rs Fixes for a few minor borders and outlines bugs (#16071) 2024-10-23 20:41:42 +00:00
flex_layout.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
font_atlas_debug.rs UiImage -> ImageNode, UiImageSize -> ImageNodeSize (#16271) 2024-11-07 21:52:58 +00:00
ghost_nodes.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
grid.rs Use en-us locale for typos (#16037) 2024-10-20 18:55:17 +00:00
overflow.rs UiImage -> ImageNode, UiImageSize -> ImageNodeSize (#16271) 2024-11-07 21:52:58 +00:00
overflow_clip_margin.rs UiImage -> ImageNode, UiImageSize -> ImageNodeSize (#16271) 2024-11-07 21:52:58 +00:00
overflow_debug.rs Only use physical coords internally in bevy_ui (#16375) 2024-11-22 00:45:07 +00:00
relative_cursor_position.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
render_ui_to_texture.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
scroll.rs Remove accesskit re-export from bevy_a11y (#16257) 2024-11-08 21:01:16 +00:00
size_constraints.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
text.rs UI/text Example - Clarity Improvements (#16302) 2024-11-09 23:50:14 +00:00
text_debug.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
text_wrap_debug.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
transparency_ui.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
ui_material.rs Fix red background in ui_material example (#15978) 2024-10-20 01:08:17 +00:00
ui_scaling.rs UiImage -> ImageNode, UiImageSize -> ImageNodeSize (#16271) 2024-11-07 21:52:58 +00:00
ui_texture_atlas.rs UiImage -> ImageNode, UiImageSize -> ImageNodeSize (#16271) 2024-11-07 21:52:58 +00:00
ui_texture_atlas_slice.rs UiImage -> ImageNode, UiImageSize -> ImageNodeSize (#16271) 2024-11-07 21:52:58 +00:00
ui_texture_slice.rs UiImage -> ImageNode, UiImageSize -> ImageNodeSize (#16271) 2024-11-07 21:52:58 +00:00
ui_texture_slice_flip_and_tile.rs Only use physical coords internally in bevy_ui (#16375) 2024-11-22 00:45:07 +00:00
viewport_debug.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
window_fallthrough.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00
z_index.rs Merge Style properties into Node. Use ComputedNode for computed properties. (#15975) 2024-10-18 22:25:33 +00:00