Skip to content

Commit

Permalink
UI slice bug (#16772)
Browse files Browse the repository at this point in the history
# 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)
  • Loading branch information
romamik authored Dec 12, 2024
1 parent f4800c2 commit ae16a64
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,20 +766,20 @@ fn compute_texture_slices(
];

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

// compute the number of times to repeat the side and center slices when tiling along each axis
// if the returned value is `1.` the slice will be stretched to fill the axis.
let repeat_side_x =
compute_tiled_subaxis(image_side_width, target_side_height, sides_scale_mode);
compute_tiled_subaxis(image_side_width, target_side_width, sides_scale_mode);
let repeat_side_y =
compute_tiled_subaxis(image_side_height, target_side_width, sides_scale_mode);
compute_tiled_subaxis(image_side_height, target_side_height, sides_scale_mode);
let repeat_center_x =
compute_tiled_subaxis(image_side_width, target_side_height, center_scale_mode);
compute_tiled_subaxis(image_side_width, target_side_width, center_scale_mode);
let repeat_center_y =
compute_tiled_subaxis(image_side_height, target_side_width, center_scale_mode);
compute_tiled_subaxis(image_side_height, target_side_height, center_scale_mode);

[
slices,
Expand Down

0 comments on commit ae16a64

Please sign in to comment.