@@ -3,7 +3,7 @@ use bevy_math::Vec2;
3
3
use bevy_reflect:: Reflect ;
4
4
5
5
/// 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,
7
7
/// so that on resize the different portions scale or tile in different ways to keep the texture in proportion.
8
8
///
9
9
/// For example, when resizing a 9-sliced texture the corners will remain unscaled while the other
@@ -16,11 +16,9 @@ pub struct TextureSlicer {
16
16
pub border : BorderRect ,
17
17
/// Defines how the center part of the 9 slices will scale
18
18
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
20
20
pub sides_scale_mode : SliceScaleMode ,
21
21
/// 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
24
22
pub max_corner_scale : f32 ,
25
23
}
26
24
@@ -35,6 +33,9 @@ pub enum SliceScaleMode {
35
33
/// The slice will repeat when the ratio between the *drawing dimensions* of texture and the
36
34
/// *original texture size* are above `stretch_value`.
37
35
///
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
+ ///
38
39
/// Note: The value should be inferior or equal to `1.0` to avoid quality loss.
39
40
///
40
41
/// Note: the value will be clamped to `0.001` if lower
@@ -56,7 +57,7 @@ impl TextureSlicer {
56
57
/// Computes the 4 corner slices
57
58
fn corner_slices ( & self , base_rect : Rect , render_size : Vec2 ) -> [ TextureSlice ; 4 ] {
58
59
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 ) ;
60
61
[
61
62
// Top Left Corner
62
63
TextureSlice {
0 commit comments