From c8a7f0fd7506725c645757d4277a6ae0d2935686 Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Fri, 9 Jul 2021 12:01:12 +0900 Subject: [PATCH] [NUI] Change InterceptTouchEvent. --- src/Tizen.NUI.Components/Controls/ScrollableBase.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs index 9405f47..3c894ba 100755 --- a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs +++ b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs @@ -293,10 +293,12 @@ namespace Tizen.NUI.Components if (mScrollEnabled) { mPanGestureDetector.Detected += OnPanGestureDetected; + this.InterceptTouchEvent += OnInterruptTouchingChildTouched; } else { mPanGestureDetector.Detected -= OnPanGestureDetected; + this.InterceptTouchEvent -= OnInterruptTouchingChildTouched; } } } @@ -585,6 +587,7 @@ namespace Tizen.NUI.Components private PropertyNotification propertyNotification; private float noticeAnimationEndBeforePosition = 0.0f; private bool readyToNotice = false; + private bool shouldIntercept = false; /// /// Notice before animation is finished. @@ -635,6 +638,8 @@ namespace Tizen.NUI.Components mPanGestureDetector.AddDirection(PanGestureDetector.DirectionVertical); if (mPanGestureDetector.GetMaximumTouchesRequired() < 2) mPanGestureDetector.SetMaximumTouchesRequired(2); mPanGestureDetector.Detected += OnPanGestureDetected; + //Interrupt touching when panning is started + this.InterceptTouchEvent += OnInterruptTouchingChildTouched; ClippingMode = ClippingModeType.ClipToBoundingBox; @@ -703,7 +708,7 @@ namespace Tizen.NUI.Components StopScroll(); } } - return true; + return shouldIntercept; } private void OnPropertyChanged(object source, PropertyNotification.NotifyEventArgs args) @@ -848,8 +853,6 @@ namespace Tizen.NUI.Components private void OnScrollAnimationEnded() { scrolling = false; - this.InterceptTouchEvent -= OnInterruptTouchingChildTouched; - ScrollEventArgs eventArgs = new ScrollEventArgs(ContentContainer.CurrentPosition); ScrollAnimationEnded?.Invoke(this, eventArgs); } @@ -1030,6 +1033,7 @@ namespace Tizen.NUI.Components mPanGestureDetector.Dispose(); mPanGestureDetector = null; } + this.InterceptTouchEvent -= OnInterruptTouchingChildTouched; propertyNotification.Dispose(); } @@ -1340,9 +1344,8 @@ namespace Tizen.NUI.Components if (panGesture.State == Gesture.StateType.Started) { + shouldIntercept = false; readyToNotice = false; - //Interrupt touching when panning is started - this.InterceptTouchEvent += OnInterruptTouchingChildTouched; AttachOverShootingShadowView(); Debug.WriteLineIf(LayoutDebugScrollableBase, "Gesture Start"); if (scrolling && !SnapToPage) @@ -1354,6 +1357,7 @@ namespace Tizen.NUI.Components } else if (panGesture.State == Gesture.StateType.Continuing) { + shouldIntercept = true; if (ScrollingDirection == Direction.Horizontal) { // if vertical shadow is shown, does not scroll. @@ -1414,6 +1418,7 @@ namespace Tizen.NUI.Components totalDisplacementForPan = 0; scrolling = true; readyToNotice = true; + shouldIntercept = false; OnScrollAnimationStarted(); } } -- 2.7.4