Skip to content

Commit d59a342

Browse files
Daviddr1rrb
authored andcommitted
fix: Fix compilation on macOS
1 parent 7a2589d commit d59a342

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

src/Uno.UI/UI/Xaml/Controls/ScrollContentPresenter/ScrollContentPresenter.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,10 @@ private void OnParentChanged(object instance, object key, DependencyObjectParent
4545
}
4646
}
4747

48-
#if XAMARIN
48+
#if __IOS__ || __ANDROID__
4949
private NativeScrollContentPresenter Native => Content as NativeScrollContentPresenter;
50-
#if !__MACOS__
5150
public ScrollBarVisibility HorizontalScrollBarVisibility => Native?.HorizontalScrollBarVisibility ?? default;
5251
public ScrollBarVisibility VerticalScrollBarVisibility => Native?.VerticalScrollBarVisibility ?? default;
53-
#endif
5452
#endif
5553

5654
bool ILayoutConstraints.IsWidthConstrained(View requester)

src/Uno.UI/UI/Xaml/UIElement.macOS.cs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -143,33 +143,14 @@ private bool TryGetParentUIElementForTransformToVisual(out UIElement parentEleme
143143
case NSView view:
144144
do
145145
{
146-
//If we found an NSClipView, we are assuming that we are inside of an NSScrollView.
147-
//So "skip" past the NSClipView and allow the logic to flow through to the check for NativeScrollContentPresenter
148-
if (view is NSClipView && view.Superview is NativeScrollContentPresenter)
149-
{
150-
parent = view.Superview?.GetParent();
151-
view = view.Superview;
152-
}
153-
else
154-
{
155-
parent = parent?.GetParent();
156-
}
146+
parent = parent?.GetParent();
157147

158148
switch (parent)
159149
{
160150
case UIElement eltParent:
161151
// We found a UIElement in the parent hierarchy, we compute the X/Y offset between the
162152
// first parent 'view' and this 'elt', and return it.
163153

164-
if (view is NativeScrollContentPresenter)
165-
{
166-
// The NativeScrollContentPresenter will include the scroll offset when converting point to coordinates
167-
// space of the parent, but the same scroll offset will be applied by the parent ScrollViewer.
168-
// So as it's not expected to have any transform/margins/etc., we compute offset directly from its parent.
169-
170-
view = view.Superview;
171-
}
172-
173154
var offset = view?.ConvertPointToView(default, eltParent) ?? default;
174155

175156
parentElement = eltParent;

0 commit comments

Comments
 (0)