Skip to content

Commit 8885269

Browse files
jmacatodanwalmsley
authored andcommitted
Merge pull request #11773 from robloo/ellipse-geometry
EllipseGeometry Clone Fix # Conflicts: # src/Avalonia.Base/AvaloniaObjectExtensions.cs # src/Avalonia.Base/Media/TextFormatting/Unicode/BiDiAlgorithm.cs
1 parent 1729784 commit 8885269

File tree

5 files changed

+43
-5
lines changed

5 files changed

+43
-5
lines changed

packages/Avalonia/Avalonia.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="Avalonia.BuildServices" Version="0.0.16" />
98
<PackageReference Include="Avalonia.BuildServices" Version="0.0.29" />
109
<ProjectReference Include="../../src/Avalonia.Remote.Protocol/Avalonia.Remote.Protocol.csproj" />
1110
<ProjectReference Include="../../src/Avalonia.Build.Tasks/Avalonia.Build.Tasks.csproj" >

src/Avalonia.Base/Utilities/TypeUtilities.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public static bool TryConvertImplicit(Type to, object? value, out object? result
303303
/// if the value could not be converted.
304304
/// </summary>
305305
/// <param name="value">The value to convert.</param>
306-
/// <param name="type">The type to convert to..</param>
306+
/// <param name="type">The type to convert to.</param>
307307
/// <param name="culture">The culture to use.</param>
308308
/// <returns>A value of <paramref name="type"/>.</returns>
309309
public static object? ConvertOrDefault(object? value, Type type, CultureInfo culture)

src/Avalonia.Controls/Primitives/PopupPositioning/IPopupPositioner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public enum PopupPositionerConstraintAdjustment
213213
///
214214
/// If the adjusted position also ends up being constrained, the resulting position of the
215215
/// FlipX adjustment will be the one before the adjustment.
216-
/// /// </remarks>
216+
/// </remarks>
217217
FlipX = 4,
218218

219219
/// <summary>

src/Avalonia.Visuals/Media/EllipseGeometry.cs

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public EllipseGeometry(Rect rect) : this()
5555
/// <summary>
5656
/// Gets or sets a rect that defines the bounds of the ellipse.
5757
/// </summary>
58+
/// <remarks>
59+
/// When set, this takes priority over the other properties that define an
60+
/// ellipse using a center point and X/Y-axis radii.
61+
/// </remarks>
5862
public Rect Rect
5963
{
6064
get => GetValue(RectProperty);
@@ -64,6 +68,10 @@ public Rect Rect
6468
/// <summary>
6569
/// Gets or sets a double that defines the radius in the X-axis of the ellipse.
6670
/// </summary>
71+
/// <remarks>
72+
/// In order for this property to be used, <see cref="Rect"/> must not be set
73+
/// (equal to the default <see cref="Avalonia.Rect"/> value).
74+
/// </remarks>
6775
public double RadiusX
6876
{
6977
get => GetValue(RadiusXProperty);
@@ -73,6 +81,10 @@ public double RadiusX
7381
/// <summary>
7482
/// Gets or sets a double that defines the radius in the Y-axis of the ellipse.
7583
/// </summary>
84+
/// <remarks>
85+
/// In order for this property to be used, <see cref="Rect"/> must not be set
86+
/// (equal to the default <see cref="Avalonia.Rect"/> value).
87+
/// </remarks>
7688
public double RadiusY
7789
{
7890
get => GetValue(RadiusYProperty);
@@ -82,6 +94,10 @@ public double RadiusY
8294
/// <summary>
8395
/// Gets or sets a point that defines the center of the ellipse.
8496
/// </summary>
97+
/// <remarks>
98+
/// In order for this property to be used, <see cref="Rect"/> must not be set
99+
/// (equal to the default <see cref="Avalonia.Rect"/> value).
100+
/// </remarks>
85101
public Point Center
86102
{
87103
get => GetValue(CenterProperty);
@@ -91,7 +107,30 @@ public Point Center
91107
/// <inheritdoc/>
92108
public override Geometry Clone()
93109
{
94-
return new EllipseGeometry(Rect);
110+
// Note that the ellipse properties are used in two modes:
111+
//
112+
// 1. Rect-only Mode:
113+
// Directly set the rectangle bounds the ellipse will fill
114+
//
115+
// 2. Center + Radii Mode:
116+
// Set a center-point and then X/Y-axis radii that are used to
117+
// calculate the rectangle bounds the ellipse will fill.
118+
// This is the only mode supported by WPF.
119+
//
120+
// Rendering the ellipse will only ever use one of these two modes
121+
// based on if the Rect property is set (not equal to default).
122+
//
123+
// This means it would normally be fine to copy ONLY the Rect property
124+
// when it is set. However, while it would render the same, it isn't
125+
// a true clone. We want to include all the properties here regardless
126+
// of the rendering mode that will eventually be used.
127+
return new EllipseGeometry()
128+
{
129+
Rect = Rect,
130+
RadiusX = RadiusX,
131+
RadiusY = RadiusY,
132+
Center = Center,
133+
};
95134
}
96135

97136
/// <inheritdoc/>

src/Avalonia.Visuals/Platform/IPlatformRenderInterface.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ IFormattedTextImpl CreateFormattedText(
3535
/// Creates an ellipse geometry implementation.
3636
/// </summary>
3737
/// <param name="rect">The bounds of the ellipse.</param>
38-
/// <returns>An ellipse geometry..</returns>
38+
/// <returns>An ellipse geometry.</returns>
3939
IGeometryImpl CreateEllipseGeometry(Rect rect);
4040

4141
/// <summary>

0 commit comments

Comments
 (0)