Merge branch 'feature/edit_swipe_percentage' into 'develop'

allow user to overrise pannable Percentage value

See merge request BPHV_MIPS/mvm_core_ui!57
This commit is contained in:
Pan, Xinlei (Ryan) 2019-05-01 14:07:38 -04:00
commit 90a44c90a8
2 changed files with 6 additions and 4 deletions

View File

@ -25,6 +25,9 @@
// true while panning
@property (nonatomic) BOOL panning;
//set pannable percentage 0 to 1
@property (nonatomic) CGFloat pannablePercentage;
// can be used to keep track of if we are ..
@property (nonatomic) BOOL interactive;

View File

@ -8,8 +8,6 @@
#import "MFTabBarInteractor.h"
static CGFloat pannablePercentage = 0.15;
typedef NS_ENUM(NSUInteger, MFTabBarPanningDirection) {
MFTabBarPanningDirectionLeft,
MFTabBarPanningDirectionRight
@ -33,6 +31,7 @@ typedef NS_ENUM(NSUInteger, MFTabBarPanningDirection) {
- (nullable instancetype)initWithViewController:(nullable UIViewController *)viewController delegate:(nullable id<MFSwipeNavigationProtocol>)delegate {
if (self = [super init]) {
self.pannablePercentage = 0.15;
self.panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)];
[viewController.view addGestureRecognizer:self.panGesture];
self.delegate = delegate;
@ -48,8 +47,8 @@ typedef NS_ENUM(NSUInteger, MFTabBarPanningDirection) {
// Simulates an edge gesture by only accepting pans at the edge of the screen. Needed because edge gesture doesn't work nicely with extended menus such as on ipad.
CGRect frame = pan.view.frame;
CGRect pannableFrameLeft = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width*pannablePercentage, frame.size.height);
CGRect pannableFrameRight = CGRectMake(frame.origin.x + frame.size.width*(1-pannablePercentage), frame.origin.y, frame.size.width*pannablePercentage, frame.size.height);
CGRect pannableFrameLeft = CGRectMake(frame.origin.x, frame.origin.y, frame.size.width*self.pannablePercentage, frame.size.height);
CGRect pannableFrameRight = CGRectMake(frame.origin.x + frame.size.width*(1-self.pannablePercentage), frame.origin.y, frame.size.width*self.pannablePercentage, frame.size.height);
switch (pan.state) {
case UIGestureRecognizerStateBegan: