-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Use logical coordinates for the UI layout #8426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Added a field `logical_size` to `LayoutContext` and changed its `min_size` and `max_size` fields to use logical sizes. * Modified `flex_node_system` and `FlexSurface` to use logical coordinates. * Changed the size paramter of `update_window` to a `Vec2` and renamed it to `logical_size`.
Yeah IMO the primary wins here are code quality. Can you fix up merge conflicts? |
yes, will do. |
Hmm... we ideally want to use physical coordinates in Taffy for rounding purposes (although this may not be critical for game UIs). I've been considering added a |
Yeah, I've been looking for rounding issues but I haven't seen anything so far. If Taffy supported scale factor that would probably be ideal though. We'd just convert the output coordinates back immediately when we update the node sizes and transforms etc. |
I think this one probably ought to block on DioxusLabs/taffy#478 |
Yep, I'm not sure about this one at all now. #8720 fixes a lot of the same problems, and doesn't have any of the possible negatives that this has. |
I'm going to close this in favor of #8720; we can revisit it later if y'all change your minds :) |
Objective
It would be a lot more efficient and less complicated if the UI layout systems only used logical coordinates.
Solution
Just use logical coordinates everywhere except where we can't.
Change
flex_node_system
andFlexSurface
to use logical coordinates.Changelog
flex_node_system
andFlexSurface
to use logical coordinates.update_window
to aVec2
and renamed it tological_size
.Migration Guide