|
2 | 2 | #include "rive/artboard.hpp" |
3 | 3 | #include "rive/drawable.hpp" |
4 | 4 | #include "rive/factory.hpp" |
| 5 | +#include "rive/intrinsically_sizeable.hpp" |
5 | 6 | #include "rive/layout_component.hpp" |
6 | 7 | #include "rive/node.hpp" |
7 | 8 | #include "rive/math/aabb.hpp" |
@@ -211,12 +212,10 @@ Vec2D LayoutComponent::measureLayout(float width, |
211 | 212 | { |
212 | 213 | continue; |
213 | 214 | } |
214 | | - // && child->is<TransformComponent>()->canMeasure() for nested artboard layout |
215 | | - if (child->is<TransformComponent>()) |
| 215 | + auto sizeableChild = IntrinsicallySizeable::from(child); |
| 216 | + if (sizeableChild != nullptr) |
216 | 217 | { |
217 | | - auto transformComponent = child->as<TransformComponent>(); |
218 | | - Vec2D measured = |
219 | | - transformComponent->measureLayout(width, widthMode, height, heightMode); |
| 218 | + Vec2D measured = sizeableChild->measureLayout(width, widthMode, height, heightMode); |
220 | 219 | size = Vec2D(std::max(size.x, measured.x), std::max(size.y, measured.y)); |
221 | 220 | } |
222 | 221 | } |
@@ -548,10 +547,10 @@ void LayoutComponent::propagateSizeToChildren(ContainerComponent* component) |
548 | 547 | { |
549 | 548 | continue; |
550 | 549 | } |
551 | | - if (child->is<TransformComponent>()) |
| 550 | + auto sizeableChild = IntrinsicallySizeable::from(child); |
| 551 | + if (sizeableChild != nullptr) |
552 | 552 | { |
553 | | - auto sizableChild = child->as<TransformComponent>(); |
554 | | - sizableChild->controlSize(Vec2D(m_layoutSizeWidth, m_layoutSizeHeight)); |
| 553 | + sizeableChild->controlSize(Vec2D(m_layoutSizeWidth, m_layoutSizeHeight)); |
555 | 554 | } |
556 | 555 | if (child->is<ContainerComponent>()) |
557 | 556 | { |
|
0 commit comments