bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.39k stars 3.49k forks source link

move `BorderRect` into `bevy_math` #15440

Open ickshonpe opened 2 days ago

ickshonpe commented 2 days ago

What problem does this solve or what need does it fill?

It's in bevy_sprite::texture_slice at the moment. I've been using it in the UI to hold border and padding values though.

What solution would you like?

Move it into bevy_math::rects.

What alternative(s) have you considered?

We could just use Rect to hold inset/border/padding values. Different types make its easier to understand that it represents inset values relative to a rectangle and not a rectangle itself.

Atlas16A commented 2 days ago

I would support this. However I did try thinking of a less Ui centric name but couldn't come up with one.

rudderbucky commented 2 days ago

Should this even be called BorderRect? Seems like the purpose of this class is to represent paddings from the four directions rather than explicitly define a shape. Maybe something like BorderInsets or Insets?