bevy/crates
ickshonpe edba496697
Store both the rounded and unrounded node size in Node (#9923)
# Objective

Text bounds are computed by the layout algorithm using the text's
measurefunc so that text will only wrap after it's used the maximum
amount of available horizontal space.

When the layout size is returned the layout coordinates are rounded and
this sometimes results in the final size of the Node not matching the
size computed with the measurefunc. This means that the text may no
longer fit the horizontal available space and instead wrap onto a new
line. However, no glyphs will be generated for this new line because no
vertical space for the extra line was allocated.

fixes #9874

## Solution

Store both the rounded and unrounded node sizes in `Node`.

Rounding is used to eliminate pixel-wide gaps between nodes that should
be touching edge to edge, but this isn't necessary for text nodes as
they don't have solid edges.

## Changelog

* Added the `rounded_size: Vec2` field to `Node`.
* `text_system` uses the unrounded node size when computing a text
layout.

---------

Co-authored-by: Rob Parrett <robparrett@gmail.com>
2023-09-28 22:42:13 +00:00
..
bevy_a11y Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_animation Fix morph interpolation (#9927) 2023-09-27 01:46:27 +00:00
bevy_app Only run event systems if they have tangible work to do (#7728) 2023-09-24 00:16:33 +00:00
bevy_asset Fix some typos (#9934) 2023-09-26 19:46:24 +00:00
bevy_audio Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_core Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
bevy_core_pipeline skybox.wgsl: Fix precision issues (#9909) 2023-09-23 22:11:59 +00:00
bevy_derive bevy_derive: Fix #[deref] breaking other attributes (#9551) 2023-08-28 17:36:18 +00:00
bevy_diagnostic Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
bevy_dylib Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_dynamic_plugin Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_ecs Use EntityHashMap<Entity, T> for render world entity storage for better performance (#9903) 2023-09-27 08:28:28 +00:00
bevy_ecs_compile_fail_tests Fix CI for Rust 1.72 (#9562) 2023-08-25 12:34:24 +00:00
bevy_encase_derive Bump Version after Release (#9106) 2023-07-10 21:19:27 +00:00
bevy_gilrs Refactor EventReader::iter to read (#9631) 2023-08-30 14:20:03 +00:00
bevy_gizmos Fix some typos (#9934) 2023-09-26 19:46:24 +00:00
bevy_gltf Handle empty morph weights when loading gltf (#9867) 2023-09-20 17:40:00 +00:00
bevy_hierarchy Add as_slice to parent (#9871) 2023-09-22 06:27:58 +00:00
bevy_input Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
bevy_internal Allow using async_io::block_on in bevy_tasks (#9626) 2023-09-25 19:59:50 +00:00
bevy_log Update tracy-client requirement from 0.15 to 0.16 (#9436) 2023-08-15 07:45:21 +00:00
bevy_macro_utils Add some more helpful errors to BevyManifest when it doesn't find Cargo.toml (#9207) 2023-07-19 12:05:04 +00:00
bevy_macros_compile_fail_tests bevy_derive: Fix #[deref] breaking other attributes (#9551) 2023-08-28 17:36:18 +00:00
bevy_math Automatic batching/instancing of draw commands (#9685) 2023-09-21 22:12:34 +00:00
bevy_mikktspace Fix erronenous glam version (#9653) 2023-08-31 12:55:17 +00:00
bevy_pbr Use EntityHashMap<Entity, T> for render world entity storage for better performance (#9903) 2023-09-27 08:28:28 +00:00
bevy_ptr Put #[repr(transparent)] attr to bevy_ptr types (#9068) 2023-07-14 18:55:15 +00:00
bevy_reflect Fix some typos (#9934) 2023-09-26 19:46:24 +00:00
bevy_reflect_compile_fail_tests Fix CI for Rust 1.72 (#9562) 2023-08-25 12:34:24 +00:00
bevy_render Use EntityHashMap<Entity, T> for render world entity storage for better performance (#9903) 2023-09-27 08:28:28 +00:00
bevy_scene Remove useless single tuples and trailing commas (#9720) 2023-09-08 21:46:54 +00:00
bevy_sprite Use EntityHashMap<Entity, T> for render world entity storage for better performance (#9903) 2023-09-27 08:28:28 +00:00
bevy_tasks Allow using async_io::block_on in bevy_tasks (#9626) 2023-09-25 19:59:50 +00:00
bevy_text register TextLayoutInfo and TextFlags type. (#9919) 2023-09-25 18:59:29 +00:00
bevy_time Improve doc formatting. (#9840) 2023-09-18 19:43:56 +00:00
bevy_transform Rename RemovedComponents::iter/iter_with_id to read/read_with_id (#9778) 2023-09-15 12:37:20 +00:00
bevy_ui Store both the rounded and unrounded node size in Node (#9923) 2023-09-28 22:42:13 +00:00
bevy_utils Use EntityHashMap<Entity, T> for render world entity storage for better performance (#9903) 2023-09-27 08:28:28 +00:00
bevy_window Fix the doc warning attribute and document remaining items for bevy_window (#9933) 2023-09-27 07:08:09 +00:00
bevy_winit macOS Sonoma (14.0) / Xcode 15.0 — Compatibility Fixes + Docs (#9905) 2023-09-27 22:41:16 +00:00