LinkedInAttic / LayoutKit

LayoutKit is a fast view layout library for iOS, macOS, and tvOS.
http://layoutkit.org
Apache License 2.0
3.16k stars 267 forks source link

StackLayout fillEqualSpacing leaving a gap at the bottom #159

Closed domasn closed 7 years ago

domasn commented 7 years ago

StackLayout doesn't fill all of the spacing using .fillEqualSpacing distribution if non-zero spacing parameter is passed.

The problem is in StackLayout.distributionConfig where it calculates the axisSpacing not taking into account the spaces that were already added during the measurement phase. Actual excessAxisLength for .fillEqualSpacing should be increased by numberOfSpaces * spacing so it can be redistrubuted.

See this example playground gist to reproduce the following screenshot:

actual

The expected behavior IMHO looks like this:

expected
nicksnyder commented 7 years ago

Thanks for the detailed bug report and PR to fix. The expected behavior that you described is what is supposed to happen.