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 {
101101 self . emitPosition ( for: . zero)
102102 }
103103 } )
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+ )
104114 )
105115 }
106116
@@ -109,7 +119,7 @@ public struct JoystickGestureRecognizer: ViewModifier {
109119 /// - parameter content: The view for which to apply the Joystick listener/DragGesture
110120 public func circleBody( _ content: Content ) -> some View {
111121 content
112- . contentShape ( Rectangle ( ) )
122+ . contentShape ( Circle ( ) )
113123 . gesture (
114124 DragGesture ( minimumDistance: 0 , coordinateSpace: . local)
115125 . onChanged ( ) { value in
@@ -133,6 +143,16 @@ public struct JoystickGestureRecognizer: ViewModifier {
133143 self . emitPosition ( for: . zero)
134144 }
135145 } )
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+ )
136156 )
137157 }
138158}
You can’t perform that action at this time.
0 commit comments