X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fpage-turn-view%2Fpage-turn-portrait-view-impl.cpp;h=cd01b9ae530f1584afed575b7e08acc71ccb7bc6;hp=fda15a756e01d29bcc744efbfd14d25c353d7f82;hb=d9c164e4530e354cd14dc4a1a658070ba55e99b8;hpb=e2eda444afbe82e9591fe198eef339227f90a616 diff --git a/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp b/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp index fda15a7..cd01b9a 100644 --- a/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp +++ b/dali-toolkit/internal/controls/page-turn-view/page-turn-portrait-view-impl.cpp @@ -1,22 +1,31 @@ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -//CLASS HEADER +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER #include +// EXTERNAL INCLUDES +#include +#include +#include + +//INTERNAL INCLUDES +#include + namespace Dali { @@ -29,13 +38,16 @@ namespace Internal 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 ) @@ -92,7 +104,7 @@ void PageTurnPortraitView::SetPanActor( const Vector2& panPosition ) } } -void PageTurnPortraitView::SetSpineEffect(Actor actor, bool isLeftSide) +void PageTurnPortraitView::SetSpineEffect(ImageActor actor, bool isLeftSide) { if(isLeftSide) { @@ -110,7 +122,7 @@ void PageTurnPortraitView::OnPossibleOutwardsFlick( const Vector2& panPosition, // There is previous page and an outwards flick is detected if( mCurrentPageIndex > 0 && gestureSpeed > GESTURE_SPEED_THRESHOLD && offset.x > fabs( offset.y )) { - Actor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ]; + ImageActor actor = mPageActors[ (mCurrentPageIndex-1) % NUMBER_OF_CACHED_PAGES ]; if(actor.GetParent() != mRootOnScreen) { return; @@ -130,22 +142,22 @@ void PageTurnPortraitView::OnPossibleOutwardsFlick( const Vector2& panPosition, // 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", true ); 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::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 ); animation.FinishedSignal().Connect( this, &PageTurnPortraitView::OnTurnedOver );