Repository navigation
Fix GeometryBuilder.DrawRoundedCornersRectangle for Rect - #21482
Conversation
|
Leaving draft because more code review is required for related methods. The |
|
You can test this PR using the following package version. |
|
Hey @robloo any news on this PR? Is it still a draft? |
|
@grokys It was still a draft because I suspected the issue was endemic to more APIs. The plan was to review them. If the team wants to get this in I'll mark as ready. This PR does fix the actual issue ticket. Additional work can be done in follow-up PRs as time permits. |
|
You can test this PR using the following package version. |
There was a problem hiding this comment.
Pull request overview
Fixes incorrect corner-arc rotation when building rounded rectangles from a Rect + (radiusX, radiusY) by ensuring the emitted elliptical corner arcs are axis-aligned (rotation angle 0). Also clarifies IGeometryContext.ArcTo XML documentation to state rotationAngle is specified in degrees.
Changes:
- Set
rotationAngle: 0.0for all fourArcTocalls inGeometryBuilder.DrawRoundedCornersRectangle(StreamGeometryContext, Rect, double, double)and remove the unusedPiOver2constant. - Update
IGeometryContext.ArcToXML docs to describerotationAngleas degrees and improve parameter wording/punctuation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/Avalonia.Base/Platform/IGeometryContext.cs | Updates ArcTo XML documentation (degrees, clearer wording). |
| src/Avalonia.Base/Media/GeometryBuilder.cs | Fixes rounded-rectangle corner arc rotation by using rotationAngle: 0.0. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
You can test this PR using the following package version. |
…aUI#21482) * Use 0 degree rotation angle in DrawRoundedCornersRectangle() for Rect * Fix units in rotationAngle comment * Improve ArcTo() XML docs * Remove unused PiOver2 const causing build checks to fail --------- Co-authored-by: Steven Kirk <grokys@users.noreply.github.com>
What does the pull request do?
Fixes the issues discussed in:
What is the current behavior?
RectangleGeometry(andRectangle) drawing specifically withRadiusXorRadiusYhas a small 1.57 degree rotation on each corner radius arc..Rectangledrawing without any corner radius was never broken (is uses a fast path without a stream geometry context). This also explains why it was unnoticed for so long sinceRadiusXorRadiusYsupport came later in 11.x and probably still isn't widely used.ArcTomethod comments have incorrect units and are not clearly worded.What is the updated/expected behavior with this PR?
RectangleGeometrywith corner radius drawing is fixed.ArcTomethod comments are now more clearly worded.How was the solution implemented (if it's not obvious)?
Obvious and now documented better.
Checklist
Breaking changes
None
Obsoletions / Deprecations
None
Fixed issues
Fixes #21445