@@ -27,6 +27,7 @@ internal static void Draw (IEnumerable<View> views, bool force)
27
27
view . Draw ( context ) ;
28
28
}
29
29
30
+ // Draw the margins (those whith Shadows) last to ensure they are drawn on top of the content.
30
31
Margin . DrawMargins ( viewsArray ) ;
31
32
}
32
33
@@ -57,9 +58,9 @@ public void Draw (DrawContext? context = null)
57
58
{
58
59
// ------------------------------------
59
60
// Draw the Border and Padding.
60
- // Note Margin is special-cased and drawn in a separate pass to support
61
+ // Note Margin with a Shadow is special-cased and drawn in a separate pass to support
61
62
// transparent shadows.
62
- DoDrawBorderAndPadding ( originalClip ) ;
63
+ DoDrawAdornments ( originalClip ) ;
63
64
SetClip ( originalClip ) ;
64
65
65
66
// ------------------------------------
@@ -106,7 +107,7 @@ public void Draw (DrawContext? context = null)
106
107
// ------------------------------------
107
108
// Re-draw the border and padding subviews
108
109
// HACK: This is a hack to ensure that the border and padding subviews are drawn after the line canvas.
109
- DoDrawBorderAndPaddingSubViews ( ) ;
110
+ DoDrawAdornmentsSubViews ( ) ;
110
111
111
112
// ------------------------------------
112
113
// Advance the diagnostics draw indicator
@@ -116,8 +117,8 @@ public void Draw (DrawContext? context = null)
116
117
}
117
118
118
119
// ------------------------------------
119
- // This causes the Margin to be drawn in a second pass
120
- // PERFORMANCE: If there is a Margin, it will be redrawn each iteration of the main loop.
120
+ // This causes the Margin to be drawn in a second pass if it has a ShadowStyle
121
+ // PERFORMANCE: If there is a Margin w/ Shadow , it will be redrawn each iteration of the main loop.
121
122
Margin ? . CacheClip ( ) ;
122
123
123
124
// ------------------------------------
@@ -131,8 +132,11 @@ public void Draw (DrawContext? context = null)
131
132
132
133
#region DrawAdornments
133
134
134
- private void DoDrawBorderAndPaddingSubViews ( )
135
+ private void DoDrawAdornmentsSubViews ( )
135
136
{
137
+
138
+ // NOTE: We do not support subviews of Margin?
139
+
136
140
if ( Border ? . SubViews is { } && Border . Thickness != Thickness . Empty )
137
141
{
138
142
// PERFORMANCE: Get the check for DrawIndicator out of this somehow.
@@ -164,7 +168,7 @@ private void DoDrawBorderAndPaddingSubViews ()
164
168
}
165
169
}
166
170
167
- private void DoDrawBorderAndPadding ( Region ? originalClip )
171
+ private void DoDrawAdornments ( Region ? originalClip )
168
172
{
169
173
if ( this is Adornment )
170
174
{
@@ -194,27 +198,28 @@ private void DoDrawBorderAndPadding (Region? originalClip)
194
198
// A SubView may add to the LineCanvas. This ensures any Adornment LineCanvas updates happen.
195
199
Border ? . SetNeedsDraw ( ) ;
196
200
Padding ? . SetNeedsDraw ( ) ;
201
+ Margin ? . SetNeedsDraw ( ) ;
197
202
}
198
203
199
- if ( OnDrawingBorderAndPadding ( ) )
204
+ if ( OnDrawingAdornments ( ) )
200
205
{
201
206
return ;
202
207
}
203
208
204
209
// TODO: add event.
205
210
206
- DrawBorderAndPadding ( ) ;
211
+ DrawAdornments ( ) ;
207
212
}
208
213
209
214
/// <summary>
210
- /// Causes <see cref="Border"/> and <see cref="Padding"/> to be drawn.
215
+ /// Causes <see cref="Margin"/>, <see cref=" Border"/>, and <see cref="Padding"/> to be drawn.
211
216
/// </summary>
212
217
/// <remarks>
213
218
/// <para>
214
- /// <see cref="Margin"/> is drawn in a separate pass.
219
+ /// <see cref="Margin"/> is drawn in a separate pass if <see cref="ShadowStyle"/> is set .
215
220
/// </para>
216
221
/// </remarks>
217
- public void DrawBorderAndPadding ( )
222
+ public void DrawAdornments ( )
218
223
{
219
224
// We do not attempt to draw Margin. It is drawn in a separate pass.
220
225
@@ -230,6 +235,11 @@ public void DrawBorderAndPadding ()
230
235
Padding ? . Draw ( ) ;
231
236
}
232
237
238
+
239
+ if ( Margin is { } && Margin . Thickness != Thickness . Empty && Margin . ShadowStyle == ShadowStyle . None )
240
+ {
241
+ Margin ? . Draw ( ) ;
242
+ }
233
243
}
234
244
235
245
private void ClearFrame ( )
@@ -255,7 +265,7 @@ private void ClearFrame ()
255
265
/// false (the default), this method will cause the <see cref="LineCanvas"/> be prepared to be rendered.
256
266
/// </summary>
257
267
/// <returns><see langword="true"/> to stop further drawing of the Adornments.</returns>
258
- protected virtual bool OnDrawingBorderAndPadding ( ) { return false ; }
268
+ protected virtual bool OnDrawingAdornments ( ) { return false ; }
259
269
260
270
#endregion DrawAdornments
261
271
@@ -635,7 +645,7 @@ private void DoRenderLineCanvas ()
635
645
/// <summary>
636
646
/// Gets or sets whether this View will use it's SuperView's <see cref="LineCanvas"/> for rendering any
637
647
/// lines. If <see langword="true"/> the rendering of any borders drawn by this Frame will be done by its parent's
638
- /// SuperView. If <see langword="false"/> (the default) this View's <see cref="OnDrawingBorderAndPadding "/> method will
648
+ /// SuperView. If <see langword="false"/> (the default) this View's <see cref="OnDrawingAdornments "/> method will
639
649
/// be
640
650
/// called to render the borders.
641
651
/// </summary>
0 commit comments