If it's a nested scroll, calculate whether the gesture should be sent to the parent.
private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
{
private void OnPanGestureDetected(object source, PanGestureDetector.DetectedEventArgs e)
{
- OnPanGesture(e.PanGesture);
- if(!((SnapToPage && scrollAnimation != null && scrollAnimation.State == Animation.States.Playing) || e.PanGesture.State == Gesture.StateType.Started))
- {
- e.Handled = !((int)finalTargetPosition == 0 || -(int)finalTargetPosition == (int)maxScrollDistance);
- }
+ e.Handled = OnPanGesture(e.PanGesture);
- private void OnPanGesture(PanGesture panGesture)
+ private bool OnPanGesture(PanGesture panGesture)
if (SnapToPage && scrollAnimation != null && scrollAnimation.State == Animation.States.Playing)
{
if (SnapToPage && scrollAnimation != null && scrollAnimation.State == Animation.States.Playing)
{
if (panGesture.State == Gesture.StateType.Started)
{
readyToNotice = false;
if (panGesture.State == Gesture.StateType.Started)
{
readyToNotice = false;
- //Interrupt touching when panning is started
- this.InterceptTouchEvent += OnInterruptTouchingChildTouched;
AttachOverShootingShadowView();
Debug.WriteLineIf(LayoutDebugScrollableBase, "Gesture Start");
if (scrolling && !SnapToPage)
AttachOverShootingShadowView();
Debug.WriteLineIf(LayoutDebugScrollableBase, "Gesture Start");
if (scrolling && !SnapToPage)
StopScroll();
}
totalDisplacementForPan = 0.0f;
StopScroll();
}
totalDisplacementForPan = 0.0f;
+
+ // check if gesture need to propagation
+ var checkDisplacement = (ScrollingDirection == Direction.Horizontal) ? panGesture.Displacement.X : panGesture.Displacement.Y;
+ var checkChildCurrentPosition = (ScrollingDirection == Direction.Horizontal) ? ContentContainer.PositionX : ContentContainer.PositionY;
+ var checkChildTargetPosition = checkChildCurrentPosition + checkDisplacement;
+ var checkFinalTargetPosition = BoundScrollPosition(checkChildTargetPosition);
+ handled = !((int)checkFinalTargetPosition == 0 || -(int)checkFinalTargetPosition == (int)maxScrollDistance);
+ // If you propagate a gesture event, return;
+ if(!handled)
+ {
+ return handled;
+ }
+
+ //Interrupt touching when panning is started
+ this.InterceptTouchEvent += OnInterruptTouchingChildTouched;
OnScrollDragStarted();
}
else if (panGesture.State == Gesture.StateType.Continuing)
OnScrollDragStarted();
}
else if (panGesture.State == Gesture.StateType.Continuing)
readyToNotice = true;
OnScrollAnimationStarted();
}
readyToNotice = true;
OnScrollAnimationStarted();
}
}
internal void BaseRemove(View view)
}
internal void BaseRemove(View view)