From: Paul Wisbey
Date: Sat, 31 May 2014 03:09:21 +0000 (+0900)
Subject: ScrollView: Avoid unintentional contraints on X/Y properties
X-Git-Tag: dali_1.0.0~77
X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=1df5dd2e4d6f9129cf495e9af612f4fc8bd6afda;hp=16e2b98c54081905fa9e26e017e96672581c9f34
ScrollView: Avoid unintentional contraints on X/Y properties
[problem] Snap animation is not working in homescreen ScrollView
[cause] Whilst the X/Y properties are animated, they are unintentionally
constrained to match the position from previous pan
[solution] More logic to ensure constraints are removed after pan finishes.
---
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 bff54c7..6cd1a37 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
@@ -2143,17 +2143,23 @@ void ScrollView::OnPan(PanGesture gesture)
self.SetProperty( mPropertyScrollStartPagePosition, GetCurrentScrollPosition() );
// Update property: X & Y = Position (only when in panning mode - in snapping mode, X & Y are animated).
- Constraint constraint = Constraint::New( mPropertyX,
- LocalSource( mPropertyPosition ),
- Source( self, mPropertyPanning ),
- InternalXConstraint );
- mScrollMainInternalXConstraint = self.ApplyConstraint(constraint);
+ if( ! mScrollMainInternalXConstraint )
+ {
+ Constraint constraint = Constraint::New( mPropertyX,
+ LocalSource( mPropertyPosition ),
+ Source( self, mPropertyPanning ),
+ InternalXConstraint );
+ mScrollMainInternalXConstraint = self.ApplyConstraint( constraint );
+ }
+ if( ! mScrollMainInternalYConstraint )
+ {
+ Constraint constraint = Constraint::New( mPropertyY,
+ LocalSource( mPropertyPosition ),
+ Source( self, mPropertyPanning ),
+ InternalYConstraint );
+ mScrollMainInternalYConstraint = self.ApplyConstraint( constraint );
+ }
- constraint = Constraint::New( mPropertyY,
- LocalSource( mPropertyPosition ),
- Source( self, mPropertyPanning ),
- InternalYConstraint );
- mScrollMainInternalYConstraint = self.ApplyConstraint(constraint);
// When panning we want to make sure overshoot values are affected by pre position and post position
SetOvershootConstraintsEnabled(true);
break;
@@ -2174,6 +2180,8 @@ void ScrollView::OnPan(PanGesture gesture)
// Remove X & Y position constraints as they are not required when we are not panning.
self.RemoveConstraint(mScrollMainInternalXConstraint);
self.RemoveConstraint(mScrollMainInternalYConstraint);
+ mScrollMainInternalXConstraint.Reset();
+ mScrollMainInternalYConstraint.Reset();
break;
}