From: Richard Huang Date: Tue, 17 Feb 2015 14:27:36 +0000 (+0000) Subject: Scrollable public API clean-up phase 1 X-Git-Tag: dali_1.0.32~12^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=79182b18eabe71f0ffa2779f0ad17a859f855b9a Scrollable public API clean-up phase 1 Change-Id: Idc65f3e14554895641b178c04048ffa2f63e92d4 --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp index 6f45276..dea4d52 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp @@ -94,46 +94,3 @@ int UtcDaliItemLayoutSetAndGetOrientation(void) DALI_TEST_CHECK(layout->GetOrientation() == ControlOrientation::Left); END_TEST; } - -int UtcDaliItemLayoutGetScrollHints(void) -{ - ToolkitTestApplication application; - - // Create the ItemView actor - TestItemFactory factory; - ItemView view = ItemView::New(factory); - - // Create a grid layout and add it to ItemView - GridLayoutPtr gridLayout = GridLayout::New(); - view.AddLayout(*gridLayout); - - // Set the orientation of the layout to be horizontal from left to right - ItemLayoutPtr layout = view.GetLayout(0); - - Vector2 axisScrollHint; - - layout->SetOrientation(ControlOrientation::Up); - layout->GetXAxisScrollHint(axisScrollHint); - DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION); - layout->GetYAxisScrollHint(axisScrollHint); - DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION); - - layout->SetOrientation(ControlOrientation::Down); - layout->GetXAxisScrollHint(axisScrollHint); - DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION); - layout->GetYAxisScrollHint(axisScrollHint); - DALI_TEST_EQUALS(axisScrollHint, Vector2::YAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION); - - layout->SetOrientation(ControlOrientation::Left); - layout->GetXAxisScrollHint(axisScrollHint); - DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION); - layout->GetYAxisScrollHint(axisScrollHint); - DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION); - - layout->SetOrientation(ControlOrientation::Right); - layout->GetXAxisScrollHint(axisScrollHint); - DALI_TEST_EQUALS(axisScrollHint, Vector2::XAXIS, Math::MACHINE_EPSILON_1, TEST_LOCATION); - layout->GetYAxisScrollHint(axisScrollHint); - DALI_TEST_EQUALS(axisScrollHint, Vector2::ZERO, Math::MACHINE_EPSILON_1, TEST_LOCATION); - END_TEST; -} diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp index 867abd8..587d875 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ScrollView.cpp @@ -722,57 +722,6 @@ int UtcDaliScrollViewScrollSensitive(void) END_TEST; } -int UtcDaliScrollViewTouchesRequired(void) -{ - ToolkitTestApplication application; - tet_infoline(" UtcDaliScrollViewTouchesRequired"); - - // Set up a scrollView... - ScrollView scrollView = ScrollView::New(); - Stage::GetCurrent().Add( scrollView ); - Vector2 stageSize = Stage::GetCurrent().GetSize(); - scrollView.SetSize(stageSize); - scrollView.SetParentOrigin(ParentOrigin::TOP_LEFT); - scrollView.SetAnchorPoint(AnchorPoint::TOP_LEFT); - - // Position rulers. - RulerPtr rulerX = new DefaultRuler(); - RulerPtr rulerY = new DefaultRuler(); - rulerX->SetDomain( RulerDomain(0.0f, stageSize.width + CLAMP_EXCESS_WIDTH, true) ); - rulerY->SetDomain( RulerDomain(0.0f, stageSize.height + CLAMP_EXCESS_HEIGHT, true) ); - scrollView.SetRulerX(rulerX); - scrollView.SetRulerY(rulerY); - scrollView.ScrollStartedSignal().Connect( &OnScrollStart ); - scrollView.ScrollUpdatedSignal().Connect( &OnScrollUpdate ); - scrollView.ScrollCompletedSignal().Connect( &OnScrollComplete ); - scrollView.SnapStartedSignal().Connect( &OnSnapStart ); - - scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little. - Wait(application); - - // First try touches required being a minimum and maximum of 2. - scrollView.SetTouchesRequiredForPanning(2, 2, true); - PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT, CLAMP_GESTURE_FRAMES, true); - - DALI_TEST_CHECK( !gOnScrollStartCalled ); - DALI_TEST_CHECK( !gOnScrollUpdateCalled ); - DALI_TEST_CHECK( !gOnScrollCompleteCalled ); - DALI_TEST_CHECK( !gOnSnapStartCalled ); - - scrollView.ScrollTo(CLAMP_START_SCROLL_POSITION, 0.0f); // move in a little. - Wait(application); - - // Second try touches required being a minimum and maximum of 1. - scrollView.SetTouchesRequiredForPanning(1, 1, true); - PerformGestureDiagonalSwipe(application, CLAMP_TOUCH_START, CLAMP_TOUCH_MOVEMENT * 0.1f, CLAMP_GESTURE_FRAMES * 0.1f, true); - - DALI_TEST_CHECK( gOnScrollStartCalled ); - DALI_TEST_CHECK( gOnScrollUpdateCalled ); - DALI_TEST_CHECK( gOnScrollCompleteCalled ); - DALI_TEST_CHECK( gOnSnapStartCalled ); - END_TEST; -} - int UtcDaliScrollViewAxisAutoLock(void) { ToolkitTestApplication application; diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp index cc61cba..4d7049e 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.cpp @@ -41,7 +41,6 @@ ScrollBase::ScrollBase() mPropertyTime(Property::INVALID_INDEX), mPropertyPrePosition(Property::INVALID_INDEX), mPropertyPosition(Property::INVALID_INDEX), - mPropertyScale(Property::INVALID_INDEX), mPropertyOvershootX(Property::INVALID_INDEX), mPropertyOvershootY(Property::INVALID_INDEX), mPropertyWrap(Property::INVALID_INDEX), @@ -74,7 +73,6 @@ void ScrollBase::RegisterProperties() mPropertyOvershootX = self.RegisterProperty(Toolkit::ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME, 0.0f); mPropertyOvershootY = self.RegisterProperty(Toolkit::ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME, 0.0f); mPropertyFinal = self.RegisterProperty(Toolkit::ScrollView::SCROLL_FINAL_PROPERTY_NAME, Vector3::ZERO); - mPropertyScale = self.RegisterProperty(Toolkit::ScrollView::SCROLL_SCALE_PROPERTY_NAME, Vector3::ONE); mPropertyWrap = self.RegisterProperty(Toolkit::ScrollView::SCROLL_WRAP_PROPERTY_NAME, false); mPropertyPanning = self.RegisterProperty(Toolkit::ScrollView::SCROLL_PANNING_PROPERTY_NAME, false); mPropertyScrolling = self.RegisterProperty(Toolkit::ScrollView::SCROLL_SCROLLING_PROPERTY_NAME, false); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h index fa9693e..6c00f40 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-base-impl.h @@ -200,7 +200,6 @@ protected: Property::Index mPropertyTime; ///< Scroll Time (0 to animationDuration while animating, otherwise 0) Property::Index mPropertyPrePosition; ///< Scroll Position ("scroll-position") [function of scroll-x, scroll-y] Property::Index mPropertyPosition; ///< Scroll Position ("scroll-position") [function of scroll-pre-position] - Property::Index mPropertyScale; ///< Scroll Scale ("scroll-scale") Property::Index mPropertyOvershootX; ///< Scroll Overshoot ("scroll-overshoot-x") [function of scroll-pre-position, scroll-position] Property::Index mPropertyOvershootY; ///< Scroll Overshoot ("scroll-overshoot-y") [function of scroll-pre-position, scroll-position] Property::Index mPropertyWrap; ///< Scroll Wrap ("scroll-wrap") diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp index 8bc5fe2..b73ab0c 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.cpp @@ -56,26 +56,16 @@ namespace const char* const SIGNAL_SNAP_STARTED = "snap-started"; -const int DEFAULT_REFRESH_INTERVAL_MILLISECONDS = 50; ///< Refresh rate TODO: Animation should have an update signal (and see item-view-impl) const Vector2 DEFAULT_MIN_FLICK_DISTANCE(30.0f, 30.0f); ///< minimum distance for pan before flick allowed const float DEFAULT_MIN_FLICK_SPEED_THRESHOLD(500.0f); ///< Minimum pan speed required for flick in pixels/s const float FREE_FLICK_SPEED_THRESHOLD = 200.0f; ///< Free-Flick threshold in pixels/ms const float AUTOLOCK_AXIS_MINIMUM_DISTANCE2 = 100.0f; ///< Auto-lock axis after minimum distance squared. const float FLICK_ORTHO_ANGLE_RANGE = 75.0f; ///< degrees. (if >45, then supports diagonal flicking) -const unsigned int MAXIMUM_NUMBER_OF_VALUES = 5; ///< Number of values to use for weighted pan calculation. const Vector2 DEFAULT_MOUSE_WHEEL_SCROLL_DISTANCE_STEP_PROPORTION = Vector2(0.17f, 0.1f); ///< The step of horizontal scroll distance in the proportion of stage size for each mouse wheel event received. const unsigned long MINIMUM_TIME_BETWEEN_DOWN_AND_UP_FOR_RESET( 150u ); const float TOUCH_DOWN_TIMER_INTERVAL = 100.0f; const float DEFAULT_SCROLL_UPDATE_DISTANCE( 30.0f ); ///< Default distance to travel in pixels for scroll update signal -// predefined effect values -const Vector3 ANGLE_CAROUSEL_ROTATE(Math::PI * 0.5f, Math::PI * 0.5f, 0.0f); -const Vector3 ANGLE_CUBE_PAGE_ROTATE(Math::PI * 0.2f, Math::PI * 0.2f, 0.0f); ///< Cube page rotates as if it has ten sides with the camera positioned inside -const Vector2 ANGLE_CUSTOM_CUBE_SWING(-Math::PI * 0.45f, -Math::PI * 0.45f); ///< outer cube pages swing 90 degrees as they pan offscreen -const Vector2 ANGLE_SPIRAL_SWING_IN(Math::PI * 0.5f, Math::PI * 0.5f); -const Vector2 ANGLE_SPIRAL_SWING_OUT(Math::PI * 0.35f, Math::PI * 0.35f); -const Vector2 ANGLE_OUTER_CUBE_SWING(Math::PI * 0.5f, Math::PI * 0.5f); ///< outer cube pages swing 90 degrees as they pan offscreen - // Helpers //////////////////////////////////////////////////////////////////////////////////////// /** @@ -557,11 +547,8 @@ ScrollView::ScrollView() mTouchDownTime(0u), mGestureStackDepth(0), mScrollStateFlags(0), - mMinTouchesForPanning(1), - mMaxTouchesForPanning(1), mLockAxis(LockPossible), mScrollUpdateDistance(DEFAULT_SCROLL_UPDATE_DISTANCE), - mOvershootDelay(1.0f), mMaxOvershoot(Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT, Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT), mUserMaxOvershoot(Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT, Toolkit::ScrollView::DEFAULT_MAX_OVERSHOOT), mSnapOvershootDuration(Toolkit::ScrollView::DEFAULT_SNAP_OVERSHOOT_DURATION), @@ -623,9 +610,6 @@ void ScrollView::OnInitialize() EnableGestureDetection( Gesture::Type( Gesture::Pan ) ); - // For pan, default to only 1 touch required, ignoring touches outside this range. - SetTouchesRequiredForPanning(1, 1, false); - // By default we'll allow the user to freely drag the scroll view, // while disabling the other rulers. RulerPtr ruler = new DefaultRuler(); @@ -959,25 +943,6 @@ void ScrollView::SetSnapOvershootDuration(float duration) mSnapOvershootDuration = duration; } -void ScrollView::SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside) -{ - PanGestureDetector panGesture( GetPanGestureDetector() ); - - mMinTouchesForPanning = minTouches; - mMaxTouchesForPanning = maxTouches; - - if(endOutside) - { - panGesture.SetMinimumTouchesRequired(minTouches); - panGesture.SetMaximumTouchesRequired(maxTouches); - } - else - { - panGesture.SetMinimumTouchesRequired(1); - panGesture.SetMaximumTouchesRequired(UINT_MAX); - } -} - void ScrollView::SetActorAutoSnap(bool enable) { mActorAutoSnapEnabled = enable; @@ -1815,8 +1780,9 @@ void ScrollView::SetScrollUpdateNotification( bool enabled ) self.RemovePropertyNotification(mScrollXUpdateNotification); mScrollXUpdateNotification.Reset(); } - if( enabled ) + if( enabled && !mScrollUpdatedSignal.Empty()) { + // Only set up the notification when the application has connected to the updated signal mScrollXUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 0, StepCondition(mScrollUpdateDistance, 0.0f)); mScrollXUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification ); } @@ -1827,8 +1793,9 @@ void ScrollView::SetScrollUpdateNotification( bool enabled ) self.RemovePropertyNotification(mScrollYUpdateNotification); mScrollYUpdateNotification.Reset(); } - if( enabled ) + if( enabled && !mScrollUpdatedSignal.Empty()) { + // Only set up the notification when the application has connected to the updated signal mScrollYUpdateNotification = self.AddPropertyNotification(mPropertyPosition, 1, StepCondition(mScrollUpdateDistance, 0.0f)); mScrollYUpdateNotification.NotifySignal().Connect( this, &ScrollView::OnScrollUpdateNotification ); } @@ -2575,11 +2542,11 @@ bool ScrollView::OnAccessibilityPan(PanGesture gesture) void ScrollView::ClampPosition(Vector3& position) const { - ClampState3 clamped; + ClampState3D clamped; ClampPosition(position, clamped); } -void ScrollView::ClampPosition(Vector3& position, ClampState3 &clamped) const +void ScrollView::ClampPosition(Vector3& position, ClampState3D &clamped) const { Vector3 size = Self().GetCurrentSize(); diff --git a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h index 0ffd7d4..8f9abc7 100644 --- a/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h @@ -206,11 +206,6 @@ public: void SetSnapOvershootDuration(float duration); /** - * @copydoc Toolkit::ScrollView::SetTouchesRequiredForPanning - */ - void SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside); - - /** * @copydoc Toolkit::ScrollView::SetActorAutoSnap */ void SetActorAutoSnap(bool enable); @@ -737,7 +732,7 @@ private: * @param[in,out] position The position you wish to clamp * @param[out] clamped The results of the clamping. */ - void ClampPosition(Vector3& position, ClampState3 &clamped) const; + void ClampPosition(Vector3& position, ClampState3D &clamped) const; /** * Wraps position within the domain set up by X/Y Rulers @@ -860,9 +855,6 @@ private: Vector3 mMinScroll; Vector3 mMaxScroll; - unsigned int mMinTouchesForPanning; ///< Minimum number of touches for panning to be used. - unsigned int mMaxTouchesForPanning; ///< Maximum number of touches for panning to be used. - Animation mInternalXAnimation; ///< Animates mPropertyX to a snap position or application requested scroll position Animation mInternalYAnimation; ///< Animates mPropertyY to a snap position or application requested scroll position @@ -880,7 +872,6 @@ private: ScrollViewEffectContainer mEffects; ///< Container keeping track of all the applied effects. - float mOvershootDelay; ///< Time to wait for input before reducing overshoot back to 0 Vector2 mMaxOvershoot; ///< Number of scrollable pixels that will take overshoot from 0.0f to 1.0f Vector2 mUserMaxOvershoot; ///< Set by user, allows overriding of default max overshoot for the scroll indicator float mSnapOvershootDuration; ///< Duration for overshoot snapping back to Vector3::ZERO diff --git a/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp b/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp index 64fa2b9..87d31f8 100644 --- a/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp +++ b/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp @@ -51,7 +51,6 @@ const float DEFAULT_OVERSHOOT_ANIMATION_SPEED(120.0f); // 120 pixels per second const char* const SIGNAL_SCROLL_STARTED = "scroll-started"; const char* const SIGNAL_SCROLL_COMPLETED = "scroll-completed"; const char* const SIGNAL_SCROLL_UPDATED = "scroll-updated"; -const char* const SIGNAL_SCROLL_CLAMPED = "scroll-clamped"; BaseHandle Create() { @@ -64,7 +63,6 @@ TypeRegistration mType( typeid( Toolkit::Scrollable ), typeid( Toolkit::Control SignalConnectorType s1( mType, SIGNAL_SCROLL_STARTED, &Scrollable::DoConnectSignal ); SignalConnectorType s2( mType, SIGNAL_SCROLL_COMPLETED, &Scrollable::DoConnectSignal ); SignalConnectorType s3( mType, SIGNAL_SCROLL_UPDATED, &Scrollable::DoConnectSignal ); -SignalConnectorType s4( mType, SIGNAL_SCROLL_CLAMPED, &Scrollable::DoConnectSignal ); PropertyRegistration property1( mType, "overshoot-effect-color", @@ -211,11 +209,6 @@ Toolkit::Scrollable::ScrollCompletedSignalType& Scrollable::ScrollCompletedSigna return mScrollCompletedSignal; } -Toolkit::Scrollable::ScrollClampedSignalType& Scrollable::ScrollClampedSignal() -{ - return mScrollClampedSignal; -} - bool Scrollable::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor ) { Dali::BaseHandle handle( object ); @@ -235,10 +228,6 @@ bool Scrollable::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface { scrollable.ScrollCompletedSignal().Connect( tracker, functor ); } - else if( 0 == strcmp( signalName.c_str(), SIGNAL_SCROLL_CLAMPED ) ) - { - scrollable.ScrollClampedSignal().Connect( tracker, functor ); - } else { // signalName does not match any signal diff --git a/dali-toolkit/internal/controls/scrollable/scrollable-impl.h b/dali-toolkit/internal/controls/scrollable/scrollable-impl.h index e100e75..1bceb81 100644 --- a/dali-toolkit/internal/controls/scrollable/scrollable-impl.h +++ b/dali-toolkit/internal/controls/scrollable/scrollable-impl.h @@ -156,11 +156,6 @@ public: //Signals Toolkit::Scrollable::ScrollCompletedSignalType& ScrollCompletedSignal(); /** - * @copydoc Dali::Toolkit::Scrollable::ScrollClampedSignal() - */ - Toolkit::Scrollable::ScrollClampedSignalType& ScrollClampedSignal(); - - /** * Connects a callback function with the object's signals. * @param[in] object The object providing the signal. * @param[in] tracker Used to disconnect the signal. @@ -248,7 +243,6 @@ protected: Toolkit::Scrollable::ScrollStartedSignalType mScrollStartedSignal; Toolkit::Scrollable::ScrollUpdatedSignalType mScrollUpdatedSignal; Toolkit::Scrollable::ScrollCompletedSignalType mScrollCompletedSignal; - Toolkit::Scrollable::ScrollClampedSignalType mScrollClampedSignal; private: diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp b/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp index d55ed9c..03a06c0 100644 --- a/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp +++ b/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.cpp @@ -151,150 +151,6 @@ float ItemLayout::GetClosestOnScreenLayoutPosition(int itemID, float currentLayo return currentLayoutPosition; } -void ItemLayout::GetXAxisScrollHint(Vector2& scrollHint) const -{ - scrollHint = Vector2::ZERO; - Radian scrollAngle(GetScrollDirection()); - Vector2 scrollDirection(sinf(scrollAngle), cosf(scrollAngle)); - switch(mOrientation) - { - case ControlOrientation::Up: - { - if(fabsf(scrollDirection.y) < Math::MACHINE_EPSILON_1) - { - // we probably want x scrolling - if(scrollDirection.x > 0.0f) - { - // normal positive scrolling - scrollHint = Vector2::XAXIS; - } - else - { - scrollHint = -Vector2::XAXIS; - } - } - break; - } - case ControlOrientation::Down: - { - if(fabsf(scrollDirection.y) < Math::MACHINE_EPSILON_1) - { - // we probably want x scrolling - if(scrollDirection.x > 0.0f) - { - // normal positive scrolling - scrollHint = -Vector2::XAXIS; - } - else - { - scrollHint = Vector2::XAXIS; - } - } - break; - } - case ControlOrientation::Left: - { - // we probably want x scrolling - if(scrollDirection.x > 0.0f) - { - // normal positive scrolling - scrollHint = Vector2::XAXIS; - } - else - { - scrollHint = -Vector2::XAXIS; - } - break; - } - case ControlOrientation::Right: - { - // we probably want x scrolling - if(scrollDirection.x > 0.0f) - { - // normal positive scrolling - scrollHint = -Vector2::XAXIS; - } - else - { - scrollHint = Vector2::XAXIS; - } - break; - } - } -} - -void ItemLayout::GetYAxisScrollHint(Vector2& scrollHint) const -{ - scrollHint = Vector2::ZERO; - Radian scrollAngle(GetScrollDirection()); - Vector2 scrollDirection(sinf(scrollAngle), cosf(scrollAngle)); - switch(mOrientation) - { - case ControlOrientation::Up: - { - // we probably want x scrolling - if(scrollDirection.y > 0.0f) - { - // normal positive scrolling - scrollHint = Vector2::YAXIS; - } - else - { - scrollHint = -Vector2::YAXIS; - } - break; - } - case ControlOrientation::Down: - { - // we probably want x scrolling - if(scrollDirection.y > 0.0f) - { - // normal positive scrolling - scrollHint = -Vector2::YAXIS; - } - else - { - scrollHint = Vector2::YAXIS; - } - break; - } - case ControlOrientation::Left: - { - if(fabsf(scrollDirection.x) < Math::MACHINE_EPSILON_1) - { - // we probably want x scrolling - if(scrollDirection.y > 0.0f) - { - // normal positive scrolling - scrollHint = -Vector2::YAXIS; - } - else - { - scrollHint = Vector2::YAXIS; - } - } - break; - } - case ControlOrientation::Right: - { - if(fabsf(scrollDirection.x) < Math::MACHINE_EPSILON_1) - { - // we probably want x scrolling - if(scrollDirection.y > 0.0f) - { - // normal positive scrolling - scrollHint = Vector2::YAXIS; - } - else - { - scrollHint = -Vector2::YAXIS; - } - } - break; - } - } -} - int ItemLayout::GetNextFocusItemID(int itemID, int maxItems, Dali::Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled) { switch( direction ) diff --git a/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h b/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h index fdea8ec..030ddb9 100644 --- a/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h +++ b/dali-toolkit/public-api/controls/scrollable/item-view/item-layout.h @@ -310,38 +310,6 @@ public: virtual Degree GetScrollDirection() const = 0; /** - * @brief Tells scroll components how to interpolate our logical scroll position as a screen x/y direction. - * - * Application developer wants to use -ve y, +ve x as up direction and +ve y, -ve x as down direction scroll values in a - * vertical scroll type effect (SpiralLayout). This means that scroll bar/overshoot indicator should be affected by y-axis. - * Returning (0.0f, 0.0f) for x and (0.0f, -1.0f) for y tells us that we need to use the y scroll value to move the scroll bar - * along y axis with y scroll of 0 starting at bottom (due to -1.0f on y), a value of (0.0f, 1.0f) on x axis mask would mean using y scroll value to move scroll bar along x axis - * - * This function is used by numerous objects such as scroll indicators and scroll overshoot indicators and all - * layout implementations should provide their own version of this function to ensure proper functionality of - * internal toolkit systems. - * - * @param[out] scrollHint Vector2 describing how x and y scroll values should be used for x-axis scrolling - */ - DALI_IMPORT_API virtual void GetXAxisScrollHint(Vector2& scrollHint) const; - - /** - * @brief Tells scroll components how to interpolate our logical scroll position as a screen x/y direction. - * - * Application developer wants to use -ve y, +ve x as up direction and +ve y, -ve x as down direction scroll values in a - * vertical scroll type effect (SpiralLayout). This means that scroll bar/overshoot indicator should be affected by y-axis. - * Returning (0.0f, 0.0f) for x and (0.0f, -1.0f) for y tells us that we need to use the y scroll value to move the scroll bar - * along y axis with y scroll of 0 starting at bottom (due to -1.0f on y), a value of (0.0f, 1.0f) on x axis mask would mean using y scroll value to move scroll bar along x axis - * - * This function is used by numerous objects such as scroll indicators and scroll overshoot indicators and all - * layout implementations should provide their own version of this function to ensure proper functionality of - * internal toolkit systems. - * - * @param[out] scrollHint Vector2 describing how x and y scroll values should be used for y-axis scrolling - */ - DALI_IMPORT_API virtual void GetYAxisScrollHint(Vector2& scrollHint) const; - - /** * @brief Query the scroll speed factor of the layout while dragging. * * This factor is used by the layout to customise its scroll speed while dragging. diff --git a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp index e474d3b..9e8a9c7 100644 --- a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp +++ b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp @@ -283,14 +283,12 @@ unsigned int FixedRuler::GetTotalPages() const // ScrollView /////////////////////////////////////////////////////////////////////////////////////////////////// -const std::string ScrollView::SCROLL_PAGE_CURRENT( "scroll-page-current" ); const std::string ScrollView::SCROLL_TIME_PROPERTY_NAME( "scroll-time" ); const std::string ScrollView::SCROLL_POSITION_PROPERTY_NAME( "scroll-position" ); const std::string ScrollView::SCROLL_PRE_POSITION_PROPERTY_NAME( "scroll-pre-position" ); const std::string ScrollView::SCROLL_OVERSHOOT_X_PROPERTY_NAME( "scroll-overshoot-x" ); const std::string ScrollView::SCROLL_OVERSHOOT_Y_PROPERTY_NAME( "scroll-overshoot-y" ); const std::string ScrollView::SCROLL_FINAL_PROPERTY_NAME( "scroll-final" ); -const std::string ScrollView::SCROLL_SCALE_PROPERTY_NAME( "scroll-scale" ); const std::string ScrollView::SCROLL_WRAP_PROPERTY_NAME( "scroll-wrap" ); const std::string ScrollView::SCROLL_PANNING_PROPERTY_NAME( "scroll-panning" ); const std::string ScrollView::SCROLL_SCROLLING_PROPERTY_NAME( "scroll-scrolling" ); @@ -420,11 +418,6 @@ void ScrollView::SetSnapOvershootDuration(float duration) GetImpl(*this).SetSnapOvershootDuration(duration); } -void ScrollView::SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside) -{ - GetImpl(*this).SetTouchesRequiredForPanning(minTouches, maxTouches, endOutside); -} - void ScrollView::SetActorAutoSnap(bool enable) { GetImpl(*this).SetActorAutoSnap(enable); diff --git a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h index 1dcfb85..5a2e93d 100644 --- a/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h +++ b/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h @@ -33,6 +33,26 @@ class ScrollView; } /** + * @brief How axes/rotation or scale are clamped + */ +enum ClampState +{ + NotClamped, ///< The quantity isn't clamped + ClampedToMin, ///< The quantity is clamped to the min value + ClampedToMax ///< The quantity is clamped to the max value +}; + +/** + * @brief A 3 dimensional clamp + */ +struct ClampState3D +{ + ClampState x; ///< The clamp state of the x axis + ClampState y; ///< The clamp state of the y axis + ClampState z; ///< The clamp state of the z axis +}; + +/** * @brief The snap type */ enum SnapType @@ -388,14 +408,12 @@ public: // Custom properties - static const std::string SCROLL_PAGE_CURRENT; ///< Property, name "scroll-page-current", type INT static const std::string SCROLL_TIME_PROPERTY_NAME; ///< Property, name "scroll-time", type FLOAT static const std::string SCROLL_POSITION_PROPERTY_NAME; ///< Property, name "scroll-position", type VECTOR3 static const std::string SCROLL_PRE_POSITION_PROPERTY_NAME; ///< Property, name "scroll-pre-position", type VECTOR3 static const std::string SCROLL_OVERSHOOT_X_PROPERTY_NAME; ///< Property, name "scroll-overshoot-x", type float static const std::string SCROLL_OVERSHOOT_Y_PROPERTY_NAME; ///< Property, name "scroll-overshoot-y", type float static const std::string SCROLL_FINAL_PROPERTY_NAME; ///< Property, name "scroll-final", type VECTOR3 - static const std::string SCROLL_SCALE_PROPERTY_NAME; ///< Property, name "scroll-scale", type VECTOR3 static const std::string SCROLL_WRAP_PROPERTY_NAME; ///< Property, name "scroll-wrap", type BOOLEAN static const std::string SCROLL_PANNING_PROPERTY_NAME; ///< Property, name "scroll-panning", type BOOLEAN static const std::string SCROLL_SCROLLING_PROPERTY_NAME; ///< Property, name "scroll-scrolling", type BOOLEAN @@ -414,21 +432,18 @@ public: static const float DEFAULT_FLICK_SPEED_COEFFICIENT; ///< Default Flick speed coefficient (multiples input touch velocity) static const float DEFAULT_MAX_FLICK_SPEED; ///< Default Maximum flick speed. (in stage diagonals per second) - /// Direction of transitions - enum EDirectionFlag +public: + + /** + * @brief Clamp signal event's data + */ + struct ClampEvent { - DirectionFlagLeft = 0x01, - DirectionFlagRight = 0x02, - DirectionFlagUp = 0x04, - DirectionFlagDown = 0x08, - DirectionFlagTransitionOn = 0x10, ///< doesnt mean a page is moving towards centre, it affects whether the current page is using values for moving onto screen or off screen, if the user changes scroll direction we dont want things to flip over when in view - DirectionFlagTransitionOff = 0x20, - DirectionFlagMask_Direction = DirectionFlagLeft | DirectionFlagRight | DirectionFlagUp | DirectionFlagDown, - DirectionFlagMask_Transition = DirectionFlagTransitionOn | DirectionFlagTransitionOff + ClampState3D scale; ///< Clamp information for scale axes + ClampState3D position; ///< Clamp information for position axes + ClampState rotation; ///< Clamp information for rotation }; -public: - /** * @brief Snap signal event's data. */ @@ -623,24 +638,6 @@ public: void SetSnapOvershootDuration(float duration); /** - * @brief Sets Touches required for pan gestures. - * - * Panning requires number of touches to be within (minTouches) and - * (maxTouches). - * - * If (endOutside) is true, then outside this range of touches, - * the pan gesture will end and thus will snap. - * - * If (endOutside) is false, then outside this range of touches, - * the pan gesture will pause. but will not end until touches = 0. - * - * @param[in] minTouches Minimum touches for panning to occur. - * @param[out] maxTouches Maxiumum touches for panning to occur. - * @param[in] endOutside Whether to end the panning gesture outside of touch range - */ - void SetTouchesRequiredForPanning(unsigned int minTouches = 1, unsigned int maxTouches = 1, bool endOutside = true); - - /** * @brief Enables or Disables Actor Auto-Snap mode. * * When Actor Auto-Snap mode has been enabled, ScrollView will automatically diff --git a/dali-toolkit/public-api/controls/scrollable/scrollable.cpp b/dali-toolkit/public-api/controls/scrollable/scrollable.cpp index 21f9615..1ce8314 100644 --- a/dali-toolkit/public-api/controls/scrollable/scrollable.cpp +++ b/dali-toolkit/public-api/controls/scrollable/scrollable.cpp @@ -84,11 +84,6 @@ Scrollable::ScrollCompletedSignalType& Scrollable::ScrollCompletedSignal() return GetImpl(*this).ScrollCompletedSignal(); } -Scrollable::ScrollClampedSignalType& Scrollable::ScrollClampedSignal() -{ - return GetImpl(*this).ScrollClampedSignal(); -} - bool Scrollable::IsScrollComponentEnabled(Scrollable::ScrollComponentType indicator) const { return GetImpl(*this).IsScrollComponentEnabled(indicator); diff --git a/dali-toolkit/public-api/controls/scrollable/scrollable.h b/dali-toolkit/public-api/controls/scrollable/scrollable.h index 0e34526..715134f 100644 --- a/dali-toolkit/public-api/controls/scrollable/scrollable.h +++ b/dali-toolkit/public-api/controls/scrollable/scrollable.h @@ -33,35 +33,6 @@ class Scrollable; } /** - * @brief How axes/rotation or scale are clamped - */ -enum ClampState -{ - NotClamped, ///< The quantity isn't clamped - ClampedToMin, ///< The quantity is clamped to the min value - ClampedToMax ///< The quantity is clamped to the max value -}; - -/** - * @brief A 2 dimensional clamp - */ -struct ClampState2 -{ - ClampState x; ///< The clamp state of the x axis - ClampState y; ///< The clamp state of the y axis -}; - -/** - * @brief A 3 dimensional clamp - */ -struct ClampState3 -{ - ClampState x; ///< The clamp state of the x axis - ClampState y; ///< The clamp state of the y axis - ClampState z; ///< The clamp state of the z axis -}; - -/** * @brief Base class for derived Scrollables that contains actors that can be scrolled manually * (via touch) or automatically. * @@ -73,23 +44,12 @@ struct ClampState3 * | scroll-started | @ref ScrollStartedSignal() | * | scroll-completed | @ref ScrollUpdatedSignal() | * | scroll-updated | @ref ScrollCompletedSignal() | - * | scroll-clamped | @ref ScrollClampedSignal() | */ class DALI_IMPORT_API Scrollable : public Control { public: /** - * @brief Clamp signal event's data - */ - struct ClampEvent - { - ClampState3 scale; ///< Clamp information for scale axes - ClampState3 position; ///< Clamp information for position axes - ClampState rotation; ///< Clamp information for rotation - }; - - /** * @brief Scroll component types */ enum ScrollComponentType @@ -117,7 +77,6 @@ public: typedef Signal< void ( const Vector3& ) > ScrollStartedSignalType; ///< ScrollStarted signal type typedef Signal< void ( const Vector3& ) > ScrollCompletedSignalType; ///< ScrollCompleted signal type typedef Signal< void ( const Vector3& ) > ScrollUpdatedSignalType; ///< Scroll updated signal type - typedef Signal< void ( const ClampEvent& ) > ScrollClampedSignalType; ///< Scroll clamped signal type /** * @brief Signal emitted when the Scrollable has moved (whether by touch or animation). @@ -134,14 +93,6 @@ public: */ ScrollCompletedSignalType& ScrollCompletedSignal(); - /** - * @brief Signal emitted when the Scrollable is pushing against a domain boundary - * (in either position, scale, or rotation). - * - * @return The signal to connect to - */ - ScrollClampedSignalType& ScrollClampedSignal(); - public: /**