diff --git a/src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs b/src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs index d51b09fc5342..8acd34d9ea40 100644 --- a/src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs +++ b/src/Uno.UI/UI/Xaml/Controls/ScrollViewer/ScrollViewer.cs @@ -111,7 +111,7 @@ public ScrollViewer() { DefaultStyleKey = typeof(ScrollViewer); -#if !__SKIA__ +#if !UNO_HAS_MANAGED_SCROLL_PRESENTER // On Skia, the Scrolling is managed by the ScrollContentPresenter (as UWP), which is flagged as IsScrollPort. // Note: We should still add support for the zoom factor ... which is not yet supported on Skia. // Note 2: This as direct consequences in UIElement.GetTransform and VisualTreeHelper.SearchDownForTopMostElementAt @@ -1266,7 +1266,7 @@ private void Update(bool isIntermediate) UpdatePartial(isIntermediate); -#if !__SKIA__ +#if !UNO_HAS_MANAGED_SCROLL_PRESENTER // Effective viewport support ScrollOffsets = new Point(_pendingHorizontalOffset, _pendingVerticalOffset); InvalidateViewport(); diff --git a/src/Uno.UI/UI/Xaml/Media/VisualTreeHelper.cs b/src/Uno.UI/UI/Xaml/Media/VisualTreeHelper.cs index cd70628f6ee8..b177b4982169 100644 --- a/src/Uno.UI/UI/Xaml/Media/VisualTreeHelper.cs +++ b/src/Uno.UI/UI/Xaml/Media/VisualTreeHelper.cs @@ -250,7 +250,7 @@ internal static IReadOnlyList<_View> ClearChildren(UIElement view) var children = view.ChildrenShadow.ToList(); children.ForEach(v => v.RemoveFromSuperview()); - return children; + return children; #elif UNO_REFERENCE_API var children = GetChildren<_View>(view).ToList(); view.ClearChildren(); @@ -348,7 +348,7 @@ private static (UIElement? element, Branch? stale) SearchDownForTopMostElementAt renderingBounds = parentToElement.Transform(renderingBounds); } -#if !__SKIA__ +#if !UNO_HAS_MANAGED_SCROLL_PRESENTER // On Skia, the Scrolling is managed by the ScrollContentPresenter (as UWP), which is flagged as IsScrollPort. // Note: We should still add support for the zoom factor ... which is not yet supported on Skia. if (element is ScrollViewer sv) @@ -368,11 +368,13 @@ private static (UIElement? element, Branch? stale) SearchDownForTopMostElementAt } else #endif +#if !__MACOS__ // On macOS the SCP is using RenderTransforms for scrolling which has already been included. if (element.IsScrollPort) { posRelToElement.X += element.ScrollOffsets.X; posRelToElement.Y += element.ScrollOffsets.Y; } +#endif TRACE($"- layoutSlot: {layoutSlot.ToDebugString()}"); TRACE($"- renderBounds (relative to element): {renderingBounds.ToDebugString()}"); @@ -566,7 +568,7 @@ public void Deconstruct(out UIElement root, out UIElement leaf) } /// - /// + /// /// /// This method will pass through native element but will enumerate only UIElements /// @@ -585,7 +587,7 @@ public IEnumerable EnumerateLeafToRoot() } yield return current; - } + } } public override string ToString() => $"Root={Root.GetDebugName()} | Leaf={Leaf.GetDebugName()}"; diff --git a/src/Uno.UI/UI/Xaml/UIElement.cs b/src/Uno.UI/UI/Xaml/UIElement.cs index 82cb1d126835..3767b0fa11b1 100644 --- a/src/Uno.UI/UI/Xaml/UIElement.cs +++ b/src/Uno.UI/UI/Xaml/UIElement.cs @@ -239,7 +239,7 @@ internal static Matrix3x2 GetTransform(UIElement from, UIElement to) offsetY = layoutSlot.Y; } -#if !__SKIA__ +#if !UNO_HAS_MANAGED_SCROLL_PRESENTER // On Skia, the Scrolling is managed by the ScrollContentPresenter (as UWP), which is flagged as IsScrollPort. // Note: We should still add support for the zoom factor ... which is not yet supported on Skia. if (elt is ScrollViewer sv) @@ -261,11 +261,13 @@ internal static Matrix3x2 GetTransform(UIElement from, UIElement to) } else #endif +#if !__MACOS__ // On macOS the SCP is using RenderTransforms for scrolling which has already been included. if (elt.IsScrollPort) // Custom scroller { offsetX -= elt.ScrollOffsets.X; offsetY -= elt.ScrollOffsets.Y; } +#endif logInfoString?.Append($"{elt}: ({offsetX}, {offsetY}), "); } while (elt.TryGetParentUIElementForTransformToVisual(out elt, ref offsetX, ref offsetY) && elt != to); // If possible we stop as soon as we reach 'to'