Description
What problem does this solve or what need does it fill?
When dragging, we often need to compute the relative position of the mouse pointer based on the width and height of the widget. However, node.size()
returns the physical size, not the logical size of the entity. This means that the node size and the mouse position are in different units if the window scale factor is not 1.
Fortunately, the node contains an inverse_scale_factor
property, so getting the logical size is trivial: multiply the physical size by inverse_scale_factor
. However, new users may not realize that they need to do this multiplication, especially if they are developing on a window system with a scale factor of 1.
What solution would you like?
Add a logical_size()
method to ComputedNode
which simply returns the size * inverse_scale_factor
.
Additional context
This is a super-trivial addition, and would be a great starter task for a novice user who is looking for a way to get started hacking on Bevy.