From: JoogabYun <40262755+JoogabYun@users.noreply.github.com> Date: Mon, 7 Jun 2021 03:03:43 +0000 (+0900) Subject: [NUI] Add NeedGesturePropagation (#3130) X-Git-Tag: accepted/tizen/unified/20231205.024657~1794 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=133c3bde6ffcdb6f93aa00f1443462b799528570;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Add NeedGesturePropagation (#3130) This is used when the parent view wants to listen to gesture events. --- diff --git a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs index 30f871d..9405f47 100755 --- a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs +++ b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs @@ -1325,6 +1325,10 @@ namespace Tizen.NUI.Components 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); + } } private void OnPanGesture(PanGesture panGesture) @@ -1371,6 +1375,7 @@ namespace Tizen.NUI.Components DragOverShootingShadow(totalDisplacementForPan, panGesture.Displacement.Y); } Debug.WriteLineIf(LayoutDebugScrollableBase, "OnPanGestureDetected Continue totalDisplacementForPan:" + totalDisplacementForPan); + } else if (panGesture.State == Gesture.StateType.Finished || panGesture.State == Gesture.StateType.Cancelled) { diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs b/src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs index 9cfc106..70e24a5 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.Actor.cs @@ -140,6 +140,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_GetSuggestedMinimumHeight")] public static extern float GetSuggestedMinimumHeight(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_SetNeedGesturePropagation")] + public static extern float SetNeedGesturePropagation(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); } } } diff --git a/src/Tizen.NUI/src/public/Events/LongPressGestureDetector.cs b/src/Tizen.NUI/src/public/Events/LongPressGestureDetector.cs index 4d4bad1..b615f33 100755 --- a/src/Tizen.NUI/src/public/Events/LongPressGestureDetector.cs +++ b/src/Tizen.NUI/src/public/Events/LongPressGestureDetector.cs @@ -241,6 +241,7 @@ namespace Tizen.NUI { private View view; private LongPressGesture longPressGesture; + private bool handled = true; /// /// View the attached view. @@ -277,6 +278,22 @@ namespace Tizen.NUI longPressGesture = value; } } + + /// + /// Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Handled + { + get => handled; + set + { + handled = value; + Interop.Actor.SetNeedGesturePropagation(View.getCPtr(view), !value); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } } } } diff --git a/src/Tizen.NUI/src/public/Events/PanGestureDetector.cs b/src/Tizen.NUI/src/public/Events/PanGestureDetector.cs index f7228c8..22243f0 100755 --- a/src/Tizen.NUI/src/public/Events/PanGestureDetector.cs +++ b/src/Tizen.NUI/src/public/Events/PanGestureDetector.cs @@ -565,6 +565,7 @@ namespace Tizen.NUI { private View view; private PanGesture panGesture; + private bool handled = true; /// /// The attached view. @@ -601,6 +602,22 @@ namespace Tizen.NUI panGesture = value; } } + + /// + /// Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Handled + { + get => handled; + set + { + handled = value; + Interop.Actor.SetNeedGesturePropagation(View.getCPtr(view), !value); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } } internal class Property diff --git a/src/Tizen.NUI/src/public/Events/PinchGestureDetector.cs b/src/Tizen.NUI/src/public/Events/PinchGestureDetector.cs index 9998ee7..dd73d11 100755 --- a/src/Tizen.NUI/src/public/Events/PinchGestureDetector.cs +++ b/src/Tizen.NUI/src/public/Events/PinchGestureDetector.cs @@ -163,6 +163,7 @@ namespace Tizen.NUI { private View view; private PinchGesture pinchGesture; + private bool handled = true; /// /// The attached view. @@ -199,6 +200,22 @@ namespace Tizen.NUI pinchGesture = value; } } + + /// + /// Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Handled + { + get => handled; + set + { + handled = value; + Interop.Actor.SetNeedGesturePropagation(View.getCPtr(view), !value); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } } } } diff --git a/src/Tizen.NUI/src/public/Events/RotationGestureDetector.cs b/src/Tizen.NUI/src/public/Events/RotationGestureDetector.cs index c7b64a1..f3fb3dd 100755 --- a/src/Tizen.NUI/src/public/Events/RotationGestureDetector.cs +++ b/src/Tizen.NUI/src/public/Events/RotationGestureDetector.cs @@ -163,6 +163,7 @@ namespace Tizen.NUI { private View view; private RotationGesture rotationGesture; + private bool handled = true; /// /// The attached view. @@ -199,6 +200,22 @@ namespace Tizen.NUI rotationGesture = value; } } + + /// + /// Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Handled + { + get => handled; + set + { + handled = value; + Interop.Actor.SetNeedGesturePropagation(View.getCPtr(view), !value); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } } } diff --git a/src/Tizen.NUI/src/public/Events/TapGestureDetector.cs b/src/Tizen.NUI/src/public/Events/TapGestureDetector.cs index 0701419..a657615 100755 --- a/src/Tizen.NUI/src/public/Events/TapGestureDetector.cs +++ b/src/Tizen.NUI/src/public/Events/TapGestureDetector.cs @@ -214,6 +214,7 @@ namespace Tizen.NUI if (_detectedEventHandler != null) { + e.Handled = true; //here we send all data to user event handlers _detectedEventHandler(this, e); } @@ -229,6 +230,7 @@ namespace Tizen.NUI { private View _view; private TapGesture _tapGesture; + private bool handled = true; /// /// The attached view. @@ -265,6 +267,22 @@ namespace Tizen.NUI _tapGesture = value; } } + + /// + /// Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Handled + { + get => handled; + set + { + handled = value; + Interop.Actor.SetNeedGesturePropagation(View.getCPtr(_view), !value); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } } } }