bevy
bevy copied to clipboard
Resolve `BorderRect` ambiguity
Objective
In UI and world coordinates, “top” and “bottom” mean opposite things, so these fields are ambiguous. Anyone using BorderRect must decide themselves how to apply the vertical insets.
Fixes #21913
For more in detail motivation, see the replies to issue #21913
Solution
Replace the directional BorderRect fields (left, right, top, and bottom) with min_inset and max_inset Vec2 fields.
Using min_inset and max_inset removes the need to interpret top or bottom relative to the coordinate system, so the same logic will work consistently in both UI and 2D.