Skip to content

Commit

Permalink
fixed tapView frame
Browse files Browse the repository at this point in the history
  • Loading branch information
andreybuksha committed Oct 1, 2018
1 parent bea93a2 commit 4085467
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>LMCSideMenu.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
Expand Down
1 change: 1 addition & 0 deletions LMCSideMenu/LMCSideMenuCenterControllerProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public extension LMCSideMenuCenterControllerProtocol {
}

func transitionMenu(to size: CGSize, coordinator: UIViewControllerTransitionCoordinator) {
guard interactor.shouldAdjustmenu else { return }
interactor.prepareForAdjustement()
coordinator.animate(alongsideTransition: { [weak self] context in
self?.interactor.adjustMenu(to: size)
Expand Down
2 changes: 1 addition & 1 deletion LMCSideMenu/MenuPresentAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extension MenuPresentAnimator: UIViewControllerAnimatedTransitioning {
if interactor.menuPosition == .left {
tapViewFrame = CGRect(x: toVc.view.frame.maxX, y: toVc.view.frame.minY, width: tapViewWidth, height: toVc.view.frame.height)
} else {
tapViewFrame = CGRect(x: toVc.view.frame.minX - toVc.view.frame.width, y: toVc.view.frame.minY, width: tapViewWidth, height: toVc.view.frame.height)
tapViewFrame = CGRect(x: 0, y: 0, width: tapViewWidth, height: toVc.view.frame.height)
}

interactor.addTapView(to: containerView, wtih: tapViewFrame)
Expand Down
8 changes: 6 additions & 2 deletions LMCSideMenu/MenuTransitionInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public class MenuTransitionInteractor: UIPercentDrivenInteractiveTransition {

var menuPosition: SideMenuPosition = .left

public var shouldAdjustmenu: Bool {
return leftMenuController?.viewIfLoaded?.window != nil || rightMenuController?.viewIfLoaded?.window != nil
}

private weak var tapView: UIView?

override public init() {
Expand Down Expand Up @@ -102,15 +106,15 @@ public class MenuTransitionInteractor: UIPercentDrivenInteractiveTransition {
tapView.frame = tapViewFrame
blurView?.frame = tapViewFrame

centerController?.view.frame.size = size

if menuPosition == .right {
menuView.frame.origin.x = size.width - menuView.frame.width
}

}

internal func completeAdjusting(to size: CGSize) {

centerController?.view.frame.size = size

guard let tapView = self.tapView else { return }
guard let containerView = tapView.superview else { return }
Expand Down

0 comments on commit 4085467

Please sign in to comment.