- RelativeToWidthOrHeight relativeWidthFunctor( relativeSize.x, sizePadding.x, fixedSize.x );
- RelativeToWidthOrHeight relativeHeightFunctor( relativeSize.y, sizePadding.y, fixedSize.y );
-
- widthConstraint = Constraint::New<float>( Actor::SIZE_WIDTH,
- ParentSource( Actor::SIZE_WIDTH ),
- relativeWidthFunctor );
-
- heightConstraint = Constraint::New<float>( Actor::SIZE_HEIGHT,
- ParentSource( Actor::SIZE_HEIGHT ),
- relativeHeightFunctor );
-
- widthConstraint.SetApplyTime( mConstraintDuration );
- heightConstraint.SetApplyTime( mConstraintDuration );
-
- // bake constrained size value if constraint is removed
- widthConstraint.SetRemoveAction( Constraint::Bake );
- heightConstraint.SetRemoveAction( Constraint::Bake );
-
- actor.ApplyConstraint( widthConstraint );
- actor.ApplyConstraint( heightConstraint );
+ Vector2 actorSize( RelativeToSize( relativeSize, sizePadding, fixedSize, size ) );
+ actor.SetSize(actorSize.x, actorSize.y);