@@ -288,9 +288,9 @@ + (BOOL)viewController:(FRLayerController *)vc xTranslation:(CGFloat)origXTransl
288
288
const FRLayeredNavigationItem *navItem = vc.layeredNavigationItem ;
289
289
const CGPoint initPos = navItem.initialViewPosition ;
290
290
291
+ CGRect f = vc.view .frame ;
291
292
if (bounded) {
292
293
/* apply translation to fancy item position first and then apply to view */
293
- CGRect f = vc.view .frame ;
294
294
f.origin = navItem.currentViewPosition ;
295
295
f.origin .x += origXTranslation;
296
296
@@ -301,7 +301,6 @@ + (BOOL)viewController:(FRLayerController *)vc xTranslation:(CGFloat)origXTransl
301
301
vc.view .frame = f;
302
302
navItem.currentViewPosition = f.origin ;
303
303
} else {
304
- CGRect f = vc.view .frame ;
305
304
CGFloat xTranslation;
306
305
if (f.origin .x < initPos.x && origXTranslation < 0 ) {
307
306
/* if view already left from left bound and still moving left, half moving speed */
@@ -348,7 +347,9 @@ - (void)viewControllersToSnappingPointsMethod:(SnappingPointsMethod)method
348
347
349
348
const CGFloat curDiff = myPos.x - last.layeredNavigationItem .currentViewPosition .x ;
350
349
const CGFloat initDiff = myInitPos.x - last.layeredNavigationItem .initialViewPosition .x ;
351
- const CGFloat maxDiff = CGRectGetWidth (last.view .frame );
350
+ const CGFloat maxDiff = ((last.layeredNavigationItem .snappingDistance >= 0 ) ?
351
+ last.layeredNavigationItem .snappingDistance :
352
+ CGRectGetWidth (last.view .frame ));
352
353
353
354
if (xTranslation == 0 && (CGFloatNotEqual (curDiff, initDiff) && CGFloatNotEqual (curDiff, maxDiff))) {
354
355
switch (method) {
@@ -411,7 +412,9 @@ - (void)moveViewControllersXTranslation:(CGFloat)xTranslationGesture
411
412
412
413
const CGPoint myPos = meNavItem.currentViewPosition ;
413
414
const CGPoint myInitPos = meNavItem.initialViewPosition ;
414
- const CGFloat myWidth = CGRectGetWidth (me.view .frame );
415
+ const CGFloat myWidth = ((meNavItem.snappingDistance >= 0 ) ?
416
+ meNavItem.snappingDistance :
417
+ CGRectGetWidth (me.view .frame ));
415
418
CGPoint myNewPos = myPos;
416
419
417
420
const CGPoint myOldPos = myPos;
0 commit comments