Replies: 2 comments 2 replies
-
Not an expert, but here's my 2 cents: It is really hard for egui to center multiple things at a time, because that requires it to know their total size in advance before it starts drawing any of them, but that is not how an immediate mode gui works. Do you actually need horizontal centering of multiple items? In a project where I thought I needed this at first, what I did instead was created a columns layout and assigned each item to a column. This looked pretty good and all the items are nicely spaced and centered within their columns.
|
Beta Was this translation helpful? Give feedback.
-
There might be a way that you can manually calculate their total width, create a container of that size which is centered, and then add them to the container, but I think it would be painful. |
Beta Was this translation helpful? Give feedback.
-
How would I go by centering multiple widgets horizontally, on the same row?
I tried
horizontal_centered
but it didn't actually center it on the same row, instead it started expanding the height of the entire window, andvertical_centered
is for stacking widgets on-top of each other.Code I tried which refuses to center the widgets in the middle, on the same row:
Beta Was this translation helpful? Give feedback.
All reactions