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

Border gets drawn outside of bounds #47

Open
RojS opened this issue Jan 31, 2017 · 2 comments
Open

Border gets drawn outside of bounds #47

RojS opened this issue Jan 31, 2017 · 2 comments
Labels

Comments

@RojS
Copy link

RojS commented Jan 31, 2017

Before “complaining” about small bugs I would like to say thanks for the work you have put into this control, it is a pleasure to use and much appreciated!

This is probably related to Clipped border #34 .
When trying to mimic the border width of 3 pixels of a UISwitch the lineWidth property of the BEMCheckBox was set to 1.5. The image below shows the effect with a square BEMCheckBox.

Note also that the height of the BEMCheckBox was set to the same height as the UISwitch, 31 (62 pixels), and yet the BEMCheckBox is drawn larger than the UISwitch. This also occurs with the width.

screen shot 2017-01-31 at 12 05 24 pm

If the code in pathForBox is changed to

path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0.0 + (_lineWidth / 2.0), 0.0 + (_lineWidth / 2.0), self.size - _lineWidth, self.size - _lineWidth) cornerRadius:3.0];
and
CGFloat radius = (self.size / 2.0) - (self.lineWidth / 2.0);
respectivley for BEMBoxTypeSquare and BEMBoxTypeCircle.

this results in the expected behaviour.

screen shot 2017-01-31 at 1 22 41 pm

@Boris-Em Boris-Em mentioned this issue Feb 21, 2017
@Boris-Em Boris-Em added the bug label Feb 21, 2017
@Boris-Em
Copy link
Owner

Boris-Em commented Feb 21, 2017

Thank you @RojS for opening this bug and for actually documenting it!
This is definitely a duplicate of #34, but since this issue is much clearer, we'll keep this one.
Would you be interested in submitting a PR to fix it?
We also need to make sure that the same issue doesn't occur with circled checboxes.

Also, I think that this issue should happen even with even numbers of pixels. I will update the title of the bug to reflect that.

Since this is a breaking change, we'll have to release it as part of v2.0.

@Boris-Em Boris-Em changed the title Borders With Odd Numbers of Pixels Are Not Drawn Correctly Border gets drawn outside of bounds Feb 21, 2017
@danielgindi
Copy link
Contributor

Fixed in #93

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

No branches or pull requests

3 participants