@@ -5,8 +5,16 @@ public class FloatingItemGestureRecognizer: UIPanGestureRecognizer {
55 private var gestureGap : CGPoint ?
66 private let margin : CGFloat = 16
77 public enum Edge {
8+ case top
9+ // case center
10+ case bottom
11+
812 case topLeading
913 case topTrailing
14+
15+ case leading
16+ case trailing
17+
1018 case bottomLeading
1119 case bottomTrailing
1220 }
@@ -151,15 +159,35 @@ public class FloatingItemGestureRecognizer: UIPanGestureRecognizer {
151159 let yCenter = targetView. bounds. height / 2
152160 let safeAreaInsets = groundView. safeAreaInsets
153161
162+
163+ let top = CGPoint (
164+ x: viewSize. width / 2 ,
165+ y: self . margin + yCenter + safeAreaInsets. top
166+ )
167+ let bottom = CGPoint (
168+ x: viewSize. width / 2 ,
169+ y: viewSize. height - objectSize. height - self . margin + yCenter - safeAreaInsets. bottom
170+ )
171+
154172 let topLeading = CGPoint (
155173 x: self . margin + xCenter + safeAreaInsets. left,
156174 y: self . margin + yCenter + safeAreaInsets. top
157175 )
158-
159176 let topTrailing = CGPoint (
160177 x: viewSize. width - objectSize. width - self . margin + xCenter - safeAreaInsets. right,
161178 y: self . margin + yCenter + safeAreaInsets. top
162179 )
180+
181+ let leading = CGPoint (
182+ x: self . margin + xCenter + safeAreaInsets. left,
183+ y: viewSize. height / 2
184+ )
185+
186+ let trailing = CGPoint (
187+ x: viewSize. width - objectSize. width - self . margin + xCenter - safeAreaInsets. right,
188+ y: viewSize. height / 2
189+ )
190+
163191 let bottomLeading = CGPoint (
164192 x: self . margin + xCenter + safeAreaInsets. left,
165193 y: viewSize. height - objectSize. height - self . margin + yCenter - safeAreaInsets. bottom
@@ -170,8 +198,15 @@ public class FloatingItemGestureRecognizer: UIPanGestureRecognizer {
170198 y: viewSize. height - objectSize. height - self . margin + yCenter - safeAreaInsets. bottom
171199 )
172200 return [
201+ . top: top,
202+ . bottom: bottom,
203+
173204 . topLeading: topLeading,
174205 . topTrailing: topTrailing,
206+
207+ . leading: leading,
208+ . trailing: trailing,
209+
175210 . bottomLeading: bottomLeading,
176211 . bottomTrailing: bottomTrailing,
177212 ]
0 commit comments