SIGN IN SIGN UP
bevyengine / bevy UNCLAIMED

A refreshingly simple data-driven game engine built in Rust

0 0 59 Rust

`ImageNode` measure func fixes and allow drawing inside border and padding (#24154)

# Objective

Allowing drawing with `ImageNode` inside the border and padding boxes of
a UI node.
Fix a lot of image measurement and aspect ratio issues.

Fixes #24150

## Solution

Renamed `OverflowClipMarginBox` to `VisualBox`. 
Added a `visual_box: VisualBox` field to `ImageNode`.
Use the size of the selected node region in image rendering.
Fixed the bugs with the `ImageNode` measure func.

## Testing

Added many more cases to `testbed_ui`'s `image` and `slice` scenes:

```
cargo run --example testbed_ui -- --scene image
cargo run --example testbed_ui -- --scene slice
```

## Showcase

<img width="902" height="530" alt="box"
src="https://github.com/user-attachments/assets/74f873d4-f00e-47c3-ad3a-3640a39466e4"
/>
<img width="962" height="563" alt="borderbox"
src="https://github.com/user-attachments/assets/3b27c8e1-3b27-4a82-b136-95fed19c28ce"
/>
<img width="766" height="541" alt="content"
src="https://github.com/user-attachments/assets/a4543995-a835-45e1-8ffb-5d671fc7ec05"
/>
I
ickshonpe committed
50242076bff304acb00a8fad5e7c7e6339100ba1
Parent: 07fc18c
Committed by GitHub <noreply@github.com> on 5/6/2026, 3:39:27 PM