ScrollView - Fix wrapping issue in FixedRuler::GetPageFromPosition 98/24198/1
authorJulien Heanley <j.heanley@partner.samsung.com>
Mon, 30 Jun 2014 09:51:33 +0000 (10:51 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Tue, 8 Jul 2014 17:48:00 +0000 (18:48 +0100)
[problem]      Incorrect page would be returned from FixedRuler::GatePageFromPosition when continuously panning right
[cause]        An unwrapped value is passed in since the scrolling never finishes
[solution]     Wrap the value internally before checking position against domain size

Change-Id: I4eaad7a2bfc7c711b53ed310372fd85f6ee77bfb
Signed-off-by: Julien Heanley <j.heanley@partner.samsung.com>
Signed-off-by: Adeel Kazmi <adeel.kazmi@samsung.com>
base/dali-toolkit/public-api/controls/scrollable/scroll-view/scroll-view.cpp

index db5797e7be2d33b1a7113ee07102fec62e20e8b7..ca6bb4f52fae770e71db0b7f7f16bbdb1d87f449 100644 (file)
@@ -239,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)