ScrollView - Fix wrapping issue in FixedRuler::GetPageFromPosition
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / controls / scrollable / scroll-view / scroll-view.cpp
index 69db853..ca6bb4f 100644 (file)
  *
  */
 
-#include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
+// CLASS HEADER
 #include <dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/scrollable/scrollable.h>
 #include <dali-toolkit/internal/controls/scrollable/scroll-view/scroll-view-impl.h>
 
 using namespace Dali;
@@ -233,6 +239,10 @@ unsigned int FixedRuler::GetPageFromPosition(float position, bool wrap) const
   // spacing must be present.
   if(mEnabled && fabsf(mSpacing) > Math::MACHINE_EPSILON_1)
   {
+    if( wrap )
+    {
+      position = WrapInDomain(position, mDomain.min, mDomain.max);
+    }
     page = floor((position - mDomain.min) / mSpacing + 0.5f);
 
     if(wrap)
@@ -385,12 +395,12 @@ void ScrollView::SetRulerY(RulerPtr ruler)
 
 void ScrollView::SetRulerScaleX(RulerPtr ruler)
 {
-  GetImpl(*this).SetRulerScaleX(ruler);
+  DALI_LOG_ERROR( "Deprecated" );
 }
 
 void ScrollView::SetRulerScaleY(RulerPtr ruler)
 {
-  GetImpl(*this).SetRulerScaleY(ruler);
+  DALI_LOG_ERROR( "Deprecated" );
 }
 
 void ScrollView::SetScrollSensitive(bool sensitive)
@@ -438,6 +448,16 @@ void ScrollView::SetRefreshInterval(int milliseconds)
   GetImpl(*this).SetRefreshInterval(milliseconds);
 }
 
+int ScrollView::GetScrollUpdateDistance() const
+{
+  return GetImpl(*this).GetScrollUpdateDistance();
+}
+
+void ScrollView::SetScrollUpdateDistance(int distance)
+{
+  GetImpl(*this).SetScrollUpdateDistance(distance);
+}
+
 bool ScrollView::GetAxisAutoLock() const
 {
   return GetImpl(*this).GetAxisAutoLock();
@@ -478,6 +498,26 @@ void ScrollView::SetFlickSpeedCoefficient(float speed)
   GetImpl(*this).SetFlickSpeedCoefficient(speed);
 }
 
+Vector2 ScrollView::GetMinimumDistanceForFlick() const
+{
+  return GetImpl(*this).GetMinimumDistanceForFlick();
+}
+
+void ScrollView::SetMinimumDistanceForFlick( const Vector2& distance )
+{
+  GetImpl(*this).SetMinimumDistanceForFlick(distance);
+}
+
+float ScrollView::GetMinimumSpeedForFlick() const
+{
+  return GetImpl(*this).GetMinimumSpeedForFlick();
+}
+
+void ScrollView::SetMinimumSpeedForFlick( float speed )
+{
+  GetImpl(*this).SetMinimumSpeedForFlick(speed);
+}
+
 float ScrollView::GetMaxFlickSpeed() const
 {
   return GetImpl(*this).GetMaxFlickSpeed();
@@ -510,7 +550,8 @@ void ScrollView::SetScrollPosition(const Vector3& position)
 
 Vector3 ScrollView::GetCurrentScrollScale() const
 {
-  return GetImpl(*this).GetCurrentScrollScale();
+  DALI_LOG_ERROR( "Deprecated" );
+  return Vector3::ONE;
 }
 
 unsigned int ScrollView::GetCurrentPage() const
@@ -520,12 +561,16 @@ unsigned int ScrollView::GetCurrentPage() const
 
 void ScrollView::TransformTo(const Vector3& position, const Vector3& scale, float rotation)
 {
-  GetImpl(*this).TransformTo(position, scale, rotation);
+  DALI_LOG_ERROR( "Deprecated" );
+
+  GetImpl(*this).TransformTo(position);
 }
 
 void ScrollView::TransformTo(const Vector3& position, const Vector3& scale, float rotation, float duration)
 {
-  GetImpl(*this).TransformTo(position, scale, rotation, duration);
+  DALI_LOG_ERROR( "Deprecated" );
+
+  GetImpl(*this).TransformTo(position, duration);
 }
 
 void ScrollView::ScrollTo(const Vector3 &position)
@@ -576,12 +621,12 @@ bool ScrollView::ScrollToSnapPoint()
 
 void ScrollView::ScaleTo(const Vector3 &scale)
 {
-  GetImpl(*this).ScaleTo(scale);
+  DALI_LOG_ERROR( "Deprecated" );
 }
 
 void ScrollView::ScaleTo(const Vector3 &scale, float duration)
 {
-  GetImpl(*this).ScaleTo(scale, duration);
+  DALI_LOG_ERROR( "Deprecated" );
 }
 
 void ScrollView::ApplyConstraintToChildren(Constraint constraint)