File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
ECSlidingViewController/Vendor/ECSlidingViewController Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,12 @@ typedef enum {
159
159
*/
160
160
@property (nonatomic , assign ) ECResetStrategy resetStrategy;
161
161
162
+ /* * Returns the X-axis velocity threshold used for determining whether or not to process a pan to the left or right
163
+
164
+ By default, this is set to 100
165
+ */
166
+ @property (nonatomic , assign ) NSUInteger panningVelocityXThreshold;
167
+
162
168
/* * Returns a horizontal panning gesture for moving the top view.
163
169
164
170
This is typically added to the top view or a top view's navigation bar.
Original file line number Diff line number Diff line change @@ -181,6 +181,7 @@ - (void)viewDidLoad
181
181
_panGesture = [[UIPanGestureRecognizer alloc ] initWithTarget: self action: @selector (updateTopViewHorizontalCenterWithRecognizer: )];
182
182
self.resetTapGesture .enabled = NO ;
183
183
self.resetStrategy = ECTapping | ECPanning;
184
+ self.panningVelocityXThreshold = 100 ;
184
185
185
186
self.topViewSnapshot = [[UIView alloc ] initWithFrame: self .topView.bounds];
186
187
[self .topViewSnapshot setAutoresizingMask: self .autoResizeToFillScreen];
@@ -273,9 +274,9 @@ - (void)updateTopViewHorizontalCenterWithRecognizer:(UIPanGestureRecognizer *)re
273
274
CGPoint currentVelocityPoint = [recognizer velocityInView: self .view];
274
275
CGFloat currentVelocityX = currentVelocityPoint.x ;
275
276
276
- if ([self underLeftShowing ] && currentVelocityX > 100 ) {
277
+ if ([self underLeftShowing ] && currentVelocityX > self. panningVelocityXThreshold ) {
277
278
[self anchorTopViewTo: ECRight];
278
- } else if ([self underRightShowing ] && currentVelocityX < 100 ) {
279
+ } else if ([self underRightShowing ] && currentVelocityX <= self. panningVelocityXThreshold ) {
279
280
[self anchorTopViewTo: ECLeft];
280
281
} else {
281
282
[self resetTopView ];
You can’t perform that action at this time.
0 commit comments