Skip to content

Commit 832934a

Browse files
romamikmockersf
authored andcommitted
UI slice bug (#16772)
# Objective Fixes #16771 ## Solution Fixed typo in code. ## Testing - Did you test these changes? If so, how? I tested on my own example, that I included in the issue. It was behaving as I expected. Here is the screenshot after fix, the screenshot before the fix can be found in the issue. ![image](https://github.com/user-attachments/assets/f558363f-718d-4244-980c-d224feb2ba0b)
1 parent c928ca1 commit 832934a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -764,20 +764,20 @@ fn compute_texture_slices(
764764
];
765765

766766
let image_side_width = image_size.x * (slices[2] - slices[0]);
767-
let image_side_height = image_size.y * (slices[2] - slices[1]);
768-
let target_side_height = target_size.x * (border[2] - border[0]);
769-
let target_side_width = target_size.y * (border[3] - border[1]);
767+
let image_side_height = image_size.y * (slices[3] - slices[1]);
768+
let target_side_width = target_size.x * (border[2] - border[0]);
769+
let target_side_height = target_size.y * (border[3] - border[1]);
770770

771771
// compute the number of times to repeat the side and center slices when tiling along each axis
772772
// if the returned value is `1.` the slice will be stretched to fill the axis.
773773
let repeat_side_x =
774-
compute_tiled_subaxis(image_side_width, target_side_height, sides_scale_mode);
774+
compute_tiled_subaxis(image_side_width, target_side_width, sides_scale_mode);
775775
let repeat_side_y =
776-
compute_tiled_subaxis(image_side_height, target_side_width, sides_scale_mode);
776+
compute_tiled_subaxis(image_side_height, target_side_height, sides_scale_mode);
777777
let repeat_center_x =
778-
compute_tiled_subaxis(image_side_width, target_side_height, center_scale_mode);
778+
compute_tiled_subaxis(image_side_width, target_side_width, center_scale_mode);
779779
let repeat_center_y =
780-
compute_tiled_subaxis(image_side_height, target_side_width, center_scale_mode);
780+
compute_tiled_subaxis(image_side_height, target_side_height, center_scale_mode);
781781

782782
[
783783
slices,

0 commit comments

Comments
 (0)