Commit 6872b35d by Daniel Dahan

removed animating flag

parent 1b93a1a9
...@@ -107,9 +107,6 @@ public protocol SideNavigationViewControllerDelegate { ...@@ -107,9 +107,6 @@ public protocol SideNavigationViewControllerDelegate {
@objc(SideNavigationViewController) @objc(SideNavigationViewController)
public class SideNavigationViewController: UIViewController, UIGestureRecognizerDelegate { public class SideNavigationViewController: UIViewController, UIGestureRecognizerDelegate {
private var animating: Bool = false
/** /**
A CGFloat property that is used internally to track A CGFloat property that is used internally to track
the original (x) position of the container view when panning. the original (x) position of the container view when panning.
...@@ -376,7 +373,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -376,7 +373,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
} }
if animated { if animated {
animating = true
v.shadowPath = nil v.shadowPath = nil
v.shadowPathAutoSizeEnabled = false v.shadowPathAutoSizeEnabled = false
...@@ -388,7 +384,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -388,7 +384,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
self.mainViewController.view.alpha = 1 self.mainViewController.view.alpha = 1
}) { [unowned self] _ in }) { [unowned self] _ in
v.shadowPathAutoSizeEnabled = true v.shadowPathAutoSizeEnabled = true
self.animating = false
self.layoutSubviews() self.layoutSubviews()
self.hideView(v) self.hideView(v)
} }
...@@ -400,7 +395,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -400,7 +395,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
self.mainViewController.view.alpha = 0.5 self.mainViewController.view.alpha = 0.5
}) { [unowned self] _ in }) { [unowned self] _ in
v.shadowPathAutoSizeEnabled = true v.shadowPathAutoSizeEnabled = true
self.animating = false
self.layoutSubviews() self.layoutSubviews()
self.showView(v) self.showView(v)
} }
...@@ -445,7 +439,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -445,7 +439,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
} }
if animated { if animated {
animating = true
v.shadowPath = nil v.shadowPath = nil
v.shadowPathAutoSizeEnabled = false v.shadowPathAutoSizeEnabled = false
...@@ -457,7 +450,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -457,7 +450,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
self.mainViewController.view.alpha = 1 self.mainViewController.view.alpha = 1
}) { [unowned self] _ in }) { [unowned self] _ in
v.shadowPathAutoSizeEnabled = true v.shadowPathAutoSizeEnabled = true
self.animating = false
self.layoutSubviews() self.layoutSubviews()
self.hideView(v) self.hideView(v)
} }
...@@ -469,7 +461,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -469,7 +461,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
self.mainViewController.view.alpha = 0.5 self.mainViewController.view.alpha = 0.5
}) { [unowned self] _ in }) { [unowned self] _ in
v.shadowPathAutoSizeEnabled = true v.shadowPathAutoSizeEnabled = true
self.animating = false
self.layoutSubviews() self.layoutSubviews()
self.showView(v) self.showView(v)
} }
...@@ -927,29 +918,27 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer ...@@ -927,29 +918,27 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
/// Layout subviews. /// Layout subviews.
private func layoutSubviews() { private func layoutSubviews() {
if !animating { toggleStatusBar()
toggleStatusBar()
if let v: MaterialView = leftView { if let v: MaterialView = leftView {
v.width = leftViewWidth v.width = leftViewWidth
v.height = view.bounds.height v.height = view.bounds.height
leftViewThreshold = leftViewWidth / 2 leftViewThreshold = leftViewWidth / 2
if let vc: UIViewController = leftViewController { if let vc: UIViewController = leftViewController {
vc.view.frame.size.width = v.width vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height vc.view.frame.size.height = v.height
vc.view.center = CGPointMake(v.width / 2, v.height / 2) vc.view.center = CGPointMake(v.width / 2, v.height / 2)
}
} }
}
if let v: MaterialView = rightView {
v.width = rightViewWidth if let v: MaterialView = rightView {
v.height = view.bounds.height v.width = rightViewWidth
rightViewThreshold = view.bounds.width - rightViewWidth / 2 v.height = view.bounds.height
if let vc: UIViewController = rightViewController { rightViewThreshold = view.bounds.width - rightViewWidth / 2
vc.view.frame.size.width = v.width if let vc: UIViewController = rightViewController {
vc.view.frame.size.height = v.height vc.view.frame.size.width = v.width
vc.view.center = CGPointMake(v.width / 2, v.height / 2) vc.view.frame.size.height = v.height
} vc.view.center = CGPointMake(v.width / 2, v.height / 2)
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment