From: joogab.yun Date: Thu, 31 Mar 2022 03:26:37 +0000 (+0900) Subject: [NUI] Checks the button area if GrabTouchAfterLeave is true. X-Git-Tag: accepted/tizen/unified/20231205.024657~1074 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8bba9c38627f3f2cab509224f6ad5c73c26b81b9;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Checks the button area if GrabTouchAfterLeave is true. If GrabTouchAfterLeave is true, Button Up will result in Finished rather than Interrupted even if it is out of the button area. So, it is necessary to check whether it is Button Up in the button area. --- diff --git a/src/Tizen.NUI.Components/Controls/Button.Internal.cs b/src/Tizen.NUI.Components/Controls/Button.Internal.cs index 70fe232..decaf67 100644 --- a/src/Tizen.NUI.Components/Controls/Button.Internal.cs +++ b/src/Tizen.NUI.Components/Controls/Button.Internal.cs @@ -176,7 +176,7 @@ namespace Tizen.NUI.Components } ClickedEventArgs eventArgs = new ClickedEventArgs(); - OnClickedInternal(eventArgs); + OnClickedInternal(eventArgs, touch); return true; } @@ -454,6 +454,23 @@ namespace Tizen.NUI.Components } } + private void OnClickedInternal(ClickedEventArgs eventArgs, Touch touch) + { + // If GrabTouchAfterLeave is true, Up will result in Finished rather than Interrupted even if it is out of the button area. + // So, it is necessary to check whether it is Up in the button area. + if (GrabTouchAfterLeave == true) + { + Vector2 localPosition = touch.GetLocalPosition(0); + if ((localPosition != null && Size != null && + 0 <= localPosition.X && localPosition.X <= Size.Width && + 0 <= localPosition.Y && localPosition.Y <= Size.Height) == false) + { + return; + } + } + OnClickedInternal(eventArgs); + } + private void OnClickedInternal(ClickedEventArgs eventArgs) { Command?.Execute(CommandParameter);