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

click outside available #160

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

yatch999
Copy link

Hi, I've updated outside tap to close menu.
This edit points are 3.

clickOutsideClose : Bool (default = true)

it switches outside click availability.
This function add a clear view.
If you hope to avoid it, set clickOutsideClose = false.

evanz,
Please check it.
My editor add some a space, it makes many change point... So bad and excuse me.



// EXTEND 1/3 : Hide menu option
public let clickOutsideClose: Bool = true
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to specify type if default value is assigned


// EXTEND 1/3 : Hide menu option
public let clickOutsideClose: Bool = true
public let outerView: UIView = UIView()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. why it's public?


// EXTEND 2/3: Hide menu option
if clickOutsideClose == true {
outerView.frame = CGRect(x: sideMenuContainerView.frame.width, y: 0, width: sourceView.frame.width - sideMenuContainerView.frame.width, height: sourceView.frame.height)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sideMenuContainerView's width can be updated dynamically (see menuWidth setter). in this case frame of outerView's frame will be incorrect.

if clickOutsideClose == true {
outerView.isUserInteractionEnabled = shouldOpen
}
// EXTEND END 3/3 : Hide menu option
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the explanation comments, but it's not needed after review 😉

fileprivate func toggleMenu (_ shouldOpen: Bool) {

// EXTEND 3/3 : Hide menu option
if clickOutsideClose == true {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

== true part is not needed

@yatch999
Copy link
Author

yatch999 commented Feb 5, 2017

Hi evanz,
thanks to your comments.
I agree all your review points.

Some guys like to implement "Click outside to Close menu", my code is only integrate in the past topics. (And my local project customize these points.)

Now, I received Pull Request for MY Folk from yours.
Can I keep and maintain these actions?
It will not make any impacts to your original codes.

Handlers for different menu side and custom side menu frame were added.
@bohachevskyy bohachevskyy mentioned this pull request Mar 5, 2017
@OxyFlax
Copy link

OxyFlax commented Aug 17, 2017

@yatch999 Thank you very much for your Pull Request! :) But in the future please make sure the commit doesn't have all those useless lines modifications like new spaces or removing spaces. It's a waste of time :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants