Added new properties to make ScrollView more scriptable
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / scroll-view / scroll-view-impl.h
index 23bc81f..b9db77d 100644 (file)
@@ -1,24 +1,27 @@
 #ifndef __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__
 #define __DALI_TOOLKIT_INTERNAL_SCROLL_VIEW_H__
 
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2015 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 <dali/dali.h>
+#include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/animation/animation.h>
+#include <dali/public-api/object/property-notification.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control-impl.h>
@@ -26,9 +29,6 @@
 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-effect.h>
 
-// predefined effect includes
-#include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view-custom-effect.h>
-
 namespace Dali
 {
 
@@ -77,6 +77,24 @@ public:
     LockNone          ///< Locking is set to none (free panning).
   };
 
+  enum ScrollStateFlag
+  {
+    AnimatingInternalX = 0x01, ///< animating mPropertyX due to externally requested ScrollTo or internal snapping operation
+    AnimatingInternalY = 0x02, ///< animating mPropertyY due to externally requested ScrollTo or internal snapping operation
+    SnappingInternalX  = 0x04, ///< snapping mPropertyX back to mPropertyPreScroll x value to remove x overshoot over time
+    SnappingInternalY  = 0x08, ///< snapping mPropertyY back to mPropertyPreScroll y value to remove y overshoot over time
+  };
+
+  static const unsigned int SCROLL_X_STATE_MASK = AnimatingInternalX | SnappingInternalX;
+  static const unsigned int SCROLL_Y_STATE_MASK = AnimatingInternalY | SnappingInternalY;
+  static const unsigned int SCROLL_ANIMATION_FLAGS = AnimatingInternalX | AnimatingInternalY;
+  static const unsigned int SNAP_ANIMATION_FLAGS = SnappingInternalX | SnappingInternalY;
+
+private:
+
+  typedef std::vector<Dali::Toolkit::ScrollViewEffect> ScrollViewEffectContainer; ///< Container of Dali::Toolkit::ScrollViewEffect
+  typedef ScrollViewEffectContainer::iterator ScrollViewEffectIter; ///< Iterator for Dali::Toolkit::ScrollViewEffectContainer
+
 public:
 
   /**
@@ -133,12 +151,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);
@@ -179,20 +191,11 @@ public:
   void SetRulerY(RulerPtr ruler);
 
   /**
-   * @copydoc Toolkit::ScrollView::SetRulerScaleX
-   */
-  void SetRulerScaleX(RulerPtr ruler);
-
-  /**
-   * @copydoc Toolkit::ScrollView::SetRulerScaleY
-   */
-  void SetRulerScaleY(RulerPtr ruler);
-
-  /**
-   * Set Rotation axis ruler (defines how rotating is snapped in radians)
-   * @param[in] ruler The ruler to be used for the Rotation axis
+   * Retrieve the touch sensitivity.
+   *
+   * @return whether the touch sensitivity is true or false.
    */
-  void SetRulerRotation(RulerPtr ruler);
+  bool GetScrollSensitive();
 
   /**
    * @copydoc Toolkit::ScrollView::SetScrollSensitive
@@ -210,14 +213,23 @@ public:
   void SetSnapOvershootAlphaFunction(AlphaFunction alpha);
 
   /**
+   * Retrieve the duartion of Snap Overshoot animation
+   *
+   * @return the duration.
+   */
+  float GetSnapOvershootDuration();
+
+  /**
    * @copydoc Toolkit::ScrollView::SetSnapOvershootDuration
    */
   void SetSnapOvershootDuration(float duration);
 
   /**
-   * @copydoc Toolkit::ScrollView::SetTouchesRequiredForPanning
+   * Retrieve whether Actor Auto-Snap mode is enabled or not.
+   *
+   * @return Actor Auto-Snap mode Enabled flag.
    */
-  void SetTouchesRequiredForPanning(unsigned int minTouches, unsigned int maxTouches, bool endOutside);
+  bool GetActorAutoSnap();
 
   /**
    * @copydoc Toolkit::ScrollView::SetActorAutoSnap
@@ -252,14 +264,14 @@ public:
   void SetWrapMode(bool enable);
 
   /**
-   * @copydoc Toolkit::ScrollView::GetRefreshInterval
+   * @copydoc Toolkit::ScrollView::GetScrollupdateDistance
    */
-  int GetRefreshInterval() const;
+  int GetScrollUpdateDistance() const;
 
   /**
-   * @copydoc Toolkit::ScrollView::SetRefreshInterval
+   * @copydoc Toolkit::ScrollView::SetScrollUpdateDistance
    */
-  void SetRefreshInterval(int milliseconds);
+  void SetScrollUpdateDistance(int distance);
 
   /**
    * @copydoc Toolkit::ScrollView::GetAxisAutoLock
@@ -302,6 +314,26 @@ public:
   void SetFlickSpeedCoefficient(float speed);
 
   /**
+   * @copydoc Toolkit::ScrollView::GetMinimumDistanceForFlick
+   */
+  Vector2 GetMinimumDistanceForFlick() const;
+
+  /**
+   * @copydoc Toolkit::ScrollView::SetMinimumDistanceForFlick
+   */
+  void SetMinimumDistanceForFlick( const Vector2& distance );
+
+  /**
+   * @copydoc Toolkit::ScrollView::GetMinimumSpeedForFlick
+   */
+  float GetMinimumSpeedForFlick() const;
+
+  /**
+   * @copydoc Toolkit::ScrollView::SetMinimumSpeedForFlick
+   */
+  void SetMinimumSpeedForFlick( float speed );
+
+  /**
    * @copydoc Toolkit::ScrollView::GetMaxFlickSpeed
    */
   float GetMaxFlickSpeed() const;
@@ -312,14 +344,14 @@ public:
   void SetMaxFlickSpeed(float speed);
 
   /**
-   * @copydoc Toolkit::ScrollView::GetMouseWheelScrollDistanceStep
+   * @copydoc Toolkit::ScrollView::GetWheelScrollDistanceStep
    */
-  Vector2 GetMouseWheelScrollDistanceStep() const;
+  Vector2 GetWheelScrollDistanceStep() const;
 
   /**
-   * @copydoc Toolkit::ScrollView::SetMouseWheelScrollDistanceStep
+   * @copydoc Toolkit::ScrollView::SetWheelScrollDistanceStep
    */
-  void SetMouseWheelScrollDistanceStep(Vector2 step);
+  void SetWheelScrollDistanceStep(Vector2 step);
 
   /**
    * @copydoc Toolkit::ScrollView::GetCurrentPage
@@ -329,44 +361,50 @@ public:
   /**
    * @copydoc Toolkit::ScrollView::GetCurrentScrollPosition
    */
-  Vector3 GetCurrentScrollPosition() const;
+  Vector2 GetCurrentScrollPosition() const;
 
   /**
-   * @copydoc Toolkit::ScrollView::GetCurrentScrollScale
+   * @copydoc Toolkit::Scrollable::GetDomainSize
    */
-  Vector3 GetCurrentScrollScale() const;
+  Vector2 GetDomainSize() const;
 
   /**
-   * @copydoc Toolkit::Scrollable::GetDomainSize
+   * @copydoc ScrollTo(const Vector2&)
    */
-  Vector3 GetDomainSize() const;
+  void TransformTo(const Vector2& position,
+                   DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
 
   /**
-   * @copydoc Toolkit::ScrollView::TransformTo(const Vector3& position, const Vector3& scale, float rotation)
+   * @copydoc ScrollTo(const Vector2&, float, AlhpaFunction, DirectionBias, DirectionBias)
    */
-  void TransformTo(const Vector3& position, const Vector3& scale, float rotation,
+  void TransformTo(const Vector2& position, float duration, AlphaFunction alpha,
                    DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
 
   /**
-   * @copydoc Toolkit::ScrollView::TransformTo(const Vector3& position, const Vector3& scale, float rotation, float duration)
+   * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position)
    */
-  void TransformTo(const Vector3& position, const Vector3& scale, float rotation, float duration,
-                   DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone);
+  void ScrollTo(const Vector2 &position);
 
   /**
-   * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position)
+   * @copydoc Toolkit::Scrollable::ScrollTo(const Vector2& position, float duration)
    */
-  void ScrollTo(const Vector3 &position);
+  void ScrollTo(const Vector2& position, float duration);
 
   /**
-   * @copydoc Toolkit::Scrollable::ScrollTo(const Vector3& position, float duration)
+   * @copydoc Toolkit::Scrollable::ScrollTo(const Vector2& position, float duration, AlphaFunction alpha)
    */
-  void ScrollTo(const Vector3& position, float duration);
+  void ScrollTo(const Vector2& position, float duration, AlphaFunction alpha);
 
   /**
-   * @copydoc Toolkit::ScrollView::ScrollTo(const Vector3 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
+   * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias)
    */
-  void ScrollTo(const Vector3& position, float duration,
+  void ScrollTo(const Vector2& position, float duration,
+                DirectionBias horizontalBias, DirectionBias verticalBias);
+
+  /**
+   * @copydoc Toolkit::ScrollView::ScrollTo(const Vector2 &position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias)
+   */
+  void ScrollTo(const Vector2& position, float duration, AlphaFunction alpha,
                 DirectionBias horizontalBias, DirectionBias verticalBias);
 
   /**
@@ -423,38 +461,29 @@ public:
   bool ScrollToSnapPoint();
 
   /**
-   * @copydoc Toolkit::ScrollView::ScaleTo(const Vector3& scale)
-   */
-  void ScaleTo(const Vector3& scale);
-
-  /**
-   * @copydoc Toolkit::ScrollView::ScaleTo(const Vector3& scale, float duration)
+   * Stops animation
    */
-  void ScaleTo(const Vector3& scale, float duration);
+  void StopAnimation(void);
 
   /**
-   * Stops animation
+   * Stops the input animation
+   *
+   * @param[in] the animation to stop
    */
-  void StopAnimation(void);
+  void StopAnimation(Animation& animation);
 
   /**
-   * Animates to position/scale/rotation transform.
+   * Animates to position transform.
    *
    * @param[in] position The position to animate to
    * @param[in] positionDuration The number of seconds this animation should run for in each axis.
-   * @param[in] scale The scale to animate to
-   * @param[in] scaleDuration The number of seconds this animation should run for in each axis.
-   * @param[in] rotation The angle to animate to
-   * @param[in] rotationDuration The number of seconds this animation should run for in each axis.
    * @param[in] alpha The easing alpha function to use.
    * @param[in] findShortcuts (optional) Whether to find the shortest route (in Wrap mode)
    * @param[in] horizontalBias (optional) Whether to bias animation to left or right (or no biasing)
    * @param[in] verticalBias (optional) Whether to bias animation to top or bottom (or no biasing)
    * @return True if animation necessary and taking place to reach desired transform.
    */
-  bool AnimateTo(const Vector3& position, const Vector3& positionDuration,
-                             const Vector3& scale, const Vector3& scaleDuration,
-                             float rotation, float rotationDuration,
+  bool AnimateTo(const Vector2& position, const Vector2& positionDuration,
                              AlphaFunction alpha, bool findShortcuts = true,
                              DirectionBias horizontalBias = DirectionBiasNone, DirectionBias verticalBias = DirectionBiasNone,
                              SnapType snapType = Snap);
@@ -469,12 +498,35 @@ public:
    */
   void RemoveOverlay(Actor actor);
 
+  /**
+   * @copydoc Toolkit::Internal::Scrollable::SetOvershootEffectColor
+   */
+  void SetOvershootEffectColor( const Vector4& color );
+
+  //properties
+
+  /**
+   * Called when a property of an object of this type is set.
+   * @param[in] object The object whose property is set.
+   * @param[in] index The property index.
+   * @param[in] value The new property value.
+   */
+  static void SetProperty( BaseObject* object, Property::Index index, const Property::Value& value );
+
+  /**
+   * Called to retrieve a property of an object of this type.
+   * @param[in] object The object whose property is to be retrieved.
+   * @param[in] index The property index.
+   * @return The current value of the property.
+   */
+  static Property::Value GetProperty( BaseObject* object, Property::Index index );
+
 public: //Signals
 
   /**
    * @copydoc Dali::Toolkit::ScrollView::SnapStartedSignal()
    */
-  Toolkit::ScrollView::SnapStartedSignalV2& SnapStartedSignal();
+  Toolkit::ScrollView::SnapStartedSignalType& SnapStartedSignal();
 
   /**
    * Connects a callback function with the object's signals.
@@ -495,9 +547,9 @@ private: // private overriden functions from CustomActorImpl and Controls
   virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize);
 
   /**
-   * @copydoc Dali::ControlImpl::OnControlSizeSet(const Vector3&)
+   * @copydoc CustomActorImpl::OnSizeSet(const Vector3&)
    */
-  virtual void OnControlSizeSet( const Vector3& size );
+  virtual void OnSizeSet( const Vector3& size );
 
   /**
    * From CustomActorImpl; called after a child has been added to the owning actor.
@@ -512,7 +564,7 @@ private: // private overriden functions from CustomActorImpl and Controls
   virtual void OnChildRemove(Actor& child);
 
   /**
-   * From CustomActorImpl; called after a touch-signal is received by the owning actor.
+   * From CustomActorImpl; called after a touchSignal is received by the owning actor.
    *
    * We don't listen to these events as content within the contain may consume events.
    *
@@ -522,11 +574,11 @@ private: // private overriden functions from CustomActorImpl and Controls
   virtual bool OnTouchEvent(const TouchEvent& event);
 
   /**
-   * From CustomActorImpl; called after a mouse-wheel-event is received by the owning actor.
-   * @param[in] event The mouse wheel event.
+   * From CustomActorImpl; called after a wheelEvent is received by the owning actor.
+   * @param[in] event The wheel event.
    * @return True if the event should be consumed.
    */
-  virtual bool OnMouseWheelEvent(const MouseWheelEvent& event);
+  virtual bool OnWheelEvent(const WheelEvent& event);
 
   /**
    * @copydoc Toolkit::Control::OnInitialize()
@@ -534,14 +586,14 @@ private: // private overriden functions from CustomActorImpl and Controls
   virtual void OnInitialize();
 
   /**
-   * @copydoc Toolkit::Control::OnControlStageConnection()
+   * @copydoc CustomActorImpl::OnStageConnection()
    */
-  virtual void OnControlStageConnection();
+  virtual void OnStageConnection( int depth );
 
   /**
-   * @copydoc Toolkit::Control::OnControlStageConnection()
+   * @copydoc CustomActorImpl::OnStageDisconnection()
    */
-  virtual void OnControlStageDisconnection();
+  virtual void OnStageDisconnection();
 
   /**
    * @copydoc Toolkit::Control::OnAccessibilityPan()
@@ -549,38 +601,101 @@ private: // private overriden functions from CustomActorImpl and Controls
   virtual bool OnAccessibilityPan(PanGesture gesture);
 
   /**
-   * @copydoc Toolkit::Scrollable::SetOvershootEnabled()
+   * @copydoc Toolkit::Scrollable::EnableScrollOvershoot()
    */
-  virtual void SetOvershootEnabled(bool enable);
+  virtual void EnableScrollOvershoot(bool enable);
 
 private:
 
   /**
+   * Start a timer which calls OnTouchDownTimeout()
+   */
+  void StartTouchDownTimer();
+
+  /**
+   * Stop a timer which calls OnTouchDownTimeout()
+   */
+  void StopTouchDownTimer();
+
+  /**
+   * Helper to detect when touch-point has been down (outside of pan gesture)
+   */
+  bool OnTouchDownTimeout();
+
+  /**
    * Called whenever a snap animation has completed
    * @param[in] source the Animation instance that has completed.
+   * Resets all scrolling animations and states, leaving current scroll position at SCROLL_POSITION
+   */
+  void ResetScrolling();
+
+  /**
+   * Updates mScrollInternalPosition, mScrollPrePosition and mScrollPostPosition from their property counterparts
+   */
+  void UpdateLocalScrollProperties();
+
+  /**
+   * Makes sure scroll values are ready for animated scrolling
+   */
+  void PreAnimatedScrollSetup();
+
+  /**
+   * Finish an animated scroll, ensuring all scroll properties are updated
+   * and synchronised
+   */
+  void FinaliseAnimatedScroll();
+
+  /**
+   * Animates the internal x property to the given value
+   *
+   * @param[in] position The X position to animate to
+   * @param[in] duration The time in seconds for animation
+   * @param[in] alpha The alpha function to use for animating
+   */
+  void AnimateInternalXTo( float position, float duration, AlphaFunction alpha );
+
+  /**
+   * Animates the internal y property to the given value
+   *
+   * @param[in] position The Y position to animate to
+   * @param[in] duration The time in seconds for animation
+   * @param[in] alpha The alpha function to use for animating
    */
-  void OnSnapAnimationFinished( Animation& source );
+  void AnimateInternalYTo( float position, float duration, AlphaFunction alpha );
 
   /**
    * Called whenever a snap animation on the x-axis has completed
    * @param[in] source the Animation instance that has completed.
    */
-  void OnSnapXAnimationFinished( Animation& source );
+  void OnScrollAnimationFinished( Animation& source );
 
   /**
-   * Called whenever a snap animation on the y-axis has completed
+   * Called when either the X or Y internal scroll positions have finished snapping back to SCROLL_PRE_POSITION
+   *
    * @param[in] source the Animation instance that has completed.
    */
-  void OnSnapYAnimationFinished( Animation& source );
+  void OnSnapInternalPositionFinished( Animation& source );
+
+  /**
+   * Called whenever a snap animation on the x-axis has completed and we need to snap pre scroll
+   * position to our clamped position
+   * @param[in] position The x position to snap pre scroll property to
+   */
+  void SnapInternalXTo( float position );
+
+  /**
+   * Called whenever a snap animation on the y-axis has completed and we need to snap pre scroll
+   * position to our clamped position
+   * @param[in] position The y position to snap pre scroll property to
+   */
+  void SnapInternalYTo( float position );
 
   /**
    * This is called internally whenever the Scroll Rulers are
-   * modified. This will update the properties: 'scroll-position-min'
-   * and 'scroll-position-max' to reflect the changes.
-   *
-   * @param[in] size size of the visible scroll area (ScrollView control size)
+   * modified. This will update the properties: 'scrollPositionMin'
+   * and 'scrollPositionMax' to reflect the changes.
    */
-  void UpdatePropertyDomain(const Vector3& size);
+  void UpdatePropertyDomain();
 
   /**
    * Called when the gesture starts.
@@ -591,24 +706,15 @@ private:
    * Amalgamated Gesture Continuing event
    *
    * @param[in] panDelta average panning delta from base position (0)
-   * @param[in] scaleDelta average scale delta from base scale (1)
-   * @param[in] rotationDelta average rotation delta from base angle (0)
    */
-  void GestureContinuing(Vector2 panDelta, Vector2 scaleDelta, float rotationDelta);
+  void GestureContinuing(const Vector2& panDelta);
 
   /**
    * Called upon pan gesture event.
    *
    * @param[in] gesture The gesture event.
    */
-  void OnPan(PanGesture pan);
-
-  /**
-   * Called up pinch gesture event.
-   *
-   * @param[in] gesture The gesture event.
-   */
-  void OnPinch(PinchGesture gesture);
+  void OnPan( const PanGesture& pan);
 
   /**
    * Extension of the above gestures.
@@ -626,34 +732,12 @@ private:
   bool SnapWithVelocity(Vector2 velocity);
 
   /**
-   * Updates Container Transform based on Pan, Scale, and Rotation props.
-   * (occurs when continuing gesture i.e. dragging/pinching.)
-   */
-  void UpdateTransform();
-
-  /**
    * Finishes Container Transform
    * (occurs upon finishing gesture i.e. releasing)
    */
   void FinishTransform();
 
   /**
-   * Sets Overshoot to origin / cancels animation
-   */
-  void SetOvershootToOrigin();
-
-  /**
-   * Animates Overshoot to origin
-   */
-  void AnimateOvershootToOrigin(float xDelay, float yDelay);
-
-  /**
-   * Called whenever a snap overshoot animation has completed.
-   * @param[in] source the Animation instance that has completed.
-   */
-  void OnSnapOvershootAnimationFinished( Animation& source );
-
-  /**
    * Returns overshoot vector based on current position
    *
    * Overshoot vector is defined as how far outside of bounds
@@ -665,14 +749,14 @@ private:
    *
    * @param[in] position The position for which you wish to obtain overshoot vector
    */
-  Vector3 GetOvershoot(Vector3& position) const;
+  Vector2 GetOvershoot(Vector2& position) const;
 
   /**
    * Clamps position within the domain set up by X/Y Rulers
    *
    * @param[in,out] position The position you wish to clamp
    */
-  void ClampPosition(Vector3& position) const;
+  void ClampPosition(Vector2& position) const;
 
   /**
    * Clamps position within the domain set up by X/Y Rulers
@@ -680,7 +764,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(Vector2& position, ClampState2D &clamped) const;
 
   /**
    * Wraps position within the domain set up by X/Y Rulers
@@ -690,22 +774,7 @@ private:
    *
    * @param[in,out] position The position you wish to wrap
    */
-  void WrapPosition(Vector3& position) const;
-
-  /**
-   * Clamps scale within the domain set up by Scale-X/Scale-Y Rulers
-   *
-   * @param[in,out] scale The scale you wish to clamp
-   */
-  void ClampScale(Vector3& scale) const;
-
-  /**
-   * Clamps scale within the domain set up by Scale-X/Scale-Y Rulers
-   *
-   * @param[in,out] scale The scale you wish to clamp
-   * @param[out] clamped The results of the clamping.
-   */
-  void ClampScale(Vector3& scale, ClampState3 &clamped) const;
+  void WrapPosition(Vector2& position) const;
 
   /**
    * Updates the main internal scroll constraints with new ruler and domain
@@ -754,50 +823,38 @@ private:
    *
    * @return The current position
    */
-  Vector3 GetPropertyPrePosition() const;
+  Vector2 GetPropertyPrePosition() const;
 
   /**
    * Gets position property.
    *
    * @return The current position
    */
-  Vector3 GetPropertyPosition() const;
-
-  /**
-   * Gets scale property.
-   *
-   * @return The current scale
-   */
-  Vector3 GetPropertyScale() const;
+  Vector2 GetPropertyPosition() const;
 
   /**
-   * Handles a Stopped animation. Its position/scale/rotation properties need to be
-   * saved, and the animation flag switched off.
+   * Handles a Stopped animation. Its position properties need to be saved, and the animation flag
+   * switched off.
    */
   void HandleStoppedAnimation();
 
   /**
    * Handles a Stopped animation (whether the animation completed, or was
-   * manually stopped). Its position/scale/rotation properties need to be
-   * saved, and the animation flag switched off.
+   * manually stopped). Its position properties need to be saved, and the
+   * animation flag switched off.
    */
   void HandleSnapAnimationFinished();
 
   /**
-   * Helper to start the refresh timer.
+   * Checks if the property notifications are active and adds them if not
    */
-  void StartRefreshTimer();
-
-  /**
-   * Helper to cancel the refresh timer.
-   */
-  void CancelRefreshTimer();
+  void SetScrollUpdateNotification( bool enabled );
 
   /**
    * Refresh the ScrollView (used when animating to update application developer of changes)
    * @return True if the refresh timer should be kept running.
    */
-  bool OnRefreshTick();
+  void OnScrollUpdateNotification(Dali::PropertyNotification& source);
 
 private:
 
@@ -809,73 +866,54 @@ private:
 
 private:
 
-  bool mInitialized;
-  bool mScrolling;                      ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
-  bool mScrollInterrupted;              ///< Flag set for when a down event interrupts a scroll
   unsigned long mTouchDownTime;         ///< The touch down time
-  Vector2 mTouchDownPosition;           ///< The touch down position
-
-  bool mSensitive;                      ///< Scroll Sensitivity Flag.
 
   int mGestureStackDepth;               ///< How many gestures are currently occuring.
-  Vector2 mGestureReferencePosition;    ///< Point where scaling should occur from.
-  Vector2 mPinchGestureLastPosition;
-  Vector2 mPinchGestureLastScale;
-
-  Vector3 mPanDelta;                    ///< Amount currently panned.
-  Vector3 mScaleDelta;                  ///< Amount currently scaled.
-  float mRotationDelta;                 ///< Amount currently rotated.
-
-  // Scroll delegate pre and post position/scale/rotation properties...
-  Vector3 mScrollPrePosition;           ///< Scroll delegate pre-position
-  Vector3 mScrollPostPosition;          ///< Scroll delegate post-position (affected by current touch)
-  Vector3 mScrollPreScale;              ///< Scroll delegate pre-scale
-  Vector3 mScrollPostScale;             ///< Scroll delegate post-scale (affected by current touch)
-  float mScrollPreRotation;             ///< Scroll delegate pre-rotation
-  float mScrollPostRotation;            ///< Scroll delegate post-rotation (affected by current touch)
-  Vector3 mDomainOffset;                ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
+  Vector2 mPanStartPosition;            ///< Where the pan gesture's touch down occured
+  Vector2 mPanDelta;                    ///< Amount currently panned.
+
+  unsigned int mScrollStateFlags;       ///< flags indicating current state of scrolling
+  // Scroll delegate pre and post position properties...
+  Vector2 mScrollPrePosition;           ///< Wrapped scroll position, but not clamped
+  Vector2 mScrollPostPosition;          ///< Wrapped and clamped, this is the final scroll position used
+  Vector2 mScrollTargetPosition;        ///< Final target position for an animated scroll
+  Vector2 mDomainOffset;                ///< Domain offset (this keeps track of the domain boundaries that scroll positions traverses)
 
   // Rulers for each axes...
   RulerPtr mRulerX;
   RulerPtr mRulerY;
-  RulerPtr mRulerScaleX;
-  RulerPtr mRulerScaleY;
-  RulerPtr mRulerRotation;
-  bool mTouchDownReceived;
-  bool mActorAutoSnapEnabled;           ///< Whether to automatically snap to closest actor.
-  bool mAutoResizeContainerEnabled;     ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
-  bool mWrapMode;                       ///< Whether to wrap contents based on container size.
-  bool mAxisAutoLock;                   ///< Whether to automatically lock axis when panning.
-  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 mSnapAnimation;
-  Animation mSnapXAnimation;             ///< Animates from current x-axis position to the snapped (or scrolled) x-axis position.
-  Animation mSnapYAnimation;             ///< Animates from current y-axis position to the snapped (or scrolled) y-axis position.
-  Animation mSnapOvershootAnimation;    ///< Animates scroll-overshoot from current position to 0,0 based on specified easing equation.
+
+  // Last property values set to ScrollView
+  Vector2 mMinScroll;
+  Vector2 mMaxScroll;
+
+  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
 
 
   Vector2 mLastVelocity;                ///< Record the last velocity from PanGesture (Finish event doesn't have correct velocity)
   LockAxis mLockAxis;
 
-  Timer mOvershootRefreshTimer;
-  Timer mRefreshTimer;                  ///< Refresh timer is used to provide the Application developer with updates as animations run.
-  int mRefreshIntervalMilliseconds;     ///< Refresh timer interval.
+  Timer mTouchDownTimer;                ///< Used to interrupt snap-animation. This cannot be done in OnTouchEvent without breaking fast flick behavior.
+
+  float mScrollUpdateDistance;          ///< Distance for scrolling to travel for the scroll update notifications
+  Dali::PropertyNotification mScrollXUpdateNotification; ///< scroll x position update notification
+  Dali::PropertyNotification mScrollYUpdateNotification; ///< scroll y position update notification
 
-  bool mAlterChild;                     ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
   Actor mInternalActor;                 ///< Internal actor (we keep internal actors in here e.g. scrollbars, so we can ignore it in searches)
 
   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
-  bool      mDefaultMaxOvershoot;               ///< Whether to use default max overshoot or application defined one
-  float     mSnapOvershootDuration;             ///< Duration for overshoot snapping back to Vector3::ZERO
+  Vector2   mUserMaxOvershoot;                  ///< Set by user, allows overriding of default max overshoot for the scroll indicator
+  float     mSnapOvershootDuration;             ///< Duration for overshoot snapping back to Vector2::ZERO
   AlphaFunction mSnapOvershootAlphaFunction;    ///< AlphaFunction to be used for this overshoot.
 
   float mSnapDuration;                          ///< Time for the snap animation to take (in seconds).
   AlphaFunction mSnapAlphaFunction;             ///< AlphaFunction to be used for the Snap Animation.
 
+  Vector2 mMinFlickDistance;                      ///< Minimum pan distance required for a flick
+  float mFlickSpeedThreshold;                   ///< Minimum pan speed required for a flick in pixels/ms
   float mFlickDuration;                         ///< Time for the flick animation to take (in seconds).
   AlphaFunction mFlickAlphaFunction;            ///< AlphaFunction to be used for the Flick Animation.
 
@@ -884,22 +922,37 @@ private:
   float mFlickSpeedCoefficient;                 ///< Flick velocity coefficient. Input touch velocity is multiplied by this.
   float mMaxFlickSpeed;                         ///< Maximum flick speed. Maximum speed of flick in stage.lengths/sec.
 
-  Vector2 mMouseWheelScrollDistanceStep;        ///< The step of scroll distance in actor coordinates in X and Y axes for each mouse wheel event received.
+  Vector2 mWheelScrollDistanceStep;        ///< The step of scroll distance in actor coordinates in X and Y axes for each wheel event received.
 
   //ScrollInternalConstraintsPtr mScrollInternalConstraints;
-  ActiveConstraint mScrollMainInternalPrePositionConstraint;
-  ActiveConstraint mScrollMainInternalPositionConstraint;
-  ActiveConstraint mScrollMainInternalXConstraint;
-  ActiveConstraint mScrollMainInternalYConstraint;
-  ActiveConstraint mScrollMainInternalOvershootXConstraint;
-  ActiveConstraint mScrollMainInternalOvershootYConstraint;
-  ActiveConstraint mScrollMainInternalDeltaConstraint;
-  ActiveConstraint mScrollMainInternalFinalConstraint;
-  ActiveConstraint mScrollMainInternalRelativeConstraint;
+  Constraint mScrollMainInternalPrePositionConstraint;
+  Constraint mScrollMainInternalPositionConstraint;
+  Constraint mScrollMainInternalOvershootXConstraint;
+  Constraint mScrollMainInternalOvershootYConstraint;
+  Constraint mScrollMainInternalDeltaConstraint;
+  Constraint mScrollMainInternalFinalConstraint;
+  Constraint mScrollMainInternalRelativeConstraint;
+  Constraint mScrollMainInternalDomainConstraint;
+  Constraint mScrollMainInternalPrePositionMaxConstraint;
 
   ScrollOvershootIndicatorPtr mOvershootIndicator;
 
-  Toolkit::ScrollView::SnapStartedSignalV2 mSnapStartedSignalV2;
+  Toolkit::ScrollView::SnapStartedSignalType mSnapStartedSignal;
+
+  bool mInAccessibilityPan:1;             ///< With AccessibilityPan its easier to move between snap positions
+  bool mScrolling:1;                      ///< Flag indicating whether the scroll view is being scrolled (by user or animation)
+  bool mScrollInterrupted:1;              ///< Flag set for when a down event interrupts a scroll
+  bool mPanning:1;                        ///< Whether scroll view is currently panning or not
+  bool mSensitive:1;                      ///< Scroll Sensitivity Flag.
+  bool mTouchDownTimeoutReached:1;        ///< Indicates when down event timeout occured without corresponding up event (touch still down)
+  bool mActorAutoSnapEnabled:1;           ///< Whether to automatically snap to closest actor.
+  bool mAutoResizeContainerEnabled:1;     ///< Whether to automatically resize container (affects RulerDomain's on X/Y axes)
+  bool mWrapMode:1;                       ///< Whether to wrap contents based on container size.
+  bool mAxisAutoLock:1;                   ///< Whether to automatically lock axis when panning.
+  bool mAlterChild:1;                     ///< Internal flag to control behavior of OnChildAdd/OnChildRemove when Adding internal Actors.
+  bool mDefaultMaxOvershoot:1;            ///< Whether to use default max overshoot or application defined one
+  bool mCanScrollHorizontal:1;            ///< Local value of our property to check against
+  bool mCanScrollVertical:1;              ///< Local value of our property to check against
 };
 
 } // namespace Internal