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

Rounded arrow #30

Closed
kevin-hirsch opened this issue May 5, 2015 · 12 comments
Closed

Rounded arrow #30

kevin-hirsch opened this issue May 5, 2015 · 12 comments

Comments

@kevin-hirsch
Copy link
Contributor

Hi @andreamazz, thank you for your super AMPopTip! :)

What do you think of adding a property like arrowRadius to have a rounded arrow?
I would like it very much! Something like this:

screen shot 2015-05-05 at 13 49 02

@andreamazz
Copy link
Owner

Hi @kevin-hirsch
Yeah, I guess that I should be able to add it fairly quickly, I'll take a look at it in the next few days.

@kevin-hirsch
Copy link
Contributor Author

Thank you very much! 👍

@andreamazz
Copy link
Owner

add it fairly quickly

Yeah, I was wrong. I'm having a bit of troubles implementing this. 😅

@kevin-hirsch
Copy link
Contributor Author

No worries ;)

@andreamazz
Copy link
Owner

Any idea (or PR) is welcome. Since the arrow is drawn point by point, adding a rounded tip requires some math: the offset of the starting and ending point of the straight lines, and the starting and ending angle of the arc that connects the two straight lines.

@kevin-hirsch
Copy link
Contributor Author

Yeah I see the difficulty here ^^

Maybe you can try this: https://www.bignerdranch.com/blog/core-graphics-part-three-lines/#join-the-dark-side

enum CGLineJoin {
    kCGLineJoinMiter       // default
    kCGLineJoinRound
    kCGLineJoinBevel
}

cg3-joinstyles

@andreamazz
Copy link
Owner

I'm using UIBezierPaths

@kevin-hirsch
Copy link
Contributor Author

Right, forget my post above then ;)
I will see by my side what can be done but I will not have much time before WWDC 2015 ;)

@dgattey
Copy link

dgattey commented Jun 25, 2015

Check this out? Not sure how much work this will be https://stackoverflow.com/questions/20442203/uibezierpath-triangle-with-rounded-edges

@andreamazz
Copy link
Owner

There's a bit of tinkering to do, but it certainly is doable.

@oleghnidets
Copy link

Hi,
Any updates?

@rserentill
Copy link
Contributor

Hi, I just created a pull request (#157) with this feature. You can set the property arrowRadius (CGFloat) to set the arrow's corner radius.

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

No branches or pull requests

5 participants