Skip to content
Discussion options

You must be logged in to vote

The left widget is centered in the UI area allocated at the time it is added. The vertical UI cannot fit in this allocation when the second (and then the third) middle widget is added, so more area is allocated. Then when the right widget is added it is centered in the latest allocation.

If you were expecting this:

You'll need to do a sizing pass to get the maximum height of the allocated area and then allocate that before adding the left widget like so:

ui.horizontal(|ui| {
    ui.allocate_ui([0., 54.].into(), |ui| { // here I just use 3x ui.min_rect().height() after left label is added
        ui.label("left");
        ui.vertical(|ui| {
            ui.label("middle1");
            ui.l…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nczyw
Comment options

Answer selected by nczyw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants