Open micfong-z opened 1 year ago
Might be related to #1830, but only RetainedImage is mentioned there.
I think this is a limitation of immediate mode. Ui::horizontal
assumes your content is spacing().interact_size.y
tall and centers vertically based on that. If you know the height of your content you can set that value, or try Ui:horizontal_top
. Ui::horizontal_centered
can also work, but that eats up all available vertical height, which might also be problematic depending on your layout.
I believe this is the same issue at #1830 as you pointed out. Grid uses Ui::horizontal
internally.
Describe the bug
Grid
layout show incorrect margin whenui.horizontal()
is used inside as a cell.In the following screenshot:
My guess for the reason
Looking at the first row only, I'm thinking that egui may have pre-calculated the size of
horizontal
once and put Label 1 into the correct position, however egui falsely shifted thehorizontal
downwards as well to match the top of Label 1. This applies to the rest of the rows.To Reproduce Here's the code used to reproduce the problem
Expected behavior The grid layout should function as normal, with correct margins between each line.
Desktop information