Skip to content
This repository was archived by the owner on Aug 10, 2021. It is now read-only.

Commit b16e9c1

Browse files
author
Felix Schulze
committed
Merge branch 'feature/backgroundScaleParameter' of github.com:yoavlt/RESideMenu
2 parents 63685f9 + 8bace60 commit b16e9c1

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

RESideMenu/RESideMenu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxMenuMaximumRelativeValue;
6969
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxContentMinimumRelativeValue;
7070
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxContentMaximumRelativeValue;
71+
@property (assign, readwrite, nonatomic) IBInspectable CGFloat backgroundTransformScale;
7172
@property (assign, readwrite, nonatomic) CGAffineTransform menuViewControllerTransformation;
7273
@property (assign, readwrite, nonatomic) IBInspectable BOOL parallaxEnabled;
7374
@property (assign, readwrite, nonatomic) IBInspectable BOOL bouncesHorizontally;

RESideMenu/RESideMenu.m

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ - (void)commonInit
9999
_parallaxMenuMaximumRelativeValue = 15;
100100
_parallaxContentMinimumRelativeValue = -25;
101101
_parallaxContentMaximumRelativeValue = 25;
102+
103+
_backgroundTransformScale = 1.7;
102104

103105
_bouncesHorizontally = YES;
104106

@@ -234,7 +236,7 @@ - (void)viewDidLoad
234236

235237
self.menuViewContainer.alpha = !self.fadeMenuView ?: 0;
236238
if (self.scaleBackgroundImageView)
237-
self.backgroundImageView.transform = CGAffineTransformMakeScale(1.7f, 1.7f);
239+
self.backgroundImageView.transform = [self backgroundTransformMakeScale];
238240

239241
[self addMenuViewControllerMotionEffects];
240242

@@ -264,7 +266,7 @@ - (void)presentMenuViewContainerWithMenuViewController:(UIViewController *)menuV
264266
}
265267
self.menuViewContainer.alpha = !self.fadeMenuView ?: 0;
266268
if (self.scaleBackgroundImageView)
267-
self.backgroundImageView.transform = CGAffineTransformMakeScale(1.7f, 1.7f);
269+
self.backgroundImageView.transform = [self backgroundTransformMakeScale];
268270

269271
if ([self.delegate conformsToProtocol:@protocol(RESideMenuDelegate)] && [self.delegate respondsToSelector:@selector(sideMenu:willShowMenuViewController:)]) {
270272
[self.delegate sideMenu:self willShowMenuViewController:menuViewController];
@@ -402,7 +404,7 @@ - (void)hideMenuViewControllerAnimated:(BOOL)animated
402404
strongSelf.contentViewContainer.alpha = 1;
403405

404406
if (strongSelf.scaleBackgroundImageView) {
405-
strongSelf.backgroundImageView.transform = CGAffineTransformMakeScale(1.7f, 1.7f);
407+
strongSelf.backgroundImageView.transform = [self backgroundTransformMakeScale];
406408
}
407409
if (strongSelf.parallaxEnabled) {
408410
IF_IOS7_OR_GREATER(
@@ -486,6 +488,11 @@ - (void)resetContentViewScale
486488
self.contentViewContainer.frame = frame;
487489
}
488490

491+
- (CGAffineTransform)backgroundTransformMakeScale
492+
{
493+
return CGAffineTransformMakeScale(self.backgroundTransformScale, self.backgroundTransformScale);
494+
}
495+
489496
#pragma mark -
490497
#pragma mark iOS 7 Motion Effects (Private)
491498

@@ -600,7 +607,7 @@ - (void)panGestureRecognized:(UIPanGestureRecognizer *)recognizer
600607

601608
CGFloat contentViewScale = self.scaleContentView ? 1 - ((1 - self.contentViewScaleValue) * delta) : 1;
602609

603-
CGFloat backgroundViewScale = 1.7f - (0.7f * delta);
610+
CGFloat backgroundViewScale = self.backgroundTransformScale - (0.7f * delta);
604611
CGFloat menuViewScale = 1.5f - (0.5f * delta);
605612

606613
if (!self.bouncesHorizontally) {

0 commit comments

Comments
 (0)