Skip to content

Commit

Permalink
fix artboard origin offset
Browse files Browse the repository at this point in the history
when traversing the parented layouts testing bounds, if it is an artboard we need to account for its origin offset

Diffs=
7d39d0fca7 fix artboard origin offset (#8737)

Co-authored-by: hernan <[email protected]>
  • Loading branch information
bodymovin and bodymovin committed Dec 13, 2024
1 parent b16a7f5 commit 06b6388
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .rive_head
Original file line number Diff line number Diff line change
@@ -1 +1 @@
908fe3b784b5849d674e759ddf55b79fb3c1e0ca
7d39d0fca73e8cae8a1d8c1183e62ba7b6eb61f6
10 changes: 10 additions & 0 deletions src/animation/state_machine_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,16 @@ class HitDrawable : public HitComponent
if (!canSkip)
{
auto localWorld = inverseWorld * position;
if (layout->is<Artboard>())
{
auto artboard = layout->as<Artboard>();
if (artboard->frameOrigin())
{
localWorld += Vec2D(
artboard->originX() * artboard->layoutWidth(),
artboard->originY() * artboard->layoutHeight());
}
}
if (!layout->localBounds().contains(localWorld))
{
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/text/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ Vec2D Text::measure(Vec2D maxSize)
if (textOrigin() == TextOrigin::baseline && !lines.empty() &&
!lines[0].empty())
{
y -= m_lines[0][0].baseline;
y -= lines[0][0].baseline;
minY = y;
}
int ellipsisLine = -1;
Expand Down

0 comments on commit 06b6388

Please sign in to comment.