bevy/crates/bevy_ui/src
Félix Lescaudey de Maneville e0c296ee14
Optional ImageScaleMode (#11780)
> Follow up to #11600 and #10588 

@mockersf expressed some [valid
concerns](https://github.com/bevyengine/bevy/pull/11600#issuecomment-1932796498)
about the current system this PR attempts to fix:

The `ComputedTextureSlices` reacts to asset change in both `bevy_sprite`
and `bevy_ui`, meaning that if the `ImageScaleMode` is inserted by
default in the bundles, we will iterate through most 2d items every time
an asset is updated.

# Solution

- `ImageScaleMode` only has two variants: `Sliced` and `Tiled`. I
removed the `Stretched` default
- `ImageScaleMode` is no longer part of any bundle, but the relevant
bundles explain that this additional component can be inserted

This way, the *absence* of `ImageScaleMode` means the image will be
stretched, and its *presence* will include the entity to the various
slicing systems

Optional components in bundles would make this more straigthfoward

# Additional work

Should I add new bundles with the `ImageScaleMode` component ?
2024-02-09 20:36:32 +00:00
..
layout Fix panic on Text UI without Cameras (#11405) 2024-01-18 20:33:22 +00:00
render UI Texture 9 slice (#11600) 2024-02-07 20:07:53 +00:00
widget Use warn_once where relevant instead of manually implementing a single warn check (#11693) 2024-02-05 21:05:43 +00:00
accessibility.rs resolve all internal ambiguities (#10411) 2024-01-09 19:08:15 +00:00
focus.rs Deprecated Various Component Methods from Query and QueryState (#9920) 2024-02-04 01:01:59 +00:00
geometry.rs Made the remaining types from bevy_ui to reflect the Default trait if… (#11199) 2024-01-03 18:57:05 +00:00
lib.rs UI Texture 9 slice (#11600) 2024-02-07 20:07:53 +00:00
measurement.rs Change the default for the measure_func field of ContentSize to None. (#9346) 2023-08-07 23:06:40 +00:00
node_bundles.rs Optional ImageScaleMode (#11780) 2024-02-09 20:36:32 +00:00
stack.rs Avoid unconditionally unwrapping the Result - UI Stack System (#11575) 2024-01-29 02:38:41 +00:00
texture_slice.rs Optional ImageScaleMode (#11780) 2024-02-09 20:36:32 +00:00
ui_material.rs Provide GlobalsUniform in UiMaterial shaders (#10739) 2023-11-28 12:08:28 +00:00
ui_node.rs Rustdoc links in bevy_ui (#11555) 2024-01-28 02:21:39 +00:00
update.rs Camera-driven UI (#10559) 2024-01-16 00:39:10 +00:00