From: Kingsley Stephens Date: Mon, 26 Jan 2015 11:38:24 +0000 (-0800) Subject: Revert "Revert "Remove ScrollViewCustomEffect"" X-Git-Tag: accepted/tizen/common/20150129.162030~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=f1a6e2363aa3a84507e93d4636d2e649120e1418 Revert "Revert "Remove ScrollViewCustomEffect"" This reverts commit b5d9f1a0d6f33823cd19b5505ffe72d61a0735c6. This code will now be removed. Change-Id: I45554a9e3fb1c94a5ad4d80822f4a2118062baa6 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp index 02d0df1..8e9224c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollViewEffect.cpp @@ -231,25 +231,6 @@ Actor AddActorToPage(Actor page, float x, float y, float cols, float rows) } // unnamed namespace -int UtcDaliScrollViewCustomEffectSetup(void) -{ - tet_infoline(" UtcDaliScrollViewCustomEffectSetup"); - - ScrollViewCustomEffect effect; - - DALI_TEST_CHECK( !effect ); - - BaseHandle handle = ScrollViewCustomEffect::New(); - - DALI_TEST_CHECK( handle ); - - effect = ScrollViewCustomEffect::DownCast(handle); - - DALI_TEST_CHECK( effect ); - - END_TEST; -} - int UtcDaliScrollViewCubeEffectSetup(void) { tet_infoline(" UtcDaliScrollViewCubeEffectSetup"); @@ -421,173 +402,3 @@ int UtcDaliScrollViewSlideEffectTest(void) CleanupTest(); END_TEST; } - -int UtcDaliScrollViewCustomEffectTest(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliScrollViewCustomEffectTest"); - - Vector2 size = Stage::GetCurrent().GetSize(); - Vector3 pageSize(size.x, size.y, 0.0f); - - ScrollView scrollView = SetupTestScrollView(1, 3, size); - Actor testPage = gPages[1]; - Wait(application, 500); - Vector3 pageStartPos, pagePos; - pageStartPos = pagePos = testPage.GetCurrentPosition(); - //scrollView.RemoveConstraintsFromChildren(); - - ScrollViewCustomEffect effect = ScrollViewCustomEffect::DownCast(scrollView.ApplyEffect(ScrollView::PageEffectCarousel)); - - for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter) - { - Actor page = *pageIter; - page.RemoveConstraints(); - page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); - effect.ApplyToPage(page, pageSize); - } - Wait(application); - pagePos = testPage.GetCurrentPosition(); - DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION); - - scrollView.ScrollTo(1); - while(!gOnScrollCompleteCalled) - { - Wait(application); - } - ResetScrollCallbackResults(); - // test that the first page has reached centre of screen - pagePos = testPage.GetCurrentPosition(); - DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION); - - // scroll back to page 0 - scrollView.ScrollTo(0); - while(!gOnScrollCompleteCalled) - { - Wait(application); - } - ResetScrollCallbackResults(); - pagePos = testPage.GetCurrentPosition(); - DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION); - - scrollView.RemoveEffect(effect); - - effect = ScrollViewCustomEffect::New(); - effect.SetPageTranslation(Vector3(20.0f, 20.0f, 5.0f)); - effect.SetPageTranslation(Vector3(20.0f, 20.0f, 5.0f), Vector3(20.0f, 20.0f, -5.0f)); - effect.SetPageTranslationIn(Vector3(20.0f, 20.0f, 5.0f)); - effect.SetPageTranslationOut(Vector3(20.0f, 20.0f, -5.0f)); - effect.SetPageTranslation(Vector3(20.0f, 0.0f, 0.0f)); - effect.SetSwingAngle(Math::PI, Vector3::YAXIS); - effect.SetPageSpacing(Vector2(20.0f, 20.0f)); - scrollView.ApplyEffect(effect); - - for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter) - { - Actor page = *pageIter; - page.RemoveConstraints(); - page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); - effect.ApplyToPage(page, pageSize); - } - Wait(application); - pagePos = testPage.GetCurrentPosition(); - DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION); - - scrollView.ScrollTo(1); - while(!gOnScrollCompleteCalled) - { - Wait(application); - } - ResetScrollCallbackResults(); - // test that the first page has reached centre of screen - pagePos = testPage.GetCurrentPosition(); - DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION); - - // scroll back to page 0 - scrollView.ScrollTo(0); - while(!gOnScrollCompleteCalled) - { - Wait(application); - } - ResetScrollCallbackResults(); - pagePos = testPage.GetCurrentPosition(); - DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION); - - scrollView.RemoveEffect(effect); - effect = ScrollViewCustomEffect::New(); - effect.SetSwingAngle(Math::PI, Vector3::YAXIS); - effect.SetSwingAnchor(AnchorPoint::CENTER_LEFT); - effect.SetPageTranslation(Vector3(size.x, size.y, 0)); - effect.SetOpacityThreshold(0.66f); - scrollView.ApplyEffect(effect); - - for(ActorIter pageIter = gPages.begin(); pageIter != gPages.end(); ++pageIter) - { - Actor page = *pageIter; - page.RemoveConstraints(); - page.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); - effect.ApplyToPage(page, pageSize); - } - Wait(application); - - scrollView.ScrollTo(1); - while(!gOnScrollCompleteCalled) - { - Wait(application); - } - ResetScrollCallbackResults(); - // test that the first page has reached centre of screen - pagePos = testPage.GetCurrentPosition(); - DALI_TEST_EQUALS(pagePos, Vector3::ZERO, Math::MACHINE_EPSILON_0, TEST_LOCATION); - - // scroll back to page 0 - scrollView.ScrollTo(0); - while(!gOnScrollCompleteCalled) - { - Wait(application); - } - ResetScrollCallbackResults(); - pagePos = testPage.GetCurrentPosition(); - DALI_TEST_EQUALS(pagePos, pageStartPos, Math::MACHINE_EPSILON_0, TEST_LOCATION); - scrollView.RemoveEffect(effect); - - - effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear); - effect.SetPageTranslateAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear); - effect.SetPageTranslateAlphaFunctionIn(AlphaFunctions::Linear); - effect.SetPageTranslateAlphaFunctionOut(AlphaFunctions::Linear); - effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS); - effect.SetAngledOriginPageRotation(Vector3(Math::PI, Math::PI, 0.0f)); - effect.SetGlobalPageRotation(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS); - effect.SetGlobalPageRotationIn(Math::PI, Vector3::YAXIS); - effect.SetGlobalPageRotationOut(Math::PI, Vector3::YAXIS); - effect.SetGlobalPageRotationOrigin(Vector3::ZERO); - effect.SetGlobalPageRotationOrigin(Vector3::ZERO, Vector3::ZERO); - effect.SetGlobalPageRotationOriginIn(Vector3::ZERO); - effect.SetGlobalPageRotationOriginOut(Vector3::ZERO); - effect.SetSwingAngle(Math::PI, Vector3::YAXIS); - effect.SetSwingAngle(Math::PI, Vector3::YAXIS, Math::PI, Vector3::YAXIS); - effect.SetSwingAngleIn(Math::PI, Vector3::YAXIS); - effect.SetSwingAngleOut(Math::PI, Vector3::YAXIS); - effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear); - effect.SetSwingAngleAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear); - effect.SetSwingAngleAlphaFunctionIn(AlphaFunctions::Linear); - effect.SetSwingAngleAlphaFunctionOut(AlphaFunctions::Linear); - effect.SetSwingAnchor(AnchorPoint::CENTER, AnchorPoint::CENTER_LEFT); - effect.SetSwingAnchorIn(AnchorPoint::CENTER); - effect.SetSwingAnchorOut(AnchorPoint::CENTER); - effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear); - effect.SetSwingAnchorAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear); - effect.SetSwingAnchorAlphaFunctionIn(AlphaFunctions::Linear); - effect.SetSwingAnchorAlphaFunctionOut(AlphaFunctions::Linear); - effect.SetOpacityThreshold(0.5f); - effect.SetOpacityThreshold(0.5f, 0.5f); - effect.SetOpacityThresholdIn(0.5f); - effect.SetOpacityThresholdOut(0.5f); - effect.SetOpacityAlphaFunction(AlphaFunctions::Linear); - effect.SetOpacityAlphaFunction(AlphaFunctions::Linear, AlphaFunctions::Linear); - effect.SetOpacityAlphaFunctionIn(AlphaFunctions::Linear); - effect.SetOpacityAlphaFunctionOut(AlphaFunctions::Linear); - CleanupTest(); - END_TEST; -} diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-custom-effect-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-custom-effect-impl.cpp deleted file mode 100644 index 91966bf..0000000 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-custom-effect-impl.cpp +++ /dev/null @@ -1,1303 +0,0 @@ -/* - * 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 - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -namespace Toolkit -{ - -namespace Internal -{ - -namespace // unnamed namespace -{ - -using namespace ScrollViewHelperFunctions; - -/** - * ScrollViewCustomEffectInfo - * - * ScrollAmountConstraint calculates the attached actor's current scroll position, -1.0f to 1.0f is from one side of the screen to the other. - * It also calculates if the other constraints can be skipped - * - * Color constraint: adjusts the alpha of the page based on their parent page's position relative - * to the middle of the screen. - * When at middle of screen Alpha is 100% opacity. - * When outside the viewable area, the opacity is 0%. - * - * Position constraint: adjusts the position of the page based on their parent page's position - * relative to the middle of the screen. - * When at middle of the screen the position is not altered. - * When one screen away from middle the position is rotated as per expected in a 3D inner cube. - */ -class ScrollViewCustomEffectInfo : public Dali::RefObject -{ -public: - - ScrollViewCustomEffectInfo( uint flags, - Property::Index scrollAmountProperty, - Property::Index anchorProperty, - const Vector2& pageSpacing, - const Vector3& translateIn, const Vector3& translateOut, - const Quaternion& globalRotateIn, const Quaternion& globalRotateOut, - const Vector3& globalOriginIn, const Vector3& globalOriginOut, - const float swingAngleIn, const Vector3& swingAxisIn, const float swingAngleOut, const Vector3& swingAxisOut, - const Vector3& swingAnchorIn, const Vector3& swingAnchorOut, - const float opacityThresholdIn, const float opacityThresholdOut, - AlphaFunction globalRotateAlphaFunctionIn, AlphaFunction globalRotateAlphaFunctionOut, - AlphaFunction swingAlphaFunctionIn, AlphaFunction swingAlphaFunctionOut, - AlphaFunction swingAnchorAlphaFunctionIn, AlphaFunction swingAnchorAlphaFunctionOut, - AlphaFunction translateAlphaFunctionIn, AlphaFunction translateAlphaFunctionOut, - AlphaFunction opacityAlphaFunctionIn, AlphaFunction opacityAlphaFunctionOut ) : - mScrollAmountProperty(scrollAmountProperty), - mAnchorProperty(anchorProperty), - mFlags(flags), - mPageSpacing(pageSpacing), - mTranslateIn(translateIn), mTranslateOut(translateOut), - mGlobalRotateIn(globalRotateIn), mGlobalRotateOut(globalRotateOut), - mGlobalOriginIn(globalOriginIn), mGlobalOriginOut(globalOriginOut), - mSwingAngleIn(swingAngleIn), mSwingAxisIn(swingAxisIn), mSwingAngleOut(swingAngleOut), mSwingAxisOut(swingAxisOut), - mSwingAnchorIn(swingAnchorIn), mSwingAnchorOut(swingAnchorOut), - mOpacityThresholdIn(opacityThresholdIn), mOpacityThresholdOut(opacityThresholdOut), - mGlobalRotateAlphaFunctionIn(globalRotateAlphaFunctionIn), mGlobalRotateAlphaFunctionOut(globalRotateAlphaFunctionOut), - mSwingAlphaFunctionIn(swingAlphaFunctionIn), mSwingAlphaFunctionOut(swingAlphaFunctionOut), - mSwingAnchorAlphaFunctionIn(swingAnchorAlphaFunctionIn), mSwingAnchorAlphaFunctionOut(swingAnchorAlphaFunctionOut), - mTranslateAlphaFunctionIn(translateAlphaFunctionIn), mTranslateAlphaFunctionOut(translateAlphaFunctionOut), - mOpacityAlphaFunctionIn(opacityAlphaFunctionIn), mOpacityAlphaFunctionOut(opacityAlphaFunctionOut), - mWrap(false), - mPanning(false), - mScrolling(false), - mWasOutsideView(true), - mIsStraightOnView(false), - mWasStraightOnView(false), - mWrapped(false), - mWasWrapped(false), - mCanChangeDirection(false), - mSkipConstraints(false), - mPassedCentreThisFrame(false), - mForceDirectionUpdate(true), - mDirectionChanged(false), - mDirectionFlags(0), - mLastDirectionFlags(0), - mCurrentSwingAngle(0.f), - mCurrentOpacity(0.f), - mCurrentOpacityAlphaFunction(NULL) - { - } - - Vector3 ScrollAmountConstraint(const Vector3& current, - const PropertyInput& pagePositionProperty, - const PropertyInput& scrollPositionProperty, - const PropertyInput& scrollPositionMin, - const PropertyInput& scrollPositionMax, - const PropertyInput& pageSizeProperty, - const PropertyInput& scrollWrap) - { - // store last scroll pos - mLastScrollPosition = mScrollPos; - mPagePos = pagePositionProperty.GetVector3(); - mScrollPos = scrollPositionProperty.GetVector3(); - mScrollMin = scrollPositionMin.GetVector3(); - mScrollMax = scrollPositionMax.GetVector3(); - mPageSize = pageSizeProperty.GetVector3(); - mWrap = scrollWrap.GetBoolean(); - mWasWrapped = mWrapped; - - mLastDirectionFlags = mDirectionFlags; - - // Get position of page. - mPosition = mPagePos + mScrollPos; - - // short circuit: if we're looking straight on at the page (jonny 5 is alive) - mIsStraightOnView = IsStraightOnView( mPosition ); - - mLastScrollAmount = mScrollAmount; - Vector3 newScrollAmount(mPosition / mPageSize); - mScrollAmount = newScrollAmount; - mWrapped = false; - if( !mIsStraightOnView && mWrap ) - { - // only need to wrap if not already straight on view - WrapPositionWithinDomain( mPosition, mPageSize, mScrollMin, mScrollMax ); - mIsStraightOnView = IsStraightOnView( mPosition ); - newScrollAmount = mPosition / mPageSize; - if((mScrollAmount.x > 0.0f && newScrollAmount.x < 0.0f) - || (mScrollAmount.x < 0.0f && newScrollAmount.x > 0.0f) - || (mScrollAmount.y > 0.0f && newScrollAmount.y < 0.0f) - || (mScrollAmount.y < 0.0f && newScrollAmount.y > 0.0f)) - { - mWrapped = true; - } - } - mScrollAmount = newScrollAmount; - - return mScrollAmount; - } - - Quaternion PageDirectionAndRotationConstraint(const Quaternion& current, - const PropertyInput& scrollPositionProperty, - const PropertyInput& panningProperty, - const PropertyInput& scrollingProperty) - { - bool panning = panningProperty.GetBoolean(); - bool scrolling = scrollingProperty.GetBoolean(); - - bool isOutsideView = IsOutsideView( mPosition, mPageSize ); - - mSkipConstraints = isOutsideView | mIsStraightOnView; - - bool bIsCurrentPage = mScrollAmount.x > -0.5f && mScrollAmount.x < 0.5f; - - if(mSkipConstraints) - { - mPanning = panning; - mScrolling = scrolling; - mWasOutsideView = isOutsideView; - mWasStraightOnView = mIsStraightOnView; - return current; - } - Vector3 scrollDirection = mScrollAmount - mLastScrollAmount; - mPassedCentreThisFrame = bIsCurrentPage && (((mLastScrollAmount.x < 0.0f) && (mScrollAmount.x > 0.0f)) || ((mLastScrollAmount.x > 0.0f) && (mScrollAmount.x < 0.0f)) || ((mLastScrollAmount.y < 0.0f) && (mScrollAmount.y > 0.0f)) || ((mLastScrollAmount.y > 0.0f) && (mScrollAmount.y < 0.0f)) || (mWasStraightOnView && !mIsStraightOnView)); - - // may have wrapped this frame and never gone out of view - bool bWrappedOffScreen = (mWrapped != mWasWrapped && (fabs(scrollDirection.x) > 1.0f || fabs(scrollDirection.y) > 1.0f)); - - mCanChangeDirection = (scrolling && !mScrolling) || mPassedCentreThisFrame || (!isOutsideView && mWasOutsideView) || bWrappedOffScreen; - - if(mCanChangeDirection) - { - // figure out if we have changed direction - if((mWrapped != mWasWrapped) && (fabs(scrollDirection.x) > 1.0f || fabs(scrollDirection.y) || (!isOutsideView && mWasOutsideView))) - { - if( fabs(scrollDirection.x) > 1.0f ) - { - if(scrollDirection.x < 0.0f) - { - scrollDirection.x += (mScrollMax.x - mScrollMin.x) / mPageSize.x; - } - else - { - scrollDirection.x -= (mScrollMax.x - mScrollMin.x) / mPageSize.x; - } - } - if( fabs(scrollDirection.y) > 1.0f ) - { - if(scrollDirection.y < 0.0f) - { - scrollDirection.y += (mScrollMax.y - mScrollMin.y) / mPageSize.y; - } - else - { - scrollDirection.y -= (mScrollMax.y - mScrollMin.y) / mPageSize.y; - } - } - } - - // clear direction flags - mDirectionFlags &= ~Toolkit::ScrollView::DirectionFlagMask_Direction; - if(scrollDirection.x < 0.0f) - { - mDirectionFlags |= Toolkit::ScrollView::DirectionFlagLeft; - } - else if( scrollDirection.x > 0.0f ) - { - mDirectionFlags |= Toolkit::ScrollView::DirectionFlagRight; - } - - if(scrolling && !mScrolling) - { - // have started moving - if(((mDirectionFlags & Toolkit::ScrollView::DirectionFlagLeft) - && (mScrollAmount.x > 0.0f)) - || ((mDirectionFlags & Toolkit::ScrollView::DirectionFlagRight) - && (mScrollAmount.x < 0.0f))) - { - // started moving towards the screen, allow transition change - mDirectionFlags = (mDirectionFlags & ~Toolkit::ScrollView::DirectionFlagMask_Transition) | Toolkit::ScrollView::DirectionFlagTransitionOn; - } - else if(((mDirectionFlags & Toolkit::ScrollView::DirectionFlagLeft) - && (mScrollAmount.x < 0.0f)) - || ((mDirectionFlags & Toolkit::ScrollView::DirectionFlagRight) - && (mScrollAmount.x > 0.0f))) - { - // started moving away from screen, allow transition change - mDirectionFlags = (mDirectionFlags & ~Toolkit::ScrollView::DirectionFlagMask_Transition) | Toolkit::ScrollView::DirectionFlagTransitionOff; - } - } - else - { - // have changed direction - if((((mDirectionFlags & Toolkit::ScrollView::DirectionFlagLeft) - && mScrollAmount.x > 0.0f) - || ((mDirectionFlags & Toolkit::ScrollView::DirectionFlagRight) - && mScrollAmount.x < 0.0f)) - && (isOutsideView || (!isOutsideView && mWasOutsideView) || bWrappedOffScreen)) - { - // went from moving away to moving towards and can change direction - mDirectionFlags = (mDirectionFlags & ~Toolkit::ScrollView::DirectionFlagMask_Transition) | Toolkit::ScrollView::DirectionFlagTransitionOn; - } - else if((((mDirectionFlags & Toolkit::ScrollView::DirectionFlagLeft) - && (mScrollAmount.x < 0.0f)) - || ((mDirectionFlags & Toolkit::ScrollView::DirectionFlagRight) - && (mScrollAmount.x > 0.0f))) - && (isOutsideView || mPassedCentreThisFrame || bWrappedOffScreen)) - { - // went from moving towards to moving away and can change direction - mDirectionFlags = (mDirectionFlags & (~Toolkit::ScrollView::DirectionFlagMask_Transition)) | Toolkit::ScrollView::DirectionFlagTransitionOff; - } - } - // now set up current values depending on direction - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagTranslate) - { - // want to translate by specific amount - if((mFlags & Toolkit::ScrollViewCustomEffect::FlagTranslateIn) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOn)) - { - mCurrentTranslation = mTranslateIn; - } - else if((mFlags & Toolkit::ScrollViewCustomEffect::FlagTranslateOut) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOff)) - { - mCurrentTranslation = mTranslateOut; - } - else if(!(mFlags & (Toolkit::ScrollViewCustomEffect::FlagTranslateIn | Toolkit::ScrollViewCustomEffect::FlagTranslateOut))) - { - // using same value for both transitions - mCurrentTranslation = mTranslateIn; - } - else - { - // no value to use - mCurrentTranslation = Vector3::ZERO; - } - } - - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagRotate) - { - // want to rotate around an origin - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagRotateAngleForcedOrigin) - { - // the angle forces the origin position depending on page size - // also the page spacing is implemented by setting the 'fake' origin far enough back to add a small gap between pages - // use rotation origin since it isnt needed otherwise - mCurrentGlobalOrigin = mGlobalOriginIn; - } - else - { - mCurrentGlobalRotation = mGlobalRotateIn; - if((mFlags & Toolkit::ScrollViewCustomEffect::FlagRotateOut) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOff)) - { - mCurrentGlobalRotation = mGlobalRotateOut; - } - } - } - - // now set up current values depending on direction - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAngle) - { - // want to translate by specific amount - if((mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAngleIn) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOn)) - { - // moving towards centre of screen and have a value for that - mCurrentSwingAngle = mSwingAngleIn; - mCurrentSwingAxis = mSwingAxisIn; - } - else if((mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAngleOut) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOff)) - { - // moving away from centre of screen and have a value for that - mCurrentSwingAngle = mSwingAngleOut; - mCurrentSwingAxis = mSwingAxisOut; - } - else if(!(mFlags & (Toolkit::ScrollViewCustomEffect::FlagSwingAngleIn | Toolkit::ScrollViewCustomEffect::FlagSwingAngleOut))) - { - // using same value for both transitions - mCurrentSwingAngle = mSwingAngleIn; - mCurrentSwingAxis = mSwingAxisIn; - } - else - { - // no value to use - mCurrentSwingAngle = 0.0f; - mCurrentSwingAxis = Vector3(0.0f, -1.0f, 0.0f); - } - - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAnchor) - { - // want to translate by specific amount - if((mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAnchorIn) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOn)) - { - mCurrentSwingAnchor = mSwingAnchorIn; - } - else if((mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAnchorOut) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOff)) - { - mCurrentSwingAnchor = mSwingAnchorOut; - } - else if(!(mFlags & (Toolkit::ScrollViewCustomEffect::FlagSwingAnchorIn | Toolkit::ScrollViewCustomEffect::FlagSwingAnchorOut))) - { - // using same value for both transitions - mCurrentSwingAnchor = mSwingAnchorIn; - } - else - { - // no value to use - mCurrentSwingAnchor = Vector3(0,0,0); - } - if(mDirectionFlags & Toolkit::ScrollView::DirectionFlagLeft) - { - mCurrentSwingAnchor *= -1.0f; - } - } - } - - // now set up current values depending on direction - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagOpacityThreshold) - { - mCurrentOpacity = mOpacityThresholdIn; - if((mFlags & Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdOut) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOff)) - { - mCurrentOpacity = mOpacityThresholdOut; - } - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionMask) - { - // need to adjust using alpha functions - if( (mFlags & Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionIn) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOn) ) - { - mCurrentOpacityAlphaFunction = mOpacityAlphaFunctionIn; - } - else if( (mFlags & Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionOut) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOff) ) - { - mCurrentOpacityAlphaFunction = mOpacityAlphaFunctionOut; - } - else - { - mCurrentOpacityAlphaFunction = NULL; - } - } - } - } - - // if user panning OR any form of scroll direction (animated included) set panning to true - mPanning = panning; - mScrolling = scrolling; - mWasOutsideView = isOutsideView; - mWasStraightOnView = mIsStraightOnView; - - if(!(mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAngle)) - { - return current; - } - Vector3 amount(mScrollAmount); - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionMask) - { - // need to apply alpha function - if((mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionIn) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOn)) - { - amount.x = mSwingAlphaFunctionIn(fabs(mScrollAmount.x)); - amount.y = mSwingAlphaFunctionIn(fabs(mScrollAmount.y)); - if(mScrollAmount.x < 0) - { - amount.x *= -1.0f; - } - if(mScrollAmount.y < 0) - { - amount.y *= -1.0f; - } - } - else if((mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionOut) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOff)) - { - amount.x = mSwingAlphaFunctionOut(fabs(mScrollAmount.x)); - amount.y = mSwingAlphaFunctionOut(fabs(mScrollAmount.y)); - if(mScrollAmount.x < 0) - { - amount.x *= -1.0f; - } - if(mScrollAmount.y < 0) - { - amount.y *= -1.0f; - } - } - } - - // TODO - swing angle seems very slightly off... SORT IT!! - //Quaternion rotation = Quaternion::Slerp(current, mCurrentSwingAngle, mScrollAmount.x); - return Quaternion(mCurrentSwingAngle * amount.x, mCurrentSwingAxis) * current; // Quaternion::Lerp(current, mCurrentSwingAngle, mScrollAmount.x); - } - - /** - * @param[in] current The current color of this Actor - * @param[in] scrollAmountProperty The scroll-view's position property (SCROLL_POSITION_PROPERTY_NAME) - * @return The new color of this Actor. - */ - Vector4 ColorConstraint(const Vector4& current, - const PropertyInput& scrollAmountProperty) - { - if(mSkipConstraints) - { - if(!mIsStraightOnView) - { - // will be off screen, set alpha to 0 to stop drawing it - return Vector4(current.r, current.g, current.b, 0.0f); - } - return current; - } - - if( !(mFlags & Toolkit::ScrollViewCustomEffect::FlagOpacityThreshold) ) - { - return current; - } - - float amount = fabsf(mScrollAmount.x); - if((mFlags & Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionMask) - && mCurrentOpacityAlphaFunction) - { - amount = mCurrentOpacityAlphaFunction(amount); - } - Vector4 newColour(current.r, current.g, current.b, fmaxf(((1.0f - amount) / (1.0f - mCurrentOpacity)), 0.0f)); - return newColour; - } - - /** - * @brief PositionConstraint2 - * @param current - * @param scrollPositionProperty - * @param startPagePosition - * @param startDirection - * @return - */ - Vector3 PositionConstraint(const Vector3& current, - const PropertyInput& scrollAmountProperty, - const PropertyInput& anchorProperty, - const PropertyInput& rotationProperty) - { - if(mSkipConstraints) - { - return mPosition; - } - - Vector3 newPosition; - - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagRotateAngleForcedOrigin) - { - Quaternion qx(mScrollAmount.x * mCurrentGlobalOrigin.x, Vector3(0, 1, 0)); - Quaternion qy(mScrollAmount.y * mCurrentGlobalOrigin.y, Vector3(1, 0, 0)); - - float thetaBx = (Math::PI - mCurrentGlobalOrigin.x) * 0.5f; - float radiusx = ((mPageSize.width + mPageSpacing.width) * 0.5f) * tanf(thetaBx); - Vector3 originPositionVec = Vector3(0, 0, radiusx); - Vector3 horizontalPos = qx.Rotate(originPositionVec); - newPosition.x = horizontalPos.x; - newPosition.z = radiusx - horizontalPos.z; - // need to create an origin based on current horizontal/vertical scrolling page size - //Vector2 thetaA(mScrollAmount.x * mCurrentGlobalOrigin.x, mScrollAmount.y * mCurrentGlobalOrigin.y); - float thetaBy = (Math::PI - mCurrentGlobalOrigin.y) * 0.5f; - float radiusy = ((mPageSize.height + mPageSpacing.height) * 0.5f) * tanf(thetaBy); - originPositionVec = Vector3(0, 0, radiusy); - horizontalPos = qy.Rotate(originPositionVec); - newPosition.y = horizontalPos.y; - if(mDirectionFlags & (Toolkit::ScrollView::DirectionFlagUp | Toolkit::ScrollView::DirectionFlagDown)) - { - newPosition.z = radiusy - horizontalPos.z; - } - - //Vector3 vRadius(sinf(thetaA.x) * radius, sinf(thetaA.y) * radius, z); - //newPosition = Vector3(vRadius.x, vRadius.y, -vRadius.z + radius); - } - else if(mFlags & Toolkit::ScrollViewCustomEffect::FlagRotate) - { - // rotate around our origin which is relative to the scene - Vector3 vec = newPosition - mCurrentGlobalOrigin; - newPosition -= vec; - vec = mCurrentGlobalRotation.Rotate(vec); - newPosition += vec; - } - - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagTranslate) - { - //Vector3 spacing(mPageSpacing.x, 0, 0); - Vector3 amount(mScrollAmount); - amount.z = fabs(mScrollAmount.x); - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionMask) - { - // need to apply alpha function - if((mFlags & Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionIn) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOn)) - { - amount.x = mTranslateAlphaFunctionIn(fabs(mScrollAmount.x)); - amount.y = mTranslateAlphaFunctionIn(fabs(mScrollAmount.y)); - amount.z = mTranslateAlphaFunctionIn(fabs(mScrollAmount.x)); - if(mScrollAmount.x < 0) - { - amount.x *= -1.0f; - } - if(mScrollAmount.y < 0) - { - amount.y *= -1.0f; - } - } - else if((mFlags & Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionOut) - && (mDirectionFlags & Toolkit::ScrollView::DirectionFlagTransitionOff)) - { - amount.x = mTranslateAlphaFunctionOut(fabs(mScrollAmount.x)); - amount.y = mTranslateAlphaFunctionOut(fabs(mScrollAmount.y)); - amount.z = mTranslateAlphaFunctionIn(fabs(mScrollAmount.x)); - if(mScrollAmount.x < 0) - { - amount.x *= -1.0f; - } - if(mScrollAmount.y < 0) - { - amount.y *= -1.0f; - } - } - } - newPosition += mCurrentTranslation * amount; // (mCurrentTranslation + ((!(mFlags & Toolkit::ScrollViewCustomEffect::FlagRotateAngleForcedOrigin)) ? (spacing * 0.5f) : Vector3(0,0,0))) * mScrollAmount; - } - - if(mFlags & Toolkit::ScrollViewCustomEffect::FlagSwingAnchor) - { - // rotate around our anchor point which is local to our actor - Quaternion rotation(mCurrentSwingAngle * mScrollAmount.x, mCurrentSwingAxis); - Vector3 offset = mCurrentSwingAnchor * mPageSize; - newPosition += offset; - offset = rotation.Rotate(-offset); - newPosition += offset; - } - - return newPosition; - } - - // input parameters - - Property::Index mScrollAmountProperty; - Property::Index mAnchorProperty; - uint mFlags; ///< flags describing functionality, set automatically depending on functions called during effect setup - Vector2 mPageSpacing; ///< space between pages... kinda obvious really - Vector3 mTranslateIn; ///< translation offset to use when scrolling a page onto the screen - Vector3 mTranslateOut; ///< translation offset to use when scrolling a page off the screen - Quaternion mGlobalRotateIn; ///< rotates the page's position around a point - Quaternion mGlobalRotateOut; ///< rotates the page's position around a point - Vector3 mGlobalOriginIn; ///< the point to rotate a page around when scrolling onto screen - Vector3 mGlobalOriginOut; ///< the point to rotate a page around when scrolling off screen - float mSwingAngleIn; ///< angle to rotate a page around its anchor when scrolling onto screen - Vector3 mSwingAxisIn; ///< angle to rotate a page around its anchor when scrolling off screen - float mSwingAngleOut; ///< angle to rotate a page around its anchor when scrolling onto screen - Vector3 mSwingAxisOut; ///< angle to rotate a page around its anchor when scrolling off screen - Vector3 mSwingAnchorIn; ///< the page anchor point to use when scrolling onto screen - Vector3 mSwingAnchorOut; ///< the page anchor point to use when scrolling off screen - float mOpacityThresholdIn; ///< the point at which opacity will change as page scrolls onto screen - float mOpacityThresholdOut; ///< the point at which opacity will change as page scrolls off screen - AlphaFunction mGlobalRotateAlphaFunctionIn; - AlphaFunction mGlobalRotateAlphaFunctionOut; - AlphaFunction mSwingAlphaFunctionIn; - AlphaFunction mSwingAlphaFunctionOut; - AlphaFunction mSwingAnchorAlphaFunctionIn; - AlphaFunction mSwingAnchorAlphaFunctionOut; - AlphaFunction mTranslateAlphaFunctionIn; - AlphaFunction mTranslateAlphaFunctionOut; - AlphaFunction mOpacityAlphaFunctionIn; - AlphaFunction mOpacityAlphaFunctionOut; - - // constraint update params - // taken from property inputs every constraint update - Vector3 mPagePos; - Vector3 mScrollPos; - Vector3 mScrollMin; - Vector3 mScrollMax; - Vector3 mPageSize; - bool mWrap:1; - bool mPanning:1; - bool mScrolling:1; - bool mWasOutsideView:1; - bool mIsStraightOnView:1; - bool mWasStraightOnView:1; - bool mWrapped:1; ///< whether the scroll page was wrapped this frame - bool mWasWrapped:1; ///< whether the scroll page was wrapped last frame - bool mCanChangeDirection:1; - bool mSkipConstraints:1; ///< whether we can skip the main constraints - bool mPassedCentreThisFrame:1; ///< true if control has moved passed centre of screen - bool mForceDirectionUpdate:1; - bool mDirectionChanged:1; - - // calculated each constraint update depending on flags set - int mDirectionFlags; - int mLastDirectionFlags; - Vector2 mLastScrollPosition; - - Vector3 mPosition; - Vector3 mScrollAmount; - Vector3 mLastScrollAmount; - Vector3 mCurrentTranslation; - Quaternion mCurrentGlobalRotation; - Vector3 mCurrentGlobalOrigin; - float mCurrentSwingAngle; - Vector3 mCurrentSwingAxis; - Vector3 mCurrentSwingAnchor; - float mCurrentOpacity; - AlphaFunction mCurrentOpacityAlphaFunction; -}; - -typedef IntrusivePtr ScrollViewCustomEffectInfoPtr; - -} // unnamed namespace - -const std::string ScrollViewCustomEffect::SCROLL_AMOUNT_PROPERTY_STRING( "scroll-amount" ); -const std::string ScrollViewCustomEffect::ANCHOR_POINT_PROPERTY_STRING( "custom-anchor-point" ); - -ScrollViewCustomEffect::ScrollViewCustomEffect() : - mFlags(0), - mPageSpacing(0,0), - mTranslateIn(0,0,0), - mTranslateOut(0,0,0), - mGlobalRotateIn(0.0f, Vector3(0, 1.0f, 0.0f)), - mGlobalRotateOut(0.0f, Vector3(0, 1.0f, 0.0f)), - mGlobalOriginIn(0,0,0), - mGlobalOriginOut(0,0,0), - mSwingAngleIn(0.0f), - mSwingAxisIn(0.0f, 1.0f, 0.0f), - mSwingAngleOut(0.0f), - mSwingAxisOut(0.0f, 1.0f, 0.0f), - mSwingAnchorIn(0,0,0), - mSwingAnchorOut(0,0,0), - mOpacityThresholdIn(0), - mOpacityThresholdOut(0), - mGlobalRotateAlphaFunctionIn(NULL), - mGlobalRotateAlphaFunctionOut(NULL), - mSwingAlphaFunctionIn(NULL), - mSwingAlphaFunctionOut(NULL), - mSwingAnchorAlphaFunctionIn(NULL), - mSwingAnchorAlphaFunctionOut(NULL), - mTranslateAlphaFunctionIn(NULL), - mTranslateAlphaFunctionOut(NULL), - mOpacityAlphaFunctionIn(NULL), - mOpacityAlphaFunctionOut(NULL) -{ - -} - -ScrollViewCustomEffect::~ScrollViewCustomEffect() -{ -} - -void ScrollViewCustomEffect::SetPageSpacing(const Vector2& spacing) -{ - mPageSpacing = spacing; -} - -void ScrollViewCustomEffect::SetPageTranslation(const Vector3& translation) -{ - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagTranslateMask) | Toolkit::ScrollViewCustomEffect::FlagTranslate; - mTranslateIn = mTranslateOut = translation; -} - -void ScrollViewCustomEffect::SetPageTranslation(const Vector3& translationIn, const Vector3& translationOut) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagTranslateMask) - | Toolkit::ScrollViewCustomEffect::FlagTranslate - | Toolkit::ScrollViewCustomEffect::FlagTranslateIn - | Toolkit::ScrollViewCustomEffect::FlagTranslateOut; - - mTranslateIn = translationIn; - mTranslateOut = translationOut; -} - -void ScrollViewCustomEffect::SetPageTranslationIn(const Vector3& translation) -{ - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagTranslateMask | Toolkit::ScrollViewCustomEffect::FlagTranslateOut)) - | Toolkit::ScrollViewCustomEffect::FlagTranslate - | Toolkit::ScrollViewCustomEffect::FlagTranslateIn; - - mTranslateIn = translation; -} - -void ScrollViewCustomEffect::SetPageTranslationOut(const Vector3& translation) -{ - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagTranslateMask | Toolkit::ScrollViewCustomEffect::FlagTranslateIn)) - | Toolkit::ScrollViewCustomEffect::FlagTranslate - | Toolkit::ScrollViewCustomEffect::FlagTranslateOut; - - mTranslateOut = translation; -} - -void ScrollViewCustomEffect::SetPageTranslateAlphaFunction(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionMask; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionMask; - } - mTranslateAlphaFunctionIn = mTranslateAlphaFunctionOut = func; -} - -void ScrollViewCustomEffect::SetPageTranslateAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut) -{ - if(funcIn) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionIn; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionIn; - } - if(funcOut) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionOut; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionOut; - } - mTranslateAlphaFunctionIn = funcIn; - mTranslateAlphaFunctionOut = funcOut; -} - -void ScrollViewCustomEffect::SetPageTranslateAlphaFunctionIn(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionIn; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionIn; - } - mTranslateAlphaFunctionIn = func; -} - -void ScrollViewCustomEffect::SetPageTranslateAlphaFunctionOut(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionOut; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagTranslationAlphaFunctionOut; - } - mTranslateAlphaFunctionOut = func; -} - -void ScrollViewCustomEffect::SetGlobalPageRotation(float angle, const Vector3& axis) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagRotateMask) // reset rotate flags - | Toolkit::ScrollViewCustomEffect::FlagRotate; // set new rotate flag - - mGlobalRotateIn = mGlobalRotateOut = Quaternion(angle, axis); -} - -void ScrollViewCustomEffect::SetAngledOriginPageRotation(const Vector3& angle) -{ - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagRotateMask) - | Toolkit::ScrollViewCustomEffect::FlagRotate - | Toolkit::ScrollViewCustomEffect::FlagRotateAngleForcedOrigin; - - // set this angle into global originin for now, the flag will let us know what value to use in constraints - mGlobalOriginIn = angle; -} - -void ScrollViewCustomEffect::SetGlobalPageRotation(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagRotateMask) - | Toolkit::ScrollViewCustomEffect::FlagRotate - | Toolkit::ScrollViewCustomEffect::FlagRotateIn - | Toolkit::ScrollViewCustomEffect::FlagRotateOut; - - mGlobalRotateIn = Quaternion(angleIn, axisIn); - mGlobalRotateOut = Quaternion(angleOut, axisOut); -} - -void ScrollViewCustomEffect::SetGlobalPageRotationIn(float angle, const Vector3& axis) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagRotateMask | Toolkit::ScrollViewCustomEffect::FlagRotateOut)) // reset all rotation flags except RotateOut, since they may be calling these functions separately - | Toolkit::ScrollViewCustomEffect::FlagRotate - | Toolkit::ScrollViewCustomEffect::FlagRotateIn; - - mGlobalRotateIn = Quaternion(angle, axis); -} - -void ScrollViewCustomEffect::SetGlobalPageRotationOut(float angle, const Vector3& axis) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagRotateMask | Toolkit::ScrollViewCustomEffect::FlagRotateIn)) // reset all rotation flags except RotateOut, since they may be calling these functions separately - | Toolkit::ScrollViewCustomEffect::FlagRotate - | Toolkit::ScrollViewCustomEffect::FlagRotateOut; - - mGlobalRotateOut = Quaternion(angle, axis); -} - -void ScrollViewCustomEffect::SetGlobalPageRotationOrigin(const Vector3& origin) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagRotateOriginMask) // reset all rotation flags - | Toolkit::ScrollViewCustomEffect::FlagRotateOrigin; - - mGlobalOriginIn = mGlobalOriginOut = origin; -} - -void ScrollViewCustomEffect::SetGlobalPageRotationOrigin(const Vector3& originIn, const Vector3& originOut) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagRotateOriginMask) // reset all rotation flags - | Toolkit::ScrollViewCustomEffect::FlagRotateOrigin - | Toolkit::ScrollViewCustomEffect::FlagRotateOriginIn - | Toolkit::ScrollViewCustomEffect::FlagRotateOriginOut; - - mGlobalOriginIn = originIn; - mGlobalOriginOut = originOut; -} - -void ScrollViewCustomEffect::SetGlobalPageRotationOriginIn(const Vector3& origin) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagRotateOriginMask | Toolkit::ScrollViewCustomEffect::FlagRotateOriginOut)) // reset all rotation flags except RotateOut, since they may be calling these functions separately - | Toolkit::ScrollViewCustomEffect::FlagRotateOrigin - | Toolkit::ScrollViewCustomEffect::FlagRotateOriginIn; - - mGlobalOriginIn = origin; -} - -void ScrollViewCustomEffect::SetGlobalPageRotationOriginOut(const Vector3& origin) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagRotateOriginMask | Toolkit::ScrollViewCustomEffect::FlagRotateOriginIn)) // reset all rotation flags except RotateOut, since they may be calling these functions separately - | Toolkit::ScrollViewCustomEffect::FlagRotateOrigin - | Toolkit::ScrollViewCustomEffect::FlagRotateOriginOut; - - mGlobalOriginOut = origin; -} - -void ScrollViewCustomEffect::SetSwingAngle(const float angle, const Vector3& axis) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagSwingAngleMask) // reset rotate flags - | Toolkit::ScrollViewCustomEffect::FlagSwingAngle; // set new rotate flag - - mSwingAngleIn = mSwingAngleOut = angle; - mSwingAxisIn = mSwingAxisOut = axis; -} - -void ScrollViewCustomEffect::SetSwingAngle(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagSwingAngleMask) - | Toolkit::ScrollViewCustomEffect::FlagSwingAngle - | Toolkit::ScrollViewCustomEffect::FlagSwingAngleIn - | Toolkit::ScrollViewCustomEffect::FlagSwingAngleOut; - - mSwingAngleIn = angleIn; - mSwingAngleOut = angleOut; - mSwingAxisIn = axisIn; - mSwingAxisOut = axisOut; -} - -void ScrollViewCustomEffect::SetSwingAngleIn(float angle, const Vector3& axis) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagSwingAngleMask | Toolkit::ScrollViewCustomEffect::FlagSwingAngleOut)) // reset all rotation flags except RotateOut, since they may be calling these functions separately - | Toolkit::ScrollViewCustomEffect::FlagSwingAngle - | Toolkit::ScrollViewCustomEffect::FlagSwingAngleIn; - - mSwingAngleIn = angle; - mSwingAxisIn = axis; -} - -void ScrollViewCustomEffect::SetSwingAngleOut(float angle, const Vector3& axis) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagSwingAngleMask | Toolkit::ScrollViewCustomEffect::FlagSwingAngleIn)) // reset all rotation flags except RotateOut, since they may be calling these functions separately - | Toolkit::ScrollViewCustomEffect::FlagSwingAngle - | Toolkit::ScrollViewCustomEffect::FlagSwingAngleOut; - - mSwingAngleOut = angle; - mSwingAxisOut = axis; -} - -void ScrollViewCustomEffect::SetSwingAngleAlphaFunction(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionMask; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionMask; - } - mSwingAlphaFunctionIn = mSwingAlphaFunctionOut = func; -} - -void ScrollViewCustomEffect::SetSwingAngleAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut) -{ - if(funcIn) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionIn; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionIn; - } - if(funcOut) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionOut; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionOut; - } - mSwingAlphaFunctionIn = funcIn; - mSwingAlphaFunctionOut = funcOut; -} - -void ScrollViewCustomEffect::SetSwingAngleAlphaFunctionIn(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionIn; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionIn; - } - mSwingAlphaFunctionIn = func; -} - -void ScrollViewCustomEffect::SetSwingAngleAlphaFunctionOut(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionOut; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagSwingAngleAlphaFunctionOut; - } - mSwingAlphaFunctionOut = func; -} - -void ScrollViewCustomEffect::SetSwingAnchor(const Vector3& anchor) -{ - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagSwingAnchorMask) - | Toolkit::ScrollViewCustomEffect::FlagSwingAnchor; - mSwingAnchorIn = mSwingAnchorOut = anchor; -} - -void ScrollViewCustomEffect::SetSwingAnchor(const Vector3& anchorIn, const Vector3& anchorOut) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagSwingAnchorMask) - | Toolkit::ScrollViewCustomEffect::FlagSwingAnchor - | Toolkit::ScrollViewCustomEffect::FlagSwingAnchorIn - | Toolkit::ScrollViewCustomEffect::FlagSwingAnchorOut; - - mSwingAnchorIn = anchorIn; - mSwingAnchorOut = anchorOut; -} - -void ScrollViewCustomEffect::SetSwingAnchorIn(const Vector3& anchor) -{ - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagSwingAnchorMask | Toolkit::ScrollViewCustomEffect::FlagSwingAnchorOut)) - | Toolkit::ScrollViewCustomEffect::FlagSwingAnchor - | Toolkit::ScrollViewCustomEffect::FlagSwingAnchorIn; - - mSwingAnchorIn = anchor; -} - -void ScrollViewCustomEffect::SetSwingAnchorOut(const Vector3& anchor) -{ - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagSwingAnchorMask | Toolkit::ScrollViewCustomEffect::FlagSwingAnchorIn)) - | Toolkit::ScrollViewCustomEffect::FlagSwingAnchor - | Toolkit::ScrollViewCustomEffect::FlagSwingAnchorOut; - - mSwingAnchorOut = anchor; -} - -void ScrollViewCustomEffect::SetSwingAnchorAlphaFunction(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagSwingAnchorAlphaFunctionMask; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagSwingAnchorAlphaFunctionMask; - } - mSwingAnchorAlphaFunctionIn = mSwingAnchorAlphaFunctionOut = func; -} - -void ScrollViewCustomEffect::SetSwingAnchorAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut) -{ - if(funcIn) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagSwingAnchorAlphaFunctionIn; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagSwingAnchorAlphaFunctionIn; - } - if(funcOut) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagSwingAnchorAlphaFunctionOut; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagSwingAnchorAlphaFunctionOut; - } - mSwingAnchorAlphaFunctionIn = funcIn; - mSwingAnchorAlphaFunctionOut = funcOut; -} - -void ScrollViewCustomEffect::SetSwingAnchorAlphaFunctionIn(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagSwingAnchorAlphaFunctionIn; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagSwingAnchorAlphaFunctionIn; - } - mSwingAnchorAlphaFunctionIn = func; -} - -void ScrollViewCustomEffect::SetSwingAnchorAlphaFunctionOut(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagSwingAnchorAlphaFunctionOut; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagSwingAnchorAlphaFunctionOut; - } - mSwingAnchorAlphaFunctionOut = func; -} - -void ScrollViewCustomEffect::SetOpacityThreshold(float thresh) -{ - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdMask) - | Toolkit::ScrollViewCustomEffect::FlagOpacityThreshold - | Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdIn - | Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdOut; - - mOpacityThresholdIn = mOpacityThresholdOut = thresh; -} - -void ScrollViewCustomEffect::SetOpacityThreshold(float threshIn, float threshOut) -{ - // set flags describing translation with separate in out translation - mFlags = (mFlags & ~Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdMask) - | Toolkit::ScrollViewCustomEffect::FlagOpacityThreshold - | Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdIn - | Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdOut; - - mOpacityThresholdIn = threshIn; - mOpacityThresholdOut = threshOut; -} - -void ScrollViewCustomEffect::SetOpacityThresholdIn(float thresh) -{ - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdMask | Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdOut)) - | Toolkit::ScrollViewCustomEffect::FlagOpacityThreshold - | Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdIn; - - mOpacityThresholdIn = thresh; -} - -void ScrollViewCustomEffect::SetOpacityThresholdOut(float thresh) -{ - mFlags = (mFlags & (~Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdMask | Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdIn)) - | Toolkit::ScrollViewCustomEffect::FlagOpacityThreshold - | Toolkit::ScrollViewCustomEffect::FlagOpacityThresholdOut; - - mOpacityThresholdOut = thresh; -} - -void ScrollViewCustomEffect::SetOpacityAlphaFunction(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionMask; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionMask; - } - mOpacityAlphaFunctionIn = mOpacityAlphaFunctionOut = func; -} - -void ScrollViewCustomEffect::SetOpacityAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut) -{ - if(funcIn) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionIn; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionIn; - } - if(funcOut) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionOut; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionOut; - } - mOpacityAlphaFunctionIn = funcIn; - mOpacityAlphaFunctionOut = funcOut; -} - -void ScrollViewCustomEffect::SetOpacityAlphaFunctionIn(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionIn; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionIn; - } - mOpacityAlphaFunctionIn = func; -} - -void ScrollViewCustomEffect::SetOpacityAlphaFunctionOut(AlphaFunction func) -{ - if(func) - { - mFlags |= Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionOut; - } - else - { - mFlags &= ~Toolkit::ScrollViewCustomEffect::FlagOpacityAlphaFunctionOut; - } - mOpacityAlphaFunctionOut = func; -} - -void ScrollViewCustomEffect::ApplyToPage( Actor page, Vector3 pageSize) -{ - // may have already called register for these properties, so check before registering - Dali::Toolkit::ScrollView scrollView = GetScrollView(); - Property::Index scrollPropertyIndex = page.GetPropertyIndex(SCROLL_AMOUNT_PROPERTY_STRING); - if(scrollPropertyIndex == Property::INVALID_INDEX) - { - scrollPropertyIndex = page.RegisterProperty(SCROLL_AMOUNT_PROPERTY_STRING, Vector3::ZERO); - } - - Property::Index anchorPropertyIndex = page.GetPropertyIndex(ANCHOR_POINT_PROPERTY_STRING); - if(anchorPropertyIndex == Property::INVALID_INDEX) - { - anchorPropertyIndex = page.RegisterProperty(ANCHOR_POINT_PROPERTY_STRING, Vector3::ZERO); - } - - ScrollViewCustomEffectInfoPtr info(new ScrollViewCustomEffectInfo( - mFlags, - scrollPropertyIndex, - anchorPropertyIndex, - mPageSpacing, - mTranslateIn, mTranslateOut, - mGlobalRotateIn, mGlobalRotateOut, - mGlobalOriginIn, mGlobalOriginOut, - mSwingAngleIn, mSwingAxisIn, mSwingAngleOut, mSwingAxisOut, - mSwingAnchorIn - AnchorPoint::CENTER, mSwingAnchorOut - AnchorPoint::CENTER, - mOpacityThresholdIn, mOpacityThresholdOut, - mGlobalRotateAlphaFunctionIn, mGlobalRotateAlphaFunctionOut, - mSwingAlphaFunctionIn, mSwingAlphaFunctionOut, - mSwingAnchorAlphaFunctionIn, mSwingAnchorAlphaFunctionOut, - mTranslateAlphaFunctionIn, mTranslateAlphaFunctionOut, - mOpacityAlphaFunctionIn, mOpacityAlphaFunctionOut)); - - ScrollViewCustomEffectInfo effectInfo( *info ); - Property::Index scrollAmountProperty = effectInfo.mScrollAmountProperty; - Property::Index anchProperty = effectInfo.mAnchorProperty; - // Apply constraints to this actor // - Constraint constraint; - constraint = Constraint::New( scrollAmountProperty, - LocalSource(Actor::POSITION), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MIN_PROPERTY_NAME ) ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_MAX_PROPERTY_NAME ) ), - Source(scrollView, Actor::SIZE ), - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME ) ), - boost::bind( &ScrollViewCustomEffectInfo::ScrollAmountConstraint, info, _1, _2, _3, _4, _5, _6, _7) ); - - constraint.SetRemoveAction( Constraint::Discard ); - page.ApplyConstraint( constraint ); - - constraint = Constraint::New( Actor::ROTATION, - Source(scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_POSITION_PROPERTY_NAME ) ), - Source( scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_PANNING_PROPERTY_NAME ) ), - Source( scrollView, scrollView.GetPropertyIndex( Toolkit::ScrollView::SCROLL_SCROLLING_PROPERTY_NAME ) ), - boost::bind( &ScrollViewCustomEffectInfo::PageDirectionAndRotationConstraint, info, _1, _2, _3, _4) ); - - constraint.SetRemoveAction( Constraint::Discard ); - page.ApplyConstraint( constraint ); - - constraint = Constraint::New( Actor::COLOR, - Source(page, scrollAmountProperty ), - boost::bind( &ScrollViewCustomEffectInfo::ColorConstraint, info, _1, _2) ); - - constraint.SetRemoveAction( Constraint::Discard ); - page.ApplyConstraint( constraint ); - - constraint = Constraint::New( Actor::POSITION, - Source(page, scrollAmountProperty ), - Source(page, anchProperty ), - LocalSource(Actor::ROTATION), - boost::bind( &ScrollViewCustomEffectInfo::PositionConstraint, info, _1, _2, _3, _4) ); - - constraint.SetRemoveAction( Constraint::Discard ); - page.ApplyConstraint( constraint ); -} - -void ScrollViewCustomEffect::OnAttach(Toolkit::ScrollView& scrollView) -{ -} - -void ScrollViewCustomEffect::OnDetach(Toolkit::ScrollView& scrollView) -{ -} - -} // namespace Internal - -} // namespace Toolkit - -} // namespace Dali diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-custom-effect-impl.h b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-custom-effect-impl.h deleted file mode 100644 index 4943fb2..0000000 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-custom-effect-impl.h +++ /dev/null @@ -1,419 +0,0 @@ -#ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_CUSTOM_EFFECT_H__ -#define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_CUSTOM_EFFECT_H__ - -/* - * 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. - * - */ - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include -#include -#include - -namespace Dali -{ - -class Animation; - -namespace Toolkit -{ - -class ScrollGroup; -class ScrollView; - -namespace Internal -{ - -/** - * @copydoc Toolkit::ScrollViewCustomEffect - */ -class ScrollViewCustomEffect : public ScrollViewEffect -{ - static const std::string SCROLL_AMOUNT_PROPERTY_STRING; - static const std::string ANCHOR_POINT_PROPERTY_STRING; - -public: - - /** - * Constructor - */ - ScrollViewCustomEffect(); - -public: - - /** - * @brief SetPageSpacing - * @param spacing - */ - void SetPageSpacing(const Vector2& spacing); - - /** - * @brief SetPageTranslation sets a simple translate on/off value - * @param translation - */ - void SetPageTranslation(const Vector3& translation); - - /** - * @brief SetPageTranslation - * @param translationIn - * @param translationOut - */ - void SetPageTranslation(const Vector3& translationIn, const Vector3& translationOut); - - /** - * @brief SetPageTranslationIn - * @param translation - */ - void SetPageTranslationIn(const Vector3& translation); - - /** - * @brief SetPageTranslationOut - * @param translation - */ - void SetPageTranslationOut(const Vector3& translation); - - /** - * @brief SetPageTranslateAlphaFunction - * @param func - */ - void SetPageTranslateAlphaFunction(AlphaFunction func); - - /** - * @brief SetPageTranslateAlphaFunction - * @param funcIn - * @param funcOut - */ - void SetPageTranslateAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut); - - /** - * @brief SetPageTranslateAlphaFunctionIn - * @param func - */ - void SetPageTranslateAlphaFunctionIn(AlphaFunction func); - - /** - * @brief SetPageTranslateAlphaFunctionOut - * @param func - */ - void SetPageTranslateAlphaFunctionOut(AlphaFunction func); - - /** - * @brief SetGlobalPageRotation - * @param angle - * @param axis - */ - void SetGlobalPageRotation(float angle, const Vector3& axis); - - /** - * @brief SetAnglePageRotation uses the angle and page size passed in on creation to create a faked origin (inner cube needs this method) - * @param angle - */ - void SetAngledOriginPageRotation(const Vector3& angle); - - /** - * @brief SetGlobalPageRotation - * @param angleIn - * @param axisIn - * @param angleOut - * @param axisOut - */ - void SetGlobalPageRotation(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut); - - /** - * @brief SetGlobalPageRotationIn - * @param angle - * @param axis - */ - void SetGlobalPageRotationIn(float angle, const Vector3& axis); - - /** - * @brief SetGlobalPageRotationOut - * @param angle - * @param axis - */ - void SetGlobalPageRotationOut(float angle, const Vector3& axis); - - /** - * @brief SetPageRotationOrigin Set the origin to rotate all the pages around - * - The default value is (0,0,0) - * @param origin - */ - void SetGlobalPageRotationOrigin(const Vector3& origin); - - /** - * @brief SetGlobalPageRotationOrigin - * @param originIn - * @param originOut - */ - void SetGlobalPageRotationOrigin(const Vector3& originIn, const Vector3& originOut); - - /** - * @brief SetGlobalPageRotationOriginIn - * @param origin - */ - void SetGlobalPageRotationOriginIn(const Vector3& origin); - - /** - * @brief SetGlobalPageRotationOriginOut - * @param origin - */ - void SetGlobalPageRotationOriginOut(const Vector3& origin); - - /** - * @brief SetSwingAngle - * @param angle - * @param axis - */ - void SetSwingAngle(const float angle, const Vector3& axis); - - /** - * @brief SetSwingAngle - * @param angleIn - * @param axisIn - * @param angleOut - * @param axisOut - */ - void SetSwingAngle(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut); - - /** - * @brief SetSwingAngleIn - * @param angle - * @param axis - */ - void SetSwingAngleIn(float angle, const Vector3& axis); - - /** - * @brief SetSwingAngleOut - * @param angle - * @param axis - */ - void SetSwingAngleOut(float angle, const Vector3& axis); - - /** - * @brief SetSwingAngleAlphaFunction - * @param func - */ - void SetSwingAngleAlphaFunction(AlphaFunction func); - - /** - * @brief SetSwingAngleAlphaFunction - * @param funcIn - * @param funcOut - */ - void SetSwingAngleAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut); - - /** - * @brief SetSwingAngleAlphaFunctionIn - * @param func - */ - void SetSwingAngleAlphaFunctionIn(AlphaFunction func); - - /** - * @brief SetSwingAngleAlphaFunctionOut - * @param func - */ - void SetSwingAngleAlphaFunctionOut(AlphaFunction func); - - /** - * @brief SetSwingAnchor - * @param anchor - */ - void SetSwingAnchor(const Vector3& anchor); - - /** - * @brief SetSwingAnchor - * @param anchorIn - * @param anchorOut - */ - void SetSwingAnchor(const Vector3& anchorIn, const Vector3& anchorOut); - - /** - * @brief SetSwingAnchorIn - * @param anchor - */ - void SetSwingAnchorIn(const Vector3& anchor); - - /** - * @brief SetSwingAnchorOut - * @param anchor - */ - void SetSwingAnchorOut(const Vector3& anchor); - - /** - * @brief SetSwingAnchorAlphaFunction - * @param func - */ - void SetSwingAnchorAlphaFunction(AlphaFunction func); - - /** - * @brief SetSwingAnchorAlphaFunction - * @param funcIn - * @param funcOut - */ - void SetSwingAnchorAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut); - - /** - * @brief SetSwingAnchorAlphaFunctionIn - * @param func - */ - void SetSwingAnchorAlphaFunctionIn(AlphaFunction func); - - /** - * @brief SetSwingAnchorAlphaFunctionOut - * @param func - */ - void SetSwingAnchorAlphaFunctionOut(AlphaFunction func); - - /** - * @brief SetOpacityThreshold - * @param thresh - */ - void SetOpacityThreshold(float thresh); - - /** - * @brief SetOpacityThreshold - * @param threshIn - * @param threshOut - */ - void SetOpacityThreshold(float threshIn, float threshOut); - - /** - * @brief SetOpacityThresholdIn - * @param thresh - */ - void SetOpacityThresholdIn(float thresh); - - /** - * @brief SetOpacityThresholdOut - * @param thresh - */ - void SetOpacityThresholdOut(float thresh); - - /** - * @brief SetOpacityAlphaFunction - * @param func - */ - void SetOpacityAlphaFunction(AlphaFunction func); - - /** - * @brief SetOpacityAlphaFunction - * @param funcIn - * @param funcOut - */ - void SetOpacityAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut); - - /** - * @brief SetOpacityAlphaFunctionIn - * @param func - */ - void SetOpacityAlphaFunctionIn(AlphaFunction func); - - /** - * @brief SetOpacityAlphaFunctionOut - * @param func - */ - void SetOpacityAlphaFunctionOut(AlphaFunction func); - - - /** - * ApplyToPage This is the full internal ApplyToPage function and ALL other ApplyToPage - * functions should call this one. Making this internal allows us to change this function - * in the future without affecting demo apps - * @param page - * @param pageSize - */ - void ApplyToPage( Actor page, Vector3 pageSize); - - /** - * @copydoc ScrollViewEffect::OnAttach - */ - virtual void OnAttach( Toolkit::ScrollView& scrollView ); - - /** - * @copydoc ScrollViewEffect::OnDetach - */ - virtual void OnDetach( Toolkit::ScrollView& scrollView ); - -protected: - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~ScrollViewCustomEffect(); - -private: - - Vector3 mPageSize; ///< The logical page size for the 3D effect. - - uint mFlags; ///< flags describing functionality, set automatically depending on functions called during effect setup - Vector2 mPageSpacing; ///< space between pages... kinda obvious really - Vector3 mTranslateIn; ///< translation offset to use when scrolling a page onto the screen - Vector3 mTranslateOut; ///< translation offset to use when scrolling a page off the screen - Quaternion mGlobalRotateIn; ///< rotates the page's position around a point - Quaternion mGlobalRotateOut; ///< rotates the page's position around a point - Vector3 mGlobalOriginIn; ///< the point to rotate a page around when scrolling onto screen - Vector3 mGlobalOriginOut; ///< the point to rotate a page around when scrolling off screen - float mSwingAngleIn; ///< angle to rotate a page around its anchor when scrolling onto screen - Vector3 mSwingAxisIn; - float mSwingAngleOut; ///< angle to rotate a page around its anchor when scrolling off screen - Vector3 mSwingAxisOut; - Vector3 mSwingAnchorIn; ///< the page anchor point to use when scrolling onto screen - Vector3 mSwingAnchorOut; ///< the page anchor point to use when scrolling off screen - float mOpacityThresholdIn; ///< the point at which opacity will change as page scrolls onto screen - float mOpacityThresholdOut; ///< the point at which opacity will change as page scrolls off screen - AlphaFunction mGlobalRotateAlphaFunctionIn; - AlphaFunction mGlobalRotateAlphaFunctionOut; - AlphaFunction mSwingAlphaFunctionIn; - AlphaFunction mSwingAlphaFunctionOut; - AlphaFunction mSwingAnchorAlphaFunctionIn; - AlphaFunction mSwingAnchorAlphaFunctionOut; - AlphaFunction mTranslateAlphaFunctionIn; - AlphaFunction mTranslateAlphaFunctionOut; - AlphaFunction mOpacityAlphaFunctionIn; - AlphaFunction mOpacityAlphaFunctionOut; -}; - -} // namespace Internal - -// Helpers for public-api forwarding methods - -inline Internal::ScrollViewCustomEffect& GetImpl(Dali::Toolkit::ScrollViewCustomEffect& obj) -{ - DALI_ASSERT_ALWAYS(obj); - - Dali::RefObject& handle = obj.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::ScrollViewCustomEffect& GetImpl(const Dali::Toolkit::ScrollViewCustomEffect& obj) -{ - DALI_ASSERT_ALWAYS(obj); - - const Dali::RefObject& handle = obj.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_CUSTOM_EFFECT_H__ diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 0d60503..7522766 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -727,84 +727,6 @@ void ScrollView::ApplyEffect(Toolkit::ScrollViewEffect effect) GetImpl(effect).Attach(self); } -Toolkit::ScrollViewEffect ScrollView::ApplyEffect(Toolkit::ScrollView::PageEffect effect) -{ - Toolkit::ScrollViewEffect scrollEffect; - switch(effect) - { - case Toolkit::ScrollView::PageEffectNone: - { - break; - } - case Toolkit::ScrollView::PageEffectOuterCube: - { - Toolkit::ScrollViewCustomEffect customEffect; - scrollEffect = customEffect = Toolkit::ScrollViewCustomEffect::New(); - Vector2 pageSize = Stage::GetCurrent().GetSize(); - // set the page translation to the slide off distance, also add an extra value to space the pages, having a smaller spacing on translationOut will allow the spacing to reduce over time - // the page moving onto screen will start 50.0f further out (1.0f * 50.0f) and the spacing will reduce as its position reaches the centre (0.0f * 50.0f) - // the page moving off screen will slowly build a spacing from 0.0f to 20.0f - // the spacing from each page is added together for the final spacing between the two pages. - customEffect.SetPageTranslation(Vector3(pageSize.x, pageSize.y, 0) + Vector3(50.0f, 50.0f, 0.0f), Vector3(pageSize.x, pageSize.y, 0) + Vector3(20.0f, 20.0f, 0.0f)); - customEffect.SetSwingAngleOut(ANGLE_CUSTOM_CUBE_SWING.x, Vector3(0.0f, -1.0f, 0.0f)); - customEffect.SetSwingAnchor(AnchorPoint::CENTER, AnchorPoint::CENTER_LEFT); - customEffect.SetOpacityThreshold(0.7f); - break; - } - case Toolkit::ScrollView::PageEffectDepth: - { - Toolkit::ScrollViewCustomEffect customEffect; - scrollEffect = customEffect = Toolkit::ScrollViewCustomEffect::New(); - break; - } - case Toolkit::ScrollView::PageEffectInnerCube: - { - Toolkit::ScrollViewCustomEffect customEffect; - scrollEffect = customEffect = Toolkit::ScrollViewCustomEffect::New(); - customEffect.SetPageSpacing(Vector2(30.0f, 30.0f)); - customEffect.SetAngledOriginPageRotation(ANGLE_CUBE_PAGE_ROTATE); - customEffect.SetSwingAngle(ANGLE_CUBE_PAGE_ROTATE.x, Vector3(0,-1,0)); - customEffect.SetOpacityThreshold(0.5f); - break; - } - case Toolkit::ScrollView::PageEffectCarousel: - { - Toolkit::ScrollViewCustomEffect customEffect; - scrollEffect = customEffect = Toolkit::ScrollViewCustomEffect::New(); - customEffect.SetPageTranslation(Vector3(0,0,0), Vector3(-30, 0, 0)); - customEffect.SetPageSpacing(Vector2(60.0f, 60.0f)); - customEffect.SetAngledOriginPageRotation(-ANGLE_CUBE_PAGE_ROTATE); - customEffect.SetOpacityThreshold(0.2f, 0.6f); - break; - } - case Toolkit::ScrollView::PageEffectSpiral: - { - Toolkit::ScrollViewCustomEffect customEffect; - scrollEffect = customEffect = Toolkit::ScrollViewCustomEffect::New(); - - Vector2 pageSize = Stage::GetCurrent().GetSize(); - customEffect.SetSwingAngle(-ANGLE_SPIRAL_SWING_IN.x, Vector3(0.0f, -1.0f, 0.0f), ANGLE_SPIRAL_SWING_OUT.x, Vector3(0.0f, -1.0f, 0.0f)); - //customEffect.SetSwingAngleAlphaFunctionOut(AlphaFunctions::EaseOut); - customEffect.SetSwingAnchor(AnchorPoint::CENTER_RIGHT); - customEffect.SetPageTranslation(Vector3(pageSize.x, pageSize.y, 0) + Vector3(100.0f, 100.0f, 0.0f), Vector3(pageSize.x, pageSize.y, -pageSize.y * 2.0f) * 0.33f); - //customEffect.SetPageTranslateAlphaFunctionOut(AlphaFunctions::EaseOut); - customEffect.SetOpacityThreshold(0.75f, 0.6f); - customEffect.SetOpacityAlphaFunctionIn(AlphaFunctions::EaseInOut); - break; - } - default: - { - DALI_ASSERT_DEBUG(0 && "unknown scroll view effect"); - } - } - RemoveConstraintsFromChildren(); - if(scrollEffect) - { - ApplyEffect(scrollEffect); - } - return scrollEffect; -} - void ScrollView::RemoveEffect(Toolkit::ScrollViewEffect effect) { Dali::Toolkit::ScrollView self = Dali::Toolkit::ScrollView::DownCast(Self()); diff --git a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h index d0ab90a..8706c1c 100644 --- a/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h +++ b/base/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h @@ -29,9 +29,6 @@ #include #include -// predefined effect includes -#include - namespace Dali { @@ -149,12 +146,6 @@ public: void ApplyEffect(Toolkit::ScrollViewEffect effect); /** - * @brief ApplyEffect Applies a predefined effect - * @param effect - */ - Toolkit::ScrollViewEffect ApplyEffect(Toolkit::ScrollView::PageEffect effect); - - /** * @copydoc Toolkit::ScrollView::RemoveEffect */ void RemoveEffect(Toolkit::ScrollViewEffect effect); diff --git a/base/dali-toolkit/internal/file.list b/base/dali-toolkit/internal/file.list index 5083694..e58b4de 100644 --- a/base/dali-toolkit/internal/file.list +++ b/base/dali-toolkit/internal/file.list @@ -24,7 +24,6 @@ toolkit_base_src_files = \ $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-overshoot-indicator-impl.cpp \ $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-impl.cpp \ $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-effect-impl.cpp \ - $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-custom-effect-impl.cpp \ $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-carousel-effect-impl.cpp \ $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-cube-effect-impl.cpp \ $(toolkit_base_src_dir)/controls/scrollable/scroll-view/scroll-view-depth-effect-impl.cpp \ diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.cpp b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.cpp deleted file mode 100644 index 53fc0c7..0000000 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* - * 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 - -// INTERNAL HEADERS -#include - -using namespace Dali; - -namespace Dali -{ - -namespace Toolkit -{ - -ScrollViewCustomEffect ScrollViewCustomEffect::New() -{ - return ScrollViewCustomEffect(new Internal::ScrollViewCustomEffect()); -} - -ScrollViewCustomEffect::ScrollViewCustomEffect() -{ - -} - -ScrollViewCustomEffect::ScrollViewCustomEffect(Internal::ScrollViewCustomEffect *impl) -: ScrollViewEffect(impl) -{ -} - -ScrollViewCustomEffect ScrollViewCustomEffect::DownCast( BaseHandle handle ) -{ - return ScrollViewCustomEffect( dynamic_cast(handle.GetObjectPtr()) ); -} - -void ScrollViewCustomEffect::SetPageSpacing(const Vector2& spacing) -{ - GetImpl(*this).SetPageSpacing(spacing); -} - -void ScrollViewCustomEffect::SetPageTranslation(const Vector3& translation) -{ - GetImpl(*this).SetPageTranslation(translation); -} - -void ScrollViewCustomEffect::SetPageTranslation(const Vector3& translationIn, const Vector3& translationOut) -{ - GetImpl(*this).SetPageTranslation(translationIn, translationOut); -} - -void ScrollViewCustomEffect::SetPageTranslationIn(const Vector3& translation) -{ - GetImpl(*this).SetPageTranslationIn(translation); -} - -void ScrollViewCustomEffect::SetPageTranslationOut(const Vector3& translation) -{ - GetImpl(*this).SetPageTranslationOut(translation); -} - -void ScrollViewCustomEffect::SetPageTranslateAlphaFunction(AlphaFunction func) -{ - GetImpl(*this).SetPageTranslateAlphaFunction(func); -} - -void ScrollViewCustomEffect::SetPageTranslateAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut) -{ - GetImpl(*this).SetPageTranslateAlphaFunction(funcIn, funcOut); -} - -void ScrollViewCustomEffect::SetPageTranslateAlphaFunctionIn(AlphaFunction func) -{ - GetImpl(*this).SetPageTranslateAlphaFunctionIn(func); -} - -void ScrollViewCustomEffect::SetPageTranslateAlphaFunctionOut(AlphaFunction func) -{ - GetImpl(*this).SetPageTranslateAlphaFunctionOut(func); -} - -void ScrollViewCustomEffect::SetGlobalPageRotation(float angle, const Vector3& axis) -{ - GetImpl(*this).SetGlobalPageRotation(angle, axis); -} - -void ScrollViewCustomEffect::SetAngledOriginPageRotation(const Vector3& angle) -{ - GetImpl(*this).SetAngledOriginPageRotation(angle); -} - -void ScrollViewCustomEffect::SetGlobalPageRotation(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut) -{ - GetImpl(*this).SetGlobalPageRotation(angleIn, axisIn, angleOut, axisOut); -} - -void ScrollViewCustomEffect::SetGlobalPageRotationIn(float angle, const Vector3& axis) -{ - GetImpl(*this).SetGlobalPageRotationIn(angle, axis); -} - -void ScrollViewCustomEffect::SetGlobalPageRotationOut(float angle, const Vector3& axis) -{ - GetImpl(*this).SetGlobalPageRotationOut(angle, axis); -} - -void ScrollViewCustomEffect::SetGlobalPageRotationOrigin(const Vector3& origin) -{ - GetImpl(*this).SetGlobalPageRotationOrigin(origin); -} - -void ScrollViewCustomEffect::SetGlobalPageRotationOrigin(const Vector3& originIn, const Vector3& originOut) -{ - GetImpl(*this).SetGlobalPageRotationOrigin(originIn, originOut); -} - -void ScrollViewCustomEffect::SetGlobalPageRotationOriginIn(const Vector3& origin) -{ - GetImpl(*this).SetGlobalPageRotationOriginIn(origin); -} - -void ScrollViewCustomEffect::SetGlobalPageRotationOriginOut(const Vector3& origin) -{ - GetImpl(*this).SetGlobalPageRotationOriginOut(origin); -} - -void ScrollViewCustomEffect::SetSwingAngle(const float angle, const Vector3& axis) -{ - GetImpl(*this).SetSwingAngle(angle, axis); -} - -void ScrollViewCustomEffect::SetSwingAngle(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut) -{ - GetImpl(*this).SetSwingAngle(angleIn, axisIn, angleOut, axisOut); -} - -void ScrollViewCustomEffect::SetSwingAngleIn(float angle, const Vector3& axis) -{ - GetImpl(*this).SetSwingAngleIn(angle, axis); -} - -void ScrollViewCustomEffect::SetSwingAngleOut(float angle, const Vector3& axis) -{ - GetImpl(*this).SetSwingAngleOut(angle, axis); -} - -void ScrollViewCustomEffect::SetSwingAngleAlphaFunction(AlphaFunction func) -{ - GetImpl(*this).SetSwingAngleAlphaFunction(func); -} - -void ScrollViewCustomEffect::SetSwingAngleAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut) -{ - GetImpl(*this).SetSwingAngleAlphaFunction(funcIn, funcOut); -} - -void ScrollViewCustomEffect::SetSwingAngleAlphaFunctionIn(AlphaFunction func) -{ - GetImpl(*this).SetSwingAngleAlphaFunctionIn(func); -} - -void ScrollViewCustomEffect::SetSwingAngleAlphaFunctionOut(AlphaFunction func) -{ - GetImpl(*this).SetSwingAngleAlphaFunctionOut(func); -} - -void ScrollViewCustomEffect::SetSwingAnchor(const Vector3& anchor) -{ - GetImpl(*this).SetSwingAnchor(anchor); -} - -void ScrollViewCustomEffect::SetSwingAnchor(const Vector3& anchorIn, const Vector3& anchorOut) -{ - GetImpl(*this).SetSwingAnchor(anchorIn, anchorOut); -} - -void ScrollViewCustomEffect::SetSwingAnchorIn(const Vector3& anchor) -{ - GetImpl(*this).SetSwingAnchorIn(anchor); -} - -void ScrollViewCustomEffect::SetSwingAnchorOut(const Vector3& anchor) -{ - GetImpl(*this).SetSwingAnchorOut(anchor); -} - -void ScrollViewCustomEffect::SetSwingAnchorAlphaFunction(AlphaFunction func) -{ - GetImpl(*this).SetSwingAnchorAlphaFunction(func); -} - -void ScrollViewCustomEffect::SetSwingAnchorAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut) -{ - GetImpl(*this).SetSwingAnchorAlphaFunction(funcIn, funcOut); -} - -void ScrollViewCustomEffect::SetSwingAnchorAlphaFunctionIn(AlphaFunction func) -{ - GetImpl(*this).SetSwingAnchorAlphaFunctionIn(func); -} - -void ScrollViewCustomEffect::SetSwingAnchorAlphaFunctionOut(AlphaFunction func) -{ - GetImpl(*this).SetSwingAnchorAlphaFunctionOut(func); -} - -void ScrollViewCustomEffect::SetOpacityThreshold(float thresh) -{ - GetImpl(*this).SetOpacityThreshold(thresh); -} - -void ScrollViewCustomEffect::SetOpacityThreshold(float threshIn, float threshOut) -{ - GetImpl(*this).SetOpacityThreshold(threshIn, threshOut); -} - -void ScrollViewCustomEffect::SetOpacityThresholdIn(float thresh) -{ - GetImpl(*this).SetOpacityThresholdIn(thresh); -} - -void ScrollViewCustomEffect::SetOpacityThresholdOut(float thresh) -{ - GetImpl(*this).SetOpacityThresholdOut(thresh); -} - -void ScrollViewCustomEffect::SetOpacityAlphaFunction(AlphaFunction func) -{ - GetImpl(*this).SetOpacityAlphaFunction(func); -} - -void ScrollViewCustomEffect::SetOpacityAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut) -{ - GetImpl(*this).SetOpacityAlphaFunction(funcIn, funcOut); -} - -void ScrollViewCustomEffect::SetOpacityAlphaFunctionIn(AlphaFunction func) -{ - GetImpl(*this).SetOpacityAlphaFunctionIn(func); -} - -void ScrollViewCustomEffect::SetOpacityAlphaFunctionOut(AlphaFunction func) -{ - GetImpl(*this).SetOpacityAlphaFunctionOut(func); -} - -void ScrollViewCustomEffect::ApplyToPage(Actor page, Vector3 pageSize) -{ - GetImpl(*this).ApplyToPage(page, pageSize); -} - -} // namespace Toolkit - -} // namespace Dali diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h deleted file mode 100644 index c77fe24..0000000 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h +++ /dev/null @@ -1,475 +0,0 @@ -#ifndef __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_EFFECT_H__ -#define __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_EFFECT_H__ - -/* - * 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. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -class Actor; - -namespace Toolkit -{ - -namespace Internal DALI_INTERNAL -{ -class ScrollViewCustomEffect; -} - -/** - * @brief This class has many transition effects for use when scrolling pages, e.g opacity, rotation, swing, translation. - * - * It should be used on the following Actor hierarchy: - * - * ScrollView - * | - * Page (1..n) - * - * You should ensure ScrollView's default constraints have been removed, - * by calling ScrollView::RemoveConstraintsFromChildren() before applying - * this effect to ScrollView. - * - * Manual operation: - * ApplyToPage(...) method should be called on every page. - * - * Automatic operation: - * not implemented. - */ -class DALI_IMPORT_API ScrollViewCustomEffect : public ScrollViewEffect -{ -public: - /** - * @brief Bitflags for effect types. - */ - enum EFlag - { - FlagTranslate = 0x0001, ///< indicates that translation is wanted - FlagTranslateIn = 0x0002, ///< translating onto the screen is a separate value - FlagTranslateOut = 0x0004, ///< translating off the screen is a separate value - FlagTranslateMask = FlagTranslate | FlagTranslateIn | FlagTranslateOut, - FlagRotate = 0x0008, ///< indicates that a positional rotation is wanted (rotate all pages around a single point like inner cube effect) - FlagRotateIn = 0x0010, ///< rotating onto the screen is a separate value - FlagRotateOut = 0x0020, ///< rotating off the screen is a separate value - FlagRotateAngleForcedOrigin = 0x0040, - FlagRotateMask = FlagRotate | FlagRotateIn | FlagRotateOut | FlagRotateAngleForcedOrigin, - FlagRotateOrigin = 0x0080, ///< indicates to use a global origin to rotate all pages around - FlagRotateOriginIn = 0x0100, ///< - FlagRotateOriginOut = 0x0200, ///< - FlagRotateOriginMask = FlagRotateOrigin | FlagRotateOriginIn | FlagRotateOriginOut, - FlagSwingAngle = 0x0400, ///< indicates that a SwingAngle is wanted (rotate all pages around a single point like inner cube effect) - FlagSwingAngleIn = 0x0800, ///< SwingAngle onto the screen is a separate value - FlagSwingAngleOut = 0x1000, ///< SwingAngle off the screen is a separate value - FlagSwingAngleMask = FlagSwingAngle | FlagSwingAngleIn | FlagSwingAngleOut, - FlagSwingAnchor = 0x2000, ///< indicates that a swing requires a specified anchor point, otherwise swings around centre of actor (rotate all pages around a single point like inner cube effect) - FlagSwingAnchorIn = 0x4000, ///< Swing anchor onto the screen is a separate value - FlagSwingAnchorOut = 0x8000, ///< Swing anchor off the screen is a separate value - FlagSwingAnchorMask = FlagSwingAnchor | FlagSwingAnchorIn | FlagSwingAnchorOut, - FlagOpacityThreshold = 0x00010000, ///< - FlagOpacityThresholdIn = 0x00020000, ///< - FlagOpacityThresholdOut = 0x00040000, ///< - FlagOpacityThresholdMask = FlagOpacityThreshold | FlagOpacityThresholdIn | FlagOpacityThresholdOut, - FlagTranslationAlphaFunctionIn = 0x00080000, - FlagTranslationAlphaFunctionOut = 0x00100000, - FlagTranslationAlphaFunctionMask = FlagTranslationAlphaFunctionIn | FlagTranslationAlphaFunctionOut, - FlagRotateAlphaFunctionIn = 0x00200000, - FlagRotateAlphaFunctionOut = 0x00400000, - FlagRotateAlphaFunctionMask = FlagRotateAlphaFunctionIn | FlagRotateAlphaFunctionOut, - FlagRotateOriginAlphaFunctionIn = 0x00800000, - FlagRotateOriginAlphaFunctionOut = 0x01000000, - FlagRotateOriginAlphaFunctionMask = FlagRotateOriginAlphaFunctionIn | FlagRotateOriginAlphaFunctionOut, - FlagSwingAngleAlphaFunctionIn = 0x02000000, - FlagSwingAngleAlphaFunctionOut = 0x04000000, - FlagSwingAngleAlphaFunctionMask = FlagSwingAngleAlphaFunctionIn | FlagSwingAngleAlphaFunctionOut, - FlagSwingAnchorAlphaFunctionIn = 0x08000000, - FlagSwingAnchorAlphaFunctionOut = 0x10000000, - FlagSwingAnchorAlphaFunctionMask = FlagSwingAnchorAlphaFunctionIn | FlagSwingAnchorAlphaFunctionOut, - FlagOpacityAlphaFunctionIn = 0x20000000, - FlagOpacityAlphaFunctionOut = 0x40000000, - FlagOpacityAlphaFunctionMask = FlagOpacityAlphaFunctionIn | FlagOpacityAlphaFunctionOut - }; - - /** - * @brief Create an initialized ScrollViewCustomEffect. - * - * @return A handle to a newly allocated Dali resource. - */ - static ScrollViewCustomEffect New(); - - /** - * @brief Create an uninitialized ScrollViewCustomEffect; this can be initialized with ScrollViewCustomEffect::New(). - * - * Calling member functions with an uninitialized Toolkit::ScrollViewCustomEffect is not allowed. - */ - ScrollViewCustomEffect(); - - /** - * @brief Downcast an Object handle to ScrollViewCustomEffect. - * - * If handle points to a ScrollViewCustomEffect the downcast - * produces valid handle. If not the returned handle is left - * uninitialized. - * - * @param[in] handle Handle to an object - * @return handle to a ScrollViewCustomEffect or an uninitialized handle - */ - static ScrollViewCustomEffect DownCast( BaseHandle handle ); - - /** - * @brief SetPageSpacing. - * - * @param spacing - */ - void SetPageSpacing(const Vector2& spacing); - - /** - * @brief SetPageTranslation sets a simple translate on/off value. - * - * @param translation - */ - void SetPageTranslation(const Vector3& translation); - - /** - * @brief SetPageTranslation. - * - * @param translationIn - * @param translationOut - */ - void SetPageTranslation(const Vector3& translationIn, const Vector3& translationOut); - - /** - * @brief SetPageTranslationIn. - * @param translation - */ - void SetPageTranslationIn(const Vector3& translation); - - /** - * @brief SetPageTranslationOut. - * - * @param translation - */ - void SetPageTranslationOut(const Vector3& translation); - - /** - * @brief SetPageTranslateAlphaFunction. - * - * @param func - */ - void SetPageTranslateAlphaFunction(AlphaFunction func); - - /** - * @brief SetPageTranslateAlphaFunction. - * - * @param funcIn - * @param funcOut - */ - void SetPageTranslateAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut); - - /** - * @brief SetPageTranslateAlphaFunctionIn. - * - * @param func - */ - void SetPageTranslateAlphaFunctionIn(AlphaFunction func); - - /** - * @brief SetPageTranslateAlphaFunctionOut. - * @param func - */ - void SetPageTranslateAlphaFunctionOut(AlphaFunction func); - - /** - * @brief SetGlobalPageRotation. - * - * @param angle - * @param axis - */ - void SetGlobalPageRotation(float angle, const Vector3& axis); - - /** - * @brief SetAnglePageRotation uses the angle and page size passed in on creation to create a faked origin (inner cube needs this method). - * - * @param angle - */ - void SetAngledOriginPageRotation(const Vector3& angle); - - /** - * @brief SetGlobalPageRotation. - * - * @param angleIn - * @param axisIn - * @param angleOut - * @param axisOut - */ - void SetGlobalPageRotation(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut); - - /** - * @brief SetGlobalPageRotationIn. - * - * @param angle - * @param axis - */ - void SetGlobalPageRotationIn(float angle, const Vector3& axis); - - /** - * @brief SetGlobalPageRotationOut. - * - * @param angle - * @param axis - */ - void SetGlobalPageRotationOut(float angle, const Vector3& axis); - - /** - * @brief SetPageRotationOrigin Set the origin to rotate all the pages around. - * - * - The default value is (0,0,0) - * @param origin - */ - void SetGlobalPageRotationOrigin(const Vector3& origin); - - /** - * @brief SetGlobalPageRotationOrigin. - * - * @param originIn - * @param originOut - */ - void SetGlobalPageRotationOrigin(const Vector3& originIn, const Vector3& originOut); - - /** - * @brief SetGlobalPageRotationOriginIn. - * - * @param origin - */ - void SetGlobalPageRotationOriginIn(const Vector3& origin); - - /** - * @brief SetGlobalPageRotationOriginOut. - * - * @param origin - */ - void SetGlobalPageRotationOriginOut(const Vector3& origin); - - /** - * @brief SetSwingAngle. - * - * @param angle - * @param axis - */ - void SetSwingAngle(float angle, const Vector3& axis); - - /** - * @brief SetSwingAngle. - * - * @param angleIn - * @param axisIn - * @param angleOut - * @param axisOut - */ - void SetSwingAngle(float angleIn, const Vector3& axisIn, float angleOut, const Vector3& axisOut); - - /** - * @brief SetSwingAngleIn. - * - * @param angle - * @param axis - */ - void SetSwingAngleIn(float angle, const Vector3& axis); - - /** - * @brief SetSwingAngleOut. - * - * @param angle - * @param axis - */ - void SetSwingAngleOut(float angle, const Vector3& axis); - - /** - * @brief SetSwingAngleAlphaFunction. - * - * @param func - */ - void SetSwingAngleAlphaFunction(AlphaFunction func); - - /** - * @brief SetSwingAngleAlphaFunction. - * - * @param funcIn - * @param funcOut - */ - void SetSwingAngleAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut); - - /** - * @brief SetSwingAngleAlphaFunctionIn. - * - * @param func - */ - void SetSwingAngleAlphaFunctionIn(AlphaFunction func); - - /** - * @brief SetSwingAngleAlphaFunctionOut. - * - * @param func - */ - void SetSwingAngleAlphaFunctionOut(AlphaFunction func); - - /** - * @brief SetPageRotationOrigin Set the origin to rotate all the pages around. - * - * - The default value is (0,0,0) - * @param anchor - */ - void SetSwingAnchor(const Vector3& anchor); - - /** - * @brief SetSwingAnchor. - * - * @param anchorIn - * @param anchorOut - */ - void SetSwingAnchor(const Vector3& anchorIn, const Vector3& anchorOut); - - /** - * @brief SetSwingAnchorIn. - * - * @param anchor - */ - void SetSwingAnchorIn(const Vector3& anchor); - - /** - * @brief SetSwingAnchorOut. - * - * @param anchor - */ - void SetSwingAnchorOut(const Vector3& anchor); - - /** - * @brief SetSwingAnchorAlphaFunction. - * - * @param func - */ - void SetSwingAnchorAlphaFunction(AlphaFunction func); - - /** - * @brief SetSwingAnchorAlphaFunction. - * - * @param funcIn - * @param funcOut - */ - void SetSwingAnchorAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut); - - /** - * @brief SetSwingAnchorAlphaFunctionIn. - * - * @param func - */ - void SetSwingAnchorAlphaFunctionIn(AlphaFunction func); - - /** - * @brief SetSwingAnchorAlphaFunctionOut. - * @param func - */ - void SetSwingAnchorAlphaFunctionOut(AlphaFunction func); - - /** - * @brief SetOpacityThreshold. - * - * @param thresh - */ - void SetOpacityThreshold(float thresh); - - /** - * @brief SetOpacityThreshold. - * - * @param threshIn - * @param threshOut - */ - void SetOpacityThreshold(float threshIn, float threshOut); - - /** - * @brief SetOpacityThresholdIn. - * - * @param thresh - */ - void SetOpacityThresholdIn(float thresh); - - /** - * @brief SetOpacityThresholdOut. - * - * @param thresh - */ - void SetOpacityThresholdOut(float thresh); - - /** - * @brief SetOpacityAlphaFunction. - * - * @param func - */ - void SetOpacityAlphaFunction(AlphaFunction func); - - /** - * @brief SetOpacityAlphaFunction. - * - * @param funcIn - * @param funcOut - */ - void SetOpacityAlphaFunction(AlphaFunction funcIn, AlphaFunction funcOut); - - /** - * @brief SetOpacityAlphaFunctionIn. - * - * @param func - */ - void SetOpacityAlphaFunctionIn(AlphaFunction func); - - /** - * @brief SetOpacityAlphaFunctionOut. - * - * @param func - */ - void SetOpacityAlphaFunctionOut(AlphaFunction func); - - /** - * @brief Applies the effect to a page. - * - * @param page the page to apply this effect to - * @param pageSize not needed, page size is determined by scroll view - - */ - void ApplyToPage(Actor page, Vector3 pageSize); - -protected: - - /** - * @brief This constructor is used by Dali New() methods. - * - * @param [in] impl A pointer to a newly allocated Dali resource - */ - explicit DALI_INTERNAL ScrollViewCustomEffect( Internal::ScrollViewCustomEffect *impl ); - -}; - -} // namespace Toolkit - -} // namespace Dali - -#endif // __DALI_TOOLKIT_SCROLL_VIEW_CUSTOM_EFFECT_H__ diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp index 03f9d38..85aec94 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp +++ b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp @@ -614,11 +614,6 @@ void ScrollView::ApplyEffect(ScrollViewEffect effect) GetImpl(*this).ApplyEffect(effect); } -ScrollViewEffect ScrollView::ApplyEffect(ScrollView::PageEffect effect) -{ - return GetImpl(*this).ApplyEffect(effect); -} - void ScrollView::RemoveEffect(ScrollViewEffect effect) { GetImpl(*this).RemoveEffect(effect); diff --git a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h index 6c8d935..c89eb21 100644 --- a/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h +++ b/base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h @@ -380,18 +380,6 @@ class ScrollView; class DALI_IMPORT_API ScrollView : public Scrollable { public: - /// Page effect types - enum PageEffect - { - PageEffectNone, ///< No Effect (Standard ScrollView) - PageEffectOuterCube, ///< 3D Rotating Cube Effect - PageEffectDepth, ///< Depth Effect - PageEffectInnerCube, ///< Page Cube Effect - PageEffectCarousel, ///< Page Carousel Effect - PageEffectSpiral, ///< Page Spiral Effect - - Total ///< The total number of effect types - }; // Custom properties @@ -1055,14 +1043,6 @@ public: void ApplyEffect(ScrollViewEffect effect); /** - * @brief ApplyEffect Applies a predefined effect. - * - * @param[in] effect enum for the predefined effect - * @return The scrollview effect that was applied - */ - ScrollViewEffect ApplyEffect(ScrollView::PageEffect effect); - - /** * @brief Remove Effect from ScrollView. * * @param[in] effect The effect to remove. diff --git a/base/dali-toolkit/public-api/file.list b/base/dali-toolkit/public-api/file.list index 60c1699..28fc3d4 100755 --- a/base/dali-toolkit/public-api/file.list +++ b/base/dali-toolkit/public-api/file.list @@ -29,7 +29,6 @@ public_api_base_src_files = \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view.cpp \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-constraints.cpp \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-effect.cpp \ - $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-custom-effect.cpp \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-carousel-effect.cpp \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-cube-effect.cpp \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-depth-effect.cpp \ @@ -107,7 +106,6 @@ public_api_base_scroll_view_header_files = \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-wobble-effect.h \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view.h \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-effect.h \ - $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-custom-effect.h \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-cube-effect.h \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-page-spiral-effect.h \ $(public_api_base_src_dir)/controls/scrollable/scroll-view/scroll-view-slide-effect.h diff --git a/optional/dali-toolkit/dali-toolkit.h b/optional/dali-toolkit/dali-toolkit.h index c738f5a..7be7d83 100644 --- a/optional/dali-toolkit/dali-toolkit.h +++ b/optional/dali-toolkit/dali-toolkit.h @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include