bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Add methods for calculating the size and postion of UI nodes

Open ickshonpe opened this issue 2 years ago • 2 comments

Objective

Users are often confused about how to calculate the size and position of UI nodes.

Solution

Implement methods on Node to calculate its size and position given its GlobalTransform.

Changelog

  • Added methods logical_rect and physical_rect that calculate the geometry of a UI node and return it as a bevy_math::Rect

ickshonpe avatar Mar 06 '23 14:03 ickshonpe

This will be super useful for tests too.

alice-i-cecile avatar Mar 06 '23 14:03 alice-i-cecile

For some reason it pulled in my changes from the UI example fix PR. Fixed, I think.

ickshonpe avatar Mar 06 '23 14:03 ickshonpe