@@ -45,6 +45,8 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE
45
45
46
46
public override void TouchesBegan ( NSSet touches , UIEvent ? evt )
47
47
{
48
+ SetParentTouches ( false ) ;
49
+
48
50
Element . Points . CollectionChanged -= OnPointsCollectionChanged ;
49
51
Element . Points . Clear ( ) ;
50
52
currentPath . RemoveAllPoints ( ) ;
@@ -65,16 +67,6 @@ public override void TouchesMoved(NSSet touches, UIEvent? evt)
65
67
AddPointToPath ( currentPoint ) ;
66
68
}
67
69
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
-
78
70
public override void TouchesEnded ( NSSet touches , UIEvent ? evt )
79
71
{
80
72
UpdatePath ( ) ;
@@ -86,16 +78,32 @@ public override void TouchesEnded(NSSet touches, UIEvent? evt)
86
78
87
79
if ( Element . ClearOnFinish )
88
80
Element . Points . Clear ( ) ;
81
+
82
+ SetParentTouches ( true ) ;
89
83
}
90
84
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
+ }
92
90
93
91
public override void Draw ( CGRect rect )
94
92
{
95
93
lineColor ! . SetStroke ( ) ;
96
94
currentPath . Stroke ( ) ;
97
95
}
98
96
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
+
99
107
void LoadPoints ( )
100
108
{
101
109
var stylusPoints = Element . Points . Select ( point => new CGPoint ( point . X , point . Y ) ) . ToList ( ) ;
@@ -211,5 +219,18 @@ protected override void Dispose(bool disposing)
211
219
212
220
base . Dispose ( disposing ) ;
213
221
}
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
+ }
214
235
}
215
236
}
0 commit comments