@@ -3,7 +3,7 @@ use bevy_math::Vec2;
33use bevy_reflect:: Reflect ;
44
55/// Slices a texture using the **9-slicing** technique. This allows to reuse an image at various sizes
6- /// without needing to prepare multiple assets. The associated texture will be split tinto nine portions,
6+ /// without needing to prepare multiple assets. The associated texture will be split into nine portions,
77/// so that on resize the different portions scale or tile in different ways to keep the texture in proportion.
88///
99/// For example, when resizing a 9-sliced texture the corners will remain unscaled while the other
@@ -16,11 +16,9 @@ pub struct TextureSlicer {
1616 pub border : BorderRect ,
1717 /// Defines how the center part of the 9 slices will scale
1818 pub center_scale_mode : SliceScaleMode ,
19- /// Defines how the 4 side part of the 9 slices will scale
19+ /// Defines how the 4 side parts of the 9 slices will scale
2020 pub sides_scale_mode : SliceScaleMode ,
2121 /// Defines the maximum scale of the 4 corner slices (default to `1.0`)
22- ///
23- /// Note: the value will be clamped to `0.001` if lower
2422 pub max_corner_scale : f32 ,
2523}
2624
@@ -35,6 +33,9 @@ pub enum SliceScaleMode {
3533 /// The slice will repeat when the ratio between the *drawing dimensions* of texture and the
3634 /// *original texture size* are above `stretch_value`.
3735 ///
36+ /// Example: `1.0` means that a 10 pixel wide image would repeat after 10 screen pixels.
37+ /// `2.0` means it would repeat after 20 screen pixels.
38+ ///
3839 /// Note: The value should be inferior or equal to `1.0` to avoid quality loss.
3940 ///
4041 /// Note: the value will be clamped to `0.001` if lower
@@ -56,7 +57,7 @@ impl TextureSlicer {
5657 /// Computes the 4 corner slices
5758 fn corner_slices ( & self , base_rect : Rect , render_size : Vec2 ) -> [ TextureSlice ; 4 ] {
5859 let coef = render_size / base_rect. size ( ) ;
59- let min_coef = coef. x . min ( coef. y ) . min ( self . max_corner_scale . max ( 0.001 ) ) ;
60+ let min_coef = coef. x . min ( coef. y ) . min ( self . max_corner_scale ) ;
6061 [
6162 // Top Left Corner
6263 TextureSlice {
0 commit comments