Skip to content

Commit b511f4b

Browse files
add presenter property
1 parent ea57cb2 commit b511f4b

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

samples/FluidHostPage.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,26 @@ public class FluidHostPage : ContentPage, IFluidHost
77
{
88
private int _zIndex = 0;
99
private View? _currentView;
10-
private readonly AbsoluteLayout _root = [];
10+
private readonly AbsoluteLayout _presenter = [];
11+
1112
public FluidHostPage()
1213
{
13-
Content = _root = [];
14+
Content = _presenter = [];
1415
Loaded += (_, _) => FlowNavigation.Current.Initialize(this);
1516
SizeChanged += (_, _) => _currentView?.Size(Width, Height);
17+
18+
Presenter = _presenter;
1619
}
20+
21+
public View Presenter { get; }
22+
1723
public void ShowView(View view)
1824
{
1925
view.ZIndex = _zIndex++;
2026
view.WidthRequest = Width;
2127
view.HeightRequest = Height;
2228
_currentView = view;
23-
if (!_root.Children.Contains(view))
24-
_root.Children.Add(view);
29+
if (!_presenter.Children.Contains(view))
30+
_presenter.Children.Add(view);
2531
}
2632
}

src/FlowExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static T OnTapped<T>(this T view, Action<Point> action) where T : Content
7878

7979
tapGesture.Tapped += (s, e) =>
8080
{
81-
var p = e.GetPosition((Page)FlowNavigation.Current.View);
81+
var p = e.GetPosition(FlowNavigation.Current.View.Presenter);
8282
var p0 = e.GetPosition(view.Content);
8383

8484
if (p is null || p0 is null) return;

src/IFluidHost.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ public interface IFluidHost
1515
/// </summary>
1616
double Height { get; }
1717

18+
/// <summary>
19+
/// Gets the presenter.
20+
/// </summary>
21+
View Presenter { get; }
22+
1823
/// <summary>
1924
/// Shows the specified view.
2025
/// </summary>

0 commit comments

Comments
 (0)