Skip to content
This repository has been archived by the owner on Aug 23, 2021. It is now read-only.

Fixing issues on rounded corners + borders #16

Merged
merged 2 commits into from
Jan 26, 2017

Conversation

viteinfinite
Copy link
Contributor

@viteinfinite viteinfinite commented Jan 25, 2017

Allow borders to be correctly drawn on views having rounded corners.
Also, fixing a major visual issue on antialiasing which prevented borders from having smooth corners.

@viteinfinite viteinfinite changed the title Fixing an issue on rounded corners + borders Fixing issues on rounded corners + borders Jan 25, 2017
@@ -27,19 +46,19 @@ class BorderLayer : CALayer {
case .top:
self.draw(border: border,
path: path,
points: [ CGPoint(x: 0, y: 0), CGPoint(x: ctx.width, y: 0), CGPoint(x: ctx.width, y: Int(border.width)), CGPoint(x: 0, y: Int(border.width)) ])
points: [ CGPoint(x: 0, y: 0), CGPoint(x: bounds.width, y: 0), CGPoint(x: bounds.width, y: border.width), CGPoint(x: 0, y: border.width) ])
Copy link
Owner

Choose a reason for hiding this comment

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

I guess this is correct but IMO ctx.width feels more correct as we can't be 100% sure that ctx == bounds

Copy link
Contributor Author

@viteinfinite viteinfinite Jan 26, 2017

Choose a reason for hiding this comment

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

Thing is that ctx depends on screen scale. So, if layer.contentsScale is 2.0 (for instance), ctx.width would be twice the bound width.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh ok, didn't know that!

@pjechris pjechris merged commit f61639d into pjechris:master Jan 26, 2017
@viteinfinite
Copy link
Contributor Author

🎉
Thanks!

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

Successfully merging this pull request may close these issues.

2 participants