nicbarker / clay

High performance UI layout library in C.
https://nicbarker.com/clay
zlib License
1.19k stars 26 forks source link

[BUG] elements with fixed size between elements with grow size #38

Open SogoCZE opened 2 days ago

SogoCZE commented 2 days ago

When we have three elements in a row with widths:

Layout behaves incorrectly. Two grow-width elements should have the same width - they should be half of what is left of the parent's available width after subtracting the fixed-width element. Currently, the third element is larger than the first.

Clay result: image

CSS result: image

nicbarker commented 2 days ago

Thanks for the report, will look into getting this fixed today 👍

nicbarker commented 1 day ago

I'm reasonably sure this fixes the issue: 26013e6. Please test it out when you get a chance and let me know 🙂

SogoCZE commented 1 day ago

it's definitely better than it was, but the last element is always a little bigger than it should be, and the first is smaller (by a few pixels, e.g. 5).

For example, if I have a container 600 pixels wide with elements:

they should all be exactly 200 pixels wide. However, the first has 197 and the third has 202.