Commit 6c11f68ce3c4e36246c0ac268fc6e59bfe7283a6

Authored by Kimmo Hoikka
Committed by Gerrit Code Review
2 parents 26e9c676 072daa0a

Merge "Size Relative feature: cluster-example uses feature for verification" into tizen

examples/cluster/cluster-example.cpp
... ... @@ -226,27 +226,6 @@ struct RescaleConstraint
226 226 };
227 227  
228 228 /**
229   - * ClusterImageBorderSizeConstraint
230   - */
231   -struct ClusterImageBorderSizeConstraint
232   -{
233   - ClusterImageBorderSizeConstraint()
234   - : mSizeOffset(Vector3(CLUSTER_IMAGE_BORDER_INDENT - 1, CLUSTER_IMAGE_BORDER_INDENT - 1, 0.0f) * 2.0f)
235   - {
236   - }
237   -
238   - Vector3 operator()(const Vector3& current,
239   - const PropertyInput& referenceSizeProperty)
240   - {
241   - const Vector3& referenceSize = referenceSizeProperty.GetVector3();
242   -
243   - return referenceSize + mSizeOffset;
244   - }
245   -
246   - Vector3 mSizeOffset; ///< The amount to offset the size from referenceSize
247   -};
248   -
249   -/**
250 229 * ShearEffectConstraint
251 230 *
252 231 * Constrains ShearEffect's tilt to be a function of scrollview's
... ... @@ -620,32 +599,29 @@ public:
620 599 shadowActor.SetAnchorPoint(AnchorPoint::CENTER);
621 600 shadowActor.SetPosition(Vector3(0.0f, 0.0f, -1.0f));
622 601  
623   - // Apply size constraint to the image shadow
624   - shadowActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), RelativeToConstraint( ShadowProperty::SIZE_SCALE ) ) );
625   - actor.Add(shadowActor);
  602 + // Apply size-relative mode to auto-size the image shadow
  603 + shadowActor.SetSizeMode( SIZE_RELATIVE_TO_PARENT );
  604 + shadowActor.SetSizeModeFactor( ShadowProperty::SIZE_SCALE );
  605 + actor.Add( shadowActor );
626 606  
627   - // Add a picture image actor to actor.
  607 + // Add a picture image actor to actor (with equal size to the parent).
628 608 Image image = Image::New( imagePath, attribs );
629   - ImageActor imageActor = ImageActor::New(image);
  609 + ImageActor imageActor = ImageActor::New( image );
630 610 imageActor.SetParentOrigin( ParentOrigin::CENTER );
631 611 imageActor.SetAnchorPoint( AnchorPoint::CENTER );
632   - imageActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
633   - actor.Add(imageActor);
  612 + imageActor.SetSizeMode( SIZE_EQUAL_TO_PARENT );
  613 + actor.Add( imageActor );
634 614  
635   - // Add a border image child actor
636   - ImageActor borderActor = ImageActor::New(mClusterBorderImage);
  615 + // Add a border image child actor (with a fixed size offset from parent).
  616 + ImageActor borderActor = ImageActor::New( mClusterBorderImage );
637 617 borderActor.SetParentOrigin( ParentOrigin::CENTER );
638 618 borderActor.SetAnchorPoint( AnchorPoint::CENTER );
639 619 borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
640 620 borderActor.SetNinePatchBorder( CLUSTER_IMAGE_BORDER_ABSOLUTE );
641   - borderActor.SetPosition(Vector3(0.0f, 0.0f, 1.0f));
642   -
643   - // Apply size constraint to the image border
644   - Constraint constraint = Constraint::New<Vector3>(Actor::SIZE,
645   - ParentSource(Actor::SIZE),
646   - ClusterImageBorderSizeConstraint());
647   - borderActor.ApplyConstraint(constraint);
648   - actor.Add(borderActor);
  621 + borderActor.SetPosition( Vector3( 0.0f, 0.0f, 1.0f ) );
  622 + borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT );
  623 + borderActor.SetSizeModeFactor( Vector3( CLUSTER_IMAGE_BORDER_INDENT - 1.0f, CLUSTER_IMAGE_BORDER_INDENT - 1.0f, 0.0f ) * 2.0f );
  624 + actor.Add( borderActor );
649 625  
650 626 return actor;
651 627 }
... ...