Skip to content

Commit

Permalink
Fix alignment when flex wrap enabled
Browse files Browse the repository at this point in the history
Fixes an issue where layout alignment wasn't working when flex wrap was enabled.

**Before:**

https://github.com/user-attachments/assets/0486c436-0049-49d8-8483-b6fdbf1cf2d5

**After:**

https://github.com/user-attachments/assets/0014e624-6b83-4417-a93d-6e1adea41bd3

Diffs=
dcb165130 Fix alignment when flex wrap enabled (#7722)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
  • Loading branch information
philter and philter committed Jul 31, 2024
1 parent 8a1d9a4 commit 7a409bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fbfa3b545dbfbe5616ee725f0dbb59b2626c603c
dcb1651300467e52124259dcdf0f61acf34148b4
6 changes: 6 additions & 0 deletions src/layout_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ void LayoutComponent::syncStyle()
if (isRowForAlignment)
{
ygStyle.alignItems() = YGAlignFlexStart;
ygStyle.alignContent() = YGAlignFlexStart;
}
else
{
Expand All @@ -334,6 +335,7 @@ void LayoutComponent::syncStyle()
if (isRowForAlignment)
{
ygStyle.alignItems() = YGAlignCenter;
ygStyle.alignContent() = YGAlignCenter;
}
else
{
Expand All @@ -347,6 +349,7 @@ void LayoutComponent::syncStyle()
if (isRowForAlignment)
{
ygStyle.alignItems() = YGAlignFlexEnd;
ygStyle.alignContent() = YGAlignFlexEnd;
}
else
{
Expand All @@ -366,6 +369,7 @@ void LayoutComponent::syncStyle()
else
{
ygStyle.alignItems() = YGAlignFlexStart;
ygStyle.alignContent() = YGAlignFlexStart;
}
break;
case LayoutAlignmentType::topCenter:
Expand All @@ -378,6 +382,7 @@ void LayoutComponent::syncStyle()
else
{
ygStyle.alignItems() = YGAlignCenter;
ygStyle.alignContent() = YGAlignCenter;
}
break;
case LayoutAlignmentType::topRight:
Expand All @@ -390,6 +395,7 @@ void LayoutComponent::syncStyle()
else
{
ygStyle.alignItems() = YGAlignFlexEnd;
ygStyle.alignContent() = YGAlignFlexEnd;
}
break;
case LayoutAlignmentType::spaceBetweenStart:
Expand Down

0 comments on commit 7a409bd

Please sign in to comment.