mScrollView.SetAnchorPoint( AnchorPoint::CENTER );
mScrollView.SetParentOrigin( ParentOrigin::CENTER );
- mScrollView.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ),
- Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) );
+ // Note: Currently, changing mScrollView to use SizeMode RELATIVE_TO_PARENT
+ // will cause scroll ends to appear in the wrong position.
+ mScrollView.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::RelativeToConstraint( SCROLLVIEW_RELATIVE_SIZE ) ) );
mScrollView.SetAxisAutoLock( true );
mScrollView.ScrollCompletedSignal().Connect( this, &DaliTableView::OnScrollComplete );
mScrollView.ScrollStartedSignal().Connect( this, &DaliTableView::OnScrollStart );
page.SetAnchorPoint( AnchorPoint::CENTER );
page.SetParentOrigin( ParentOrigin::CENTER );
- page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ page.SetSizeMode( SIZE_EQUAL_TO_PARENT );
// add cells to table
const float margin = 4.0f;
image.SetAnchorPoint( AnchorPoint::CENTER );
image.SetParentOrigin( ParentOrigin::CENTER );
// make the image 100% of tile
- image.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ image.SetSizeMode( SIZE_EQUAL_TO_PARENT );
// move image back to get text appear in front
image.SetZ( -1 );
image.SetStyle( ImageActor::STYLE_NINE_PATCH );
// Add stencil
ImageActor stencil = NewStencilImage();
- stencil.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ stencil.SetSizeMode( SIZE_EQUAL_TO_PARENT );
image.Add( stencil );
}
Constraint animConstraint = Constraint::New < Vector3 > ( Actor::POSITION,
Source( mScrollView, mScrollView.GetPropertyIndex( ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ),
Dali::ParentSource( Dali::Actor::SIZE ),
- AnimateBubbleConstraint( actorPos, Random::Range( -0.85f, 0.35f ), randSize ) );
+ AnimateBubbleConstraint( actorPos, Random::Range( -0.85f, 0.25f ), randSize ) );
dfActor.ApplyConstraint( animConstraint );
// Kickoff animation
mLevelContainer = Actor::New();
mLevelContainer.SetAnchorPoint( AnchorPoint::CENTER );
mLevelContainer.SetParentOrigin( ParentOrigin::CENTER );
- mLevelContainer.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ mLevelContainer.SetSizeMode( SIZE_EQUAL_TO_PARENT );
mContentLayer.Add( mLevelContainer );
mBrickCount = 0;
};
/**
- * RescaleConstraint
- * Rescales the inputer scale by the ratio of the height:width of it's parent.
- */
-struct RescaleConstraint
-{
- /**
- * Constructor
- * @param[in] value0 Constant multiplication operand (K).
- */
- RescaleConstraint()
- {
- }
-
- /**
- * @param[in] current The object's current property value
- * @param[in] property0 The first property to multiplication operand
- * @return The object's new property value
- */
- Vector3 operator()(const Vector3& current,
- const PropertyInput& property0)
- {
- return current * Vector3( property0.GetVector3().y / property0.GetVector3().x, 1.0f, 1.0f );
- }
-
-};
-
-/**
* ShearEffectConstraint
*
* Constrains ShearEffect's tilt to be a function of scrollview's
mScrollView.SetAnchorPoint(AnchorPoint::CENTER);
mScrollView.SetParentOrigin(ParentOrigin::CENTER);
- // Scale ScrollView to fit within parent (mContentLayer)
- Constraint constraint = Constraint::New<Vector3>( Actor::SCALE,
- LocalSource( Actor::SIZE ),
- ParentSource( Actor::SIZE ),
- ScaleToFitConstraint() );
- mScrollView.ApplyConstraint(constraint);
+ // Scale ScrollView to fit parent (mContentLayer)
+ mScrollView.SetSizeMode( SIZE_EQUAL_TO_PARENT );
// Add the scroll view to the content layer
mContentLayer.Add(mScrollView);
mScrollView.Add(pageView);
pageView.SetParentOrigin(ParentOrigin::CENTER);
pageView.SetPosition(Vector3(stageSize.width * column, 0.0f, 0.0f));
- pageView.SetSize(stageSize);
-
- // Resize pageView (which contains a Cluster)
- Constraint constraintScale = Constraint::New<Vector3>( Actor::SCALE,
- ParentSource( Actor::SCALE ),
- RescaleConstraint() );
- constraintScale.SetRemoveAction(Constraint::Discard);
- pageView.ApplyConstraint(constraintScale);
+ pageView.SetSizeMode( SIZE_EQUAL_TO_PARENT );
// Create cluster actors, add them to scroll view, and set the shear effect with the given center point.
Cluster cluster = CreateClusterActor(clusterType, style);
// coordinates in a frame defined by a parent actor:
Actor gridActor = Actor::New();
- gridActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ gridActor.SetSizeMode( SIZE_EQUAL_TO_PARENT );
gridActor.SetParentOrigin( ParentOrigin::CENTER );
gridActor.SetAnchorPoint( AnchorPoint::CENTER );
const Vector3 INITIAL_OFFSCREEN_POSITION( 1000.0f, 0, -1000.0f );
-struct BorderSizeConstraintFunction
-{
- Vector3 operator()(const Vector3& current,
- const PropertyInput& parentSize)
- {
- return parentSize.GetVector3() + ITEM_BORDER_MARGIN_SIZE;
- }
-};
-
static Vector3 DepthLayoutItemSizeFunctionPortrait(unsigned int numberOfColumns, float layoutWidth)
{
float width = (layoutWidth / static_cast<float>(numberOfColumns + 1)) * DEPTH_LAYOUT_ITEM_SIZE_FACTOR_PORTRAIT;
borderActor.SetStyle( ImageActor::STYLE_NINE_PATCH );
borderActor.SetNinePatchBorder( Vector4( ITEM_IMAGE_BORDER_LEFT, ITEM_IMAGE_BORDER_TOP, ITEM_IMAGE_BORDER_RIGHT, ITEM_IMAGE_BORDER_BOTTOM ) );
borderActor.SetColorMode( USE_OWN_MULTIPLY_PARENT_COLOR ); // darken with parent image-actor
-
- Constraint constraint = Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), BorderSizeConstraintFunction() );
- borderActor.ApplyConstraint(constraint);
+ borderActor.SetSizeMode( SIZE_FIXED_OFFSET_FROM_PARENT );
+ borderActor.SetSizeModeFactor( ITEM_BORDER_MARGIN_SIZE );
actor.Add(borderActor);
actor.SetKeyboardFocusable( true );
Actor CreatePage()
{
Actor page = Actor::New();
- page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ page.SetSizeMode( SIZE_EQUAL_TO_PARENT );
page.SetParentOrigin( ParentOrigin::CENTER );
page.SetAnchorPoint( AnchorPoint::CENTER );
void ApplyEffectToPage(Actor page)
{
page.RemoveConstraints();
- page.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ page.SetSizeMode( SIZE_EQUAL_TO_PARENT );
switch( mEffectMode )
{
mShadowView.SetName("Container");
mShadowView.SetParentOrigin(ParentOrigin::CENTER);
mShadowView.SetAnchorPoint(AnchorPoint::CENTER);
- mShadowView.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) );
+ mShadowView.SetSizeMode( SIZE_EQUAL_TO_PARENT );
mShadowView.SetPointLightFieldOfView( Math::PI / 2.0f);
mContents.Add(mShadowView);
toolBar.SetBackground( toolBarBackground );
toolBar.SetParentOrigin( Dali::ParentOrigin::TOP_CENTER );
toolBar.SetAnchorPoint( Dali::AnchorPoint::TOP_CENTER );
- toolBar.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::EqualToConstraint() ) );
toolBar.SetSize( 0.0f, style.mToolBarHeight );
+ toolBar.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT );
toolBarBackground.SetSortModifier(1.0f);
// Add the tool bar to the too bar layer.
Dali::Layer contentLayer = Dali::Layer::New();
contentLayer.SetAnchorPoint( Dali::AnchorPoint::CENTER );
contentLayer.SetParentOrigin( Dali::ParentOrigin::CENTER );
- contentLayer.ApplyConstraint( Dali::Constraint::New<Dali::Vector3>( Dali::Actor::SIZE, Dali::ParentSource( Dali::Actor::SIZE ), Dali::EqualToConstraint() ) );
+ contentLayer.SetSizeMode( Dali::SIZE_EQUAL_TO_PARENT );
view.AddContentLayer( contentLayer );
contentLayer.LowerBelow( toolBarLayer );