@@ -55,6 +55,10 @@ public EllipseGeometry(Rect rect) : this()
55
55
/// <summary>
56
56
/// Gets or sets a rect that defines the bounds of the ellipse.
57
57
/// </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>
58
62
public Rect Rect
59
63
{
60
64
get => GetValue ( RectProperty ) ;
@@ -64,6 +68,10 @@ public Rect Rect
64
68
/// <summary>
65
69
/// Gets or sets a double that defines the radius in the X-axis of the ellipse.
66
70
/// </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>
67
75
public double RadiusX
68
76
{
69
77
get => GetValue ( RadiusXProperty ) ;
@@ -73,6 +81,10 @@ public double RadiusX
73
81
/// <summary>
74
82
/// Gets or sets a double that defines the radius in the Y-axis of the ellipse.
75
83
/// </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>
76
88
public double RadiusY
77
89
{
78
90
get => GetValue ( RadiusYProperty ) ;
@@ -82,6 +94,10 @@ public double RadiusY
82
94
/// <summary>
83
95
/// Gets or sets a point that defines the center of the ellipse.
84
96
/// </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>
85
101
public Point Center
86
102
{
87
103
get => GetValue ( CenterProperty ) ;
@@ -91,7 +107,30 @@ public Point Center
91
107
/// <inheritdoc/>
92
108
public override Geometry Clone ( )
93
109
{
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
+ } ;
95
134
}
96
135
97
136
/// <inheritdoc/>
0 commit comments