fix bounds calculation ahead of time this PR handles marking a shape bounds as dirty after it has updated. This is needed because pointer events can trigger before a new draw update, which would consume the change flag before the shape has properly updated. Diffs= 085f5bd2d fix bounds calculation ahead of time (#7380) Co-authored-by: hernan <hernan@rive.app>
diff --git a/.rive_head b/.rive_head index 30ea12c..6e06eb9 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -dde676085908d492af545660cbbb19ee0d10d91d +085f5bd2dce2d25561b00eebc5f7118a2c8769eb
diff --git a/include/rive/shapes/shape.hpp b/include/rive/shapes/shape.hpp index 830e877..587d4aa 100644 --- a/include/rive/shapes/shape.hpp +++ b/include/rive/shapes/shape.hpp
@@ -60,6 +60,11 @@ } return m_WorldBounds; } + void markBoundsDirty() + { + drawableFlags(drawableFlags() & + ~static_cast<unsigned short>(DrawableFlag::WorldBoundsClean)); + } AABB computeWorldBounds(const Mat2D* xform = nullptr) const; AABB computeLocalBounds() const;
diff --git a/src/shapes/path_composer.cpp b/src/shapes/path_composer.cpp index adaef9c..e0bf032 100644 --- a/src/shapes/path_composer.cpp +++ b/src/shapes/path_composer.cpp
@@ -87,6 +87,7 @@ } } } + m_Shape->markBoundsDirty(); } }
diff --git a/src/shapes/shape.cpp b/src/shapes/shape.cpp index 157e378..e37b474 100644 --- a/src/shapes/shape.cpp +++ b/src/shapes/shape.cpp
@@ -70,7 +70,6 @@ void Shape::pathChanged() { - drawableFlags(drawableFlags() & ~static_cast<unsigned short>(DrawableFlag::WorldBoundsClean)); m_PathComposer.addDirt(ComponentDirt::Path, true); for (auto constraint : constraints()) {