@@ -45,6 +45,8 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE
4545
4646 public override void TouchesBegan ( NSSet touches , UIEvent ? evt )
4747 {
48+ SetParentTouches ( false ) ;
49+
4850 Element . Points . CollectionChanged -= OnPointsCollectionChanged ;
4951 Element . Points . Clear ( ) ;
5052 currentPath . RemoveAllPoints ( ) ;
@@ -65,16 +67,6 @@ public override void TouchesMoved(NSSet touches, UIEvent? evt)
6567 AddPointToPath ( currentPoint ) ;
6668 }
6769
68- void AddPointToPath ( CGPoint currentPoint )
69- {
70- currentPath . AddLineTo ( currentPoint ) ;
71- SetNeedsDisplay ( ) ;
72- Element . Points . CollectionChanged -= OnPointsCollectionChanged ;
73- var point = currentPoint . ToPoint ( ) ;
74- Element . Points . Add ( point ) ;
75- Element . Points . CollectionChanged += OnPointsCollectionChanged ;
76- }
77-
7870 public override void TouchesEnded ( NSSet touches , UIEvent ? evt )
7971 {
8072 UpdatePath ( ) ;
@@ -86,16 +78,32 @@ public override void TouchesEnded(NSSet touches, UIEvent? evt)
8678
8779 if ( Element . ClearOnFinish )
8880 Element . Points . Clear ( ) ;
81+
82+ SetParentTouches ( true ) ;
8983 }
9084
91- public override void TouchesCancelled ( NSSet touches , UIEvent ? evt ) => InvokeOnMainThread ( SetNeedsDisplay ) ;
85+ public override void TouchesCancelled ( NSSet touches , UIEvent ? evt )
86+ {
87+ InvokeOnMainThread ( SetNeedsDisplay ) ;
88+ SetParentTouches ( true ) ;
89+ }
9290
9391 public override void Draw ( CGRect rect )
9492 {
9593 lineColor ! . SetStroke ( ) ;
9694 currentPath . Stroke ( ) ;
9795 }
9896
97+ void AddPointToPath ( CGPoint currentPoint )
98+ {
99+ currentPath . AddLineTo ( currentPoint ) ;
100+ SetNeedsDisplay ( ) ;
101+ Element . Points . CollectionChanged -= OnPointsCollectionChanged ;
102+ var point = currentPoint . ToPoint ( ) ;
103+ Element . Points . Add ( point ) ;
104+ Element . Points . CollectionChanged += OnPointsCollectionChanged ;
105+ }
106+
99107 void LoadPoints ( )
100108 {
101109 var stylusPoints = Element . Points . Select ( point => new CGPoint ( point . X , point . Y ) ) . ToList ( ) ;
@@ -211,5 +219,18 @@ protected override void Dispose(bool disposing)
211219
212220 base . Dispose ( disposing ) ;
213221 }
222+
223+ void SetParentTouches ( bool enabled )
224+ {
225+ var parent = Superview ;
226+
227+ while ( parent != null )
228+ {
229+ if ( parent . GetType ( ) == typeof ( ScrollViewRenderer ) )
230+ ( ( ScrollViewRenderer ) parent ) . ScrollEnabled = enabled ;
231+
232+ parent = parent . Superview ;
233+ }
234+ }
214235 }
215236}
0 commit comments