bevy/crates/bevy_sprite/src/texture_slice
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
..
border_rect.rs Sprite slicing and tiling (#10588) 2024-01-15 15:40:06 +00:00
computed_slices.rs Optional ImageScaleMode (#11780) 2024-02-09 20:36:32 +00:00
mod.rs UI Texture 9 slice (#11600) 2024-02-07 20:07:53 +00:00
slicer.rs UI Texture 9 slice (#11600) 2024-02-07 20:07:53 +00:00