Skip to content

Commit

Permalink
Call updateLayoutBounds on NestedArtboardLayout
Browse files Browse the repository at this point in the history
I think this is the right fix here. Since the calls to updateLayoutBounds are now passed down through layout children rather than on advance, we also needed to call updateLayoutBounds on NestedArtboardLayout, since those "provide" their layout nodes to their parent artboards layout tree (thus updateLayoutBounds doesn't get called during their own Artboard's advance).

Diffs=
6931974fe3 Call updateLayoutBounds on NestedArtboardLayout (#8398)

Co-authored-by: Philip Chung <philterdesign@gmail.com>
  • Loading branch information
philter and philter committed Oct 23, 2024
1 parent 6ef909e commit 31b5aaf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c7cd1c8c741fcab1f237c2f65c7fe148f2925ff9
6931974fe3eb4a5dcda546cafe2ed50e9da2c939
1 change: 1 addition & 0 deletions include/rive/nested_artboard_layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class NestedArtboardLayout : public NestedArtboardLayoutBase

float actualInstanceWidth();
float actualInstanceHeight();
void updateLayoutBounds(bool animate);

protected:
void instanceWidthChanged() override;
Expand Down
4 changes: 4 additions & 0 deletions src/layout_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ void LayoutComponent::updateLayoutBounds(bool animate)
{
child->as<LayoutComponent>()->updateLayoutBounds(animate);
}
else if (child->is<NestedArtboardLayout>())
{
child->as<NestedArtboardLayout>()->updateLayoutBounds(animate);
}
}

Layout newLayout(node.getLayout());
Expand Down
13 changes: 13 additions & 0 deletions src/nested_artboard_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ StatusCode NestedArtboardLayout::onAddedClean(CoreContext* context)
return StatusCode::Ok;
}

void NestedArtboardLayout::updateLayoutBounds(bool animate)
{
#ifdef WITH_RIVE_LAYOUT
if (artboardInstance() == nullptr)
{
return;
}
artboardInstance()->updateLayoutBounds(animate);
#endif
}

void NestedArtboardLayout::updateWidthOverride()
{
if (artboardInstance() == nullptr)
Expand Down Expand Up @@ -113,6 +124,7 @@ void NestedArtboardLayout::updateWidthOverride()
{
artboardInstance()->widthIntrinsicallySizeOverride(true);
}
markNestedLayoutDirty();
}

void NestedArtboardLayout::updateHeightOverride()
Expand Down Expand Up @@ -142,6 +154,7 @@ void NestedArtboardLayout::updateHeightOverride()
{
artboardInstance()->heightIntrinsicallySizeOverride(true);
}
markNestedLayoutDirty();
}

void NestedArtboardLayout::instanceWidthChanged() { updateWidthOverride(); }
Expand Down

0 comments on commit 31b5aaf

Please sign in to comment.