From da6e2d6c726e6f18a0ddd29045de83e285ea6a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=8A=B9=EA=B7=BC/Common=20Platform=20Lab=28SR?= =?UTF-8?q?=29/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 29 Mar 2022 14:54:19 +0900 Subject: [PATCH] Fix CascadeInputTransparent (#442) --- .../src/Core/HandlerImpl/Layout/Layout.Tizen.cs | 17 ++++++++++------- src/Core/src/Platform/Tizen/LayoutViewGroup.cs | 8 ++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/Controls/src/Core/HandlerImpl/Layout/Layout.Tizen.cs b/src/Controls/src/Core/HandlerImpl/Layout/Layout.Tizen.cs index 6d63515bf727..1e7a050af2d2 100644 --- a/src/Controls/src/Core/HandlerImpl/Layout/Layout.Tizen.cs +++ b/src/Controls/src/Core/HandlerImpl/Layout/Layout.Tizen.cs @@ -4,19 +4,22 @@ public partial class Layout { public static void MapInputTransparent(LayoutHandler handler, Layout layout) { + if (handler.PlatformView == null) + return; + if (layout.CascadeInputTransparent) { - handler.PlatformView?.UpdateInputTransparent(handler, layout); + // Sensitive property on NUI View was false, disabled all touch event including children + handler.PlatformView.Sensitive = !layout.InputTransparent; + handler.PlatformView.InputTransparent = false; } else { - // TODO. need to fix - // If CascadeInputTransparent is true, child should be got an event - // But, in NUI, if Container Sensitive was false, children also can't get an event - // So, We can't set Sensitive to false, and we should pass through an event into below view - // To pass through an event, on LayoutHandler.tizen I will ovrride OnHitTest method, and returning false when InputTransparent was true + // InputTransparent property on LayoutViewGroup was false, + // Only LayoutViewGroup event was disabled but children are allowed + handler.PlatformView.InputTransparent = layout.InputTransparent; + handler.PlatformView.Sensitive = true; } - layout.UpdateDescendantInputTransparent(); } } } diff --git a/src/Core/src/Platform/Tizen/LayoutViewGroup.cs b/src/Core/src/Platform/Tizen/LayoutViewGroup.cs index 924cca9144c1..34c12e983c5f 100644 --- a/src/Core/src/Platform/Tizen/LayoutViewGroup.cs +++ b/src/Core/src/Platform/Tizen/LayoutViewGroup.cs @@ -4,6 +4,7 @@ using Rect = Microsoft.Maui.Graphics.Rect; using Size = Microsoft.Maui.Graphics.Size; using TSize = Tizen.UIExtensions.Common.Size; +using TTouch = Tizen.NUI.Touch; namespace Microsoft.Maui.Platform { @@ -26,6 +27,13 @@ public TSize Measure(double availableWidth, double availableHeight) return CrossPlatformMeasure?.Invoke(availableWidth.ToScaledDP(), availableHeight.ToScaledDP()).ToPixel() ?? new TSize(0, 0); } + public bool InputTransparent { get; set; } = false; + + protected override bool HitTest(TTouch touch) + { + return !InputTransparent; + } + void OnLayoutUpdated(object? sender, LayoutEventArgs e) { var platformGeometry = this.GetBounds().ToDP();