Skip to content

Commit

Permalink
fixed a bug of length calculation (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
yohamta authored Apr 29, 2023
1 parent bafd685 commit c15ce85
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flex.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (f *flexEmbed) layout(width, height int, container *containerEmbed) {
// Calculate the remaining width after taking out the fixed width items.
remFree := width
for _, c := range children {
remFree -= c.node.item.Width
remFree -= (c.node.item.Width + c.node.item.MarginLeft + c.node.item.MarginRight)
}
// If there is remaining space, distribute it among the flexible items.
if remFree > 0 {
Expand All @@ -261,7 +261,7 @@ func (f *flexEmbed) layout(width, height int, container *containerEmbed) {
// Calculate the remaining height after taking out the fixed width items.
remFree := height
for _, c := range children {
remFree -= c.node.item.Height
remFree -= (c.node.item.Height + c.node.item.MarginTop + c.node.item.MarginBottom)
}
// If there is remaining space, distribute it among the flexible items.
if remFree > 0 {
Expand Down

0 comments on commit c15ce85

Please sign in to comment.