// EXTERNAL INCLUDES
#include <dali/public-api/animation/animation.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/devel-api/object/type-registry-helper.h>
+#include <dali/devel-api/rendering/cull-face.h>
+
+//INTERNAL INCLUDES
+#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
namespace Dali
{
namespace
{
using namespace Dali;
-TypeRegistration mType( typeid(Toolkit::PageTurnPortraitView), typeid(Toolkit::PageTurnView), NULL );
+
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::PageTurnPortraitView, Toolkit::PageTurnView, NULL )
+DALI_TYPE_REGISTRATION_END()
// the panning speed threshold, no matter how far is the pan displacement, pan fast to left/right quickly (speed > 0.3) will turn over/back the page
const float GESTURE_SPEED_THRESHOLD(0.3f);
// the animation duration of turning the previous page back when an outwards flick is detected
const float PAGE_TURN_OVER_ANIMATION_DURATION(0.5f);
+
}
PageTurnPortraitView::PageTurnPortraitView( PageFactory& pageFactory, const Vector2& pageSize )
// Add the page to tuning page layer and set up PageTurnEffect
mShadowView.Add( actor );
actor.SetShaderEffect( mTurnEffect[mIndex] );
- GetImpl( mTurnEffect[mIndex] ).ApplyInternalConstraint();
+ PageTurnApplyInternalConstraint(mTurnEffect[mIndex]);
mIsAnimating[mIndex] = true;
- mTurnEffect[mIndex].SetIsTurningBack( true );
+ mTurnEffect[mIndex].SetUniform("uIsTurningBack", 1.f );
Vector2 originalCenter( mPageSize.width*1.5f, 0.5f*mPageSize.height );
- mTurnEffect[mIndex].SetOriginalCenter( originalCenter );
- mTurnEffect[mIndex].SetCurrentCenter( Vector2( mPageSize.width*0.5f, mPageSize.height*0.5f ));
+ mTurnEffect[mIndex].SetUniform("uOriginalCenter", originalCenter );
+ mTurnEffect[mIndex].SetUniform("uCurrentCenter", Vector2( mPageSize.width*0.5f, mPageSize.height*0.5f ) );
// Start an animation to turn the previous page back
Animation animation = Animation::New( PAGE_TURN_OVER_ANIMATION_DURATION );
mAnimationActorPair[animation] = actor;
mAnimationIndexPair[animation] = mIndex;
- animation.AnimateTo( Property( mTurnEffect[mIndex], mTurnEffect[mIndex].PageTurnEffect::GetCurrentCenterPropertyName() ),
+ animation.AnimateTo( Property( mTurnEffect[mIndex], "uCurrentCenter" ),
originalCenter,
- AlphaFunctions::EaseOut, PAGE_TURN_OVER_ANIMATION_DURATION*0.75f );
- animation.AnimateBy( Property( actor, Actor::Property::ROTATION ), AngleAxis( Degree( 180.0f ), Vector3::YAXIS ) ,AlphaFunctions::EaseOut );
+ AlphaFunction::EASE_OUT, TimePeriod(PAGE_TURN_OVER_ANIMATION_DURATION*0.75f) );
+ animation.AnimateBy( Property( actor, Actor::Property::ORIENTATION ), AngleAxis( Degree( 180.0f ), Vector3::YAXIS ) ,AlphaFunction::EASE_OUT );
animation.Play();
- ImageActor::DownCast(actor).SetCullFace( CullBack );
+
+ ImageActor imageActor = ImageActor::DownCast(actor);
+ if( imageActor )
+ {
+ SetCullFace( imageActor, CullBack );
+ }
animation.FinishedSignal().Connect( this, &PageTurnPortraitView::OnTurnedOver );
}
}
void PageTurnPortraitView::OnTurnedOver( Animation& animation )
{
- ImageActor::DownCast(mAnimationActorPair[animation]).SetCullFace( CullNone );
+ ImageActor imageActor = ImageActor::DownCast( mAnimationActorPair[ animation ] );
+ if( imageActor )
+ {
+ SetCullFace( imageActor, CullNone );
+ }
TurnedOver( animation );
}