mAxisAutoLockGradient(Toolkit::ScrollView::DEFAULT_AXIS_AUTO_LOCK_GRADIENT),
mFrictionCoefficient(Toolkit::ScrollView::DEFAULT_FRICTION_COEFFICIENT),
mFlickSpeedCoefficient(Toolkit::ScrollView::DEFAULT_FLICK_SPEED_COEFFICIENT),
- mMaxFlickSpeed(Toolkit::ScrollView::DEFAULT_MAX_FLICK_SPEED)
+ mMaxFlickSpeed(Toolkit::ScrollView::DEFAULT_MAX_FLICK_SPEED),
+ mInAccessibilityPan(false)
{
SetRequiresMouseWheelEvents(true);
}
{
horizontal = All;
- if(speed2 > flickSpeedThreshold2) // exceeds flick threshold
+ if( speed2 > flickSpeedThreshold2 || // exceeds flick threshold
+ mInAccessibilityPan ) // With AccessibilityPan its easier to move between snap positions
{
if((angle >= -orthoAngleRange) && (angle < orthoAngleRange)) // Swiping East
{
{
vertical = All;
- if(speed2 > flickSpeedThreshold2) // exceeds flick threshold
+ if( speed2 > flickSpeedThreshold2 || // exceeds flick threshold
+ mInAccessibilityPan ) // With AccessibilityPan its easier to move between snap positions
{
if((angle >= M_PI_2-orthoAngleRange) && (angle < M_PI_2+orthoAngleRange)) // Swiping South
{
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<float>( mPropertyX,
- LocalSource( mPropertyPosition ),
- Source( self, mPropertyPanning ),
- InternalXConstraint );
- mScrollMainInternalXConstraint = self.ApplyConstraint(constraint);
+ if( ! mScrollMainInternalXConstraint )
+ {
+ Constraint constraint = Constraint::New<float>( mPropertyX,
+ LocalSource( mPropertyPosition ),
+ Source( self, mPropertyPanning ),
+ InternalXConstraint );
+ mScrollMainInternalXConstraint = self.ApplyConstraint( constraint );
+ }
+ if( ! mScrollMainInternalYConstraint )
+ {
+ Constraint constraint = Constraint::New<float>( mPropertyY,
+ LocalSource( mPropertyPosition ),
+ Source( self, mPropertyPanning ),
+ InternalYConstraint );
+ mScrollMainInternalYConstraint = self.ApplyConstraint( constraint );
+ }
- constraint = Constraint::New<float>( 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;
// 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;
}
bool ScrollView::OnAccessibilityPan(PanGesture gesture)
{
+ // Keep track of whether this is an AccessibilityPan
+ mInAccessibilityPan = true;
OnPan(gesture);
+ mInAccessibilityPan = false;
+
return true;
}