community
community copied to clipboard
Graphics.Line: #7656-Line-rounded_rectangle BugFix
This merge request solves #7656. *improves the class to lock the maximum length between corners based on the minimum value between object length and width.
- adds the missing 4 control points
- made the drawing instruction a loop, that can be easily maintained
- changed the behavior of the
segmentsparameter, this parameter now indicates the amount of segment that will be processed for each corner. - the inner loop starts processing the top-right corner and goes clock backwards wise. But the radius_ parameters works the same. The array inside allows the normal standard behavior across kivy.
Be aware that this means the following *wh=min(width, height) : minumum value between height and width. *wh2 = (wh-1)//2 : half the minimum lenght.
New behavior for the segments parameter:
- if segment = 0 the canvas will draw a normal rectangle
- if segment >= 1: the canvas will draw a rounded rectangle with the number of segments per corner + the side flat lines.
- if segment > wh2, we use the wh2 value as maximum.
New radius behavior:
- all corner radius are checked to be less or equal to wh2
- all corners limit are wh2, this allows us to avoid some visual issues whenever the line has a specific kind of corner joint.
- all corners have a lower limit of 1 this help us to avoid adding a new logic block for radius_ = 0
- all corners are square. maybe not square corners might be added in the future (if i learn how to plot them).
Maintainer merge checklist
- [x] Title is descriptive/clear for inclusion in release notes.
- [x] Applied a
Component: xxxlabel. - [ ] Applied the
api-deprecationorapi-breaklabel. - [ ] Applied the
release-highlightlabel to be highlighted in release notes. - [ ] Added to the milestone version it was merged into.
- [ ] Unittests are included in PR.
- [x] Properly documented, including
versionadded,versionchangedas needed.
Thanks for opening your first pull request here! 💖 Please check out our contributing guidelines.