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
Add Graphics RoundedRectangle #3048
Conversation
This looks really nice. Would you be able to add a simple example to the canvas examples folder? If you have it still, the app you used for the screenshot would be fine. Thanks! |
…y. Modified example to reflect how it works.
…oundedrectangle
Added possibility to set different number of segments for different corners by using list of integers (along with the single integer). |
|
||
# number of vertices for arc, including start & end | ||
theta = (angle_end - angle_start) / segments | ||
tangetial_factor = tan(theta) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo -> should be tangential
This looks good to me, I think it can be merged, though I've noted a small typo that would be nice to fix. |
@inclement thanks for noticing, i've added a fix. There's a small issue with current code though: I wonder if all these features even must be a part of "rounded" rectangle, perhaps it should just "do one thing well", and leave rhombuses to |
Add Graphics RoundedRectangle
@hey-sancho nice work 👍 |
Added a new vertex instruction - RoundedRectangle.
This allows to create rectangles with rounded corners on the canvas, just like Ellipse, Rectangle and such.
Dimensions for each corner can be specified by tuples for elliptical corners, or by numbers for circular corners.
Segments parameter defines number of segments for smoothness of all corners.
Imports and factory register allow to use RoundedRectangle both from code and .kv file.
Basic documentation and commentaries are provided.
Preview: