Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the width of the Side Menu for easy layout #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Sources/SideMenu/SideMenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ open class SideMenuController: UIViewController {
}

if let viewToAnimate2 = viewToAnimate2 {
viewToAnimate2.frame.origin.x = viewToAnimate.frame.origin.x - containerWidth * factor
viewToAnimate2.frame.origin.x = viewToAnimate.frame.origin.x - viewToAnimate2.frame.width * factor
}

if shouldShowShadowOnContent {
Expand Down Expand Up @@ -665,14 +665,17 @@ open class SideMenuController: UIViewController {
switch position {
case .above, .sideBySide:
var baseFrame = CGRect(origin: view.frame.origin, size: targetSize ?? view.frame.size)
if !preferences.basic.enableRubberEffectWhenPanning {
baseFrame.size.width = preferences.basic.menuWidth
}
if visibility {
baseFrame.origin.x = preferences.basic.menuWidth - baseFrame.width
} else {
baseFrame.origin.x = -baseFrame.width
baseFrame.origin.x = -baseFrame.width - 8//Hide shadow
}
let factor: CGFloat = adjustedDirection == .left ? 1 : -1
baseFrame.origin.x *= factor
return CGRect(origin: baseFrame.origin, size: targetSize ?? baseFrame.size)
return baseFrame
case .under:
return CGRect(origin: view.frame.origin, size: targetSize ?? view.frame.size)
}
Expand Down