File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,16 @@ public struct JoystickGestureRecognizer: ViewModifier {
101
101
self . emitPosition ( for: . zero)
102
102
}
103
103
} )
104
+ . exclusively (
105
+ before:
106
+ LongPressGesture ( minimumDuration: 0.0 , maximumDistance: 0.0 )
107
+ . onEnded ( { _ in
108
+ if !locksInPlace {
109
+ self . thumbPosition = self . midPoint
110
+ self . emitPosition ( for: . zero)
111
+ }
112
+ } )
113
+ )
104
114
)
105
115
}
106
116
@@ -109,7 +119,7 @@ public struct JoystickGestureRecognizer: ViewModifier {
109
119
/// - parameter content: The view for which to apply the Joystick listener/DragGesture
110
120
public func circleBody( _ content: Content ) -> some View {
111
121
content
112
- . contentShape ( Rectangle ( ) )
122
+ . contentShape ( Circle ( ) )
113
123
. gesture (
114
124
DragGesture ( minimumDistance: 0 , coordinateSpace: . local)
115
125
. onChanged ( ) { value in
@@ -133,6 +143,16 @@ public struct JoystickGestureRecognizer: ViewModifier {
133
143
self . emitPosition ( for: . zero)
134
144
}
135
145
} )
146
+ . exclusively (
147
+ before:
148
+ LongPressGesture ( minimumDuration: 0.0 , maximumDistance: 0.0 )
149
+ . onEnded ( { _ in
150
+ if !locksInPlace {
151
+ self . thumbPosition = self . midPoint
152
+ self . emitPosition ( for: . zero)
153
+ }
154
+ } )
155
+ )
136
156
)
137
157
}
138
158
}
You can’t perform that action at this time.
0 commit comments