diff --git a/.DS_Store b/.DS_Store index be988d4..f89fc2a 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Source/SideMenuController+CustomTypes.swift b/Source/SideMenuController+CustomTypes.swift index 7b20a92..cd54332 100644 --- a/Source/SideMenuController+CustomTypes.swift +++ b/Source/SideMenuController+CustomTypes.swift @@ -48,6 +48,9 @@ public extension SideMenuController { public var sidePanelWidth: CGFloat = 300 public var centerPanelOverlayColor = UIColor(hue:0.15, saturation:0.21, brightness:0.17, alpha:0.6) public var centerPanelShadow = false + public var sidePanelShadow = false + public var menuButtonSize = CGSize(width: 40, height: 40) + public var menuButtonSeparatorWidth = CGFloat(-10) } public struct Animating { diff --git a/Source/SideMenuController+SideOver.swift b/Source/SideMenuController+SideOver.swift index 70cd2ec..dbdae35 100644 --- a/Source/SideMenuController+SideOver.swift +++ b/Source/SideMenuController+SideOver.swift @@ -105,6 +105,19 @@ extension SideMenuController { } } + func setShadowFromSideMenu(hidden: Bool) { + + guard _preferences.drawing.sidePanelShadow else { + return + } + + if hidden { + sidePanel.layer.shadowOpacity = 0.0 + } else { + sidePanel.layer.shadowOpacity = 0.8 + } + } + func setAboveSidePanel(hidden: Bool, completion: ((Bool) -> ())? = nil){ var destinationFrame = sidePanel.frame diff --git a/Source/SideMenuController.swift b/Source/SideMenuController.swift index a4f1aa9..1b7f40c 100644 --- a/Source/SideMenuController.swift +++ b/Source/SideMenuController.swift @@ -205,6 +205,17 @@ open class SideMenuController: UIViewController, UIGestureRecognizerDelegate { // MARK: - Configurations - + func configureSideMenuShadow() { + guard _preferences.drawing.sidePanelShadow else { + return + } + sidePanel.layer.shadowOffset = CGSize(width: 18, height: 0) + sidePanel.layer.shadowRadius = 20 + sidePanel.layer.shadowOpacity = 0.9 + sidePanel.layer.shadowColor = UIColor.black.cgColor + sidePanel.layer.masksToBounds = false + } + func repositionViews() { if sidePanelVisible { @@ -242,6 +253,7 @@ open class SideMenuController: UIViewController, UIGestureRecognizerDelegate { sidePanel = UIView(frame: sidePanelFrame) view.addSubview(sidePanel) sidePanel.clipsToBounds = true + configureSideMenuShadow() if sidePanelPosition.isPositionedUnder { view.sendSubview(toBack: sidePanel) @@ -305,6 +317,7 @@ open class SideMenuController: UIViewController, UIGestureRecognizerDelegate { }else if !display { centerPanelOverlay.removeFromSuperview() } + setShadowFromSideMenu(hidden: !display) } else { setSideShadow(hidden: !display) } diff --git a/Source/UIKitExtensions.swift b/Source/UIKitExtensions.swift index 529c08a..6050dc8 100644 --- a/Source/UIKitExtensions.swift +++ b/Source/UIKitExtensions.swift @@ -43,7 +43,8 @@ public extension UINavigationController { return } - let button = UIButton(frame: CGRect(x: 0, y: 0, width: 40, height: 40)) + let buttonSize = SideMenuController.preferences.drawing.menuButtonSize + let button = UIButton(frame: CGRect(x: 0, y: 0, width: buttonSize.width, height: buttonSize.height)) button.accessibilityIdentifier = SideMenuController.preferences.interaction.menuButtonAccessibilityIdentifier button.setImage(image, for: .normal) button.addTarget(sideMenuController, action: #selector(SideMenuController.toggle), for: UIControlEvents.touchUpInside) @@ -75,7 +76,7 @@ public extension UINavigationController { item.customView = button let spacer = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.fixedSpace, target: nil, action: nil) - spacer.width = -10 + spacer.width = SideMenuController.preferences.drawing.menuButtonSeparatorWidth items.append(contentsOf: positionLeft ? [spacer, item] : [item, spacer]) return items