Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

null LineBrush is ignored (like other transparent stuff) #210

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Consolonia.Core/Drawing/DrawingContextImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,10 @@ public void DrawGeometry(IBrush brush, IPen pen, IGeometryImpl geometry)
FillRectangleWithBrush(brush, pen, r);
}

if (pen is null or { Thickness: 0 }
or { Brush: null }) return;
if (pen is null
or { Thickness: 0 }
or { Brush: null }
or { Brush: LineBrush { Brush: null } }) return;
DrawBoxLineInternal(pen, new Line(r.TopLeft, false, (int)r.Width), RectangleLinePosition.Top);
DrawBoxLineInternal(pen, new Line(r.BottomLeft, false, (int)r.Width), RectangleLinePosition.Bottom);
DrawBoxLineInternal(pen, new Line(r.TopLeft, true, (int)r.Height), RectangleLinePosition.Left);
Expand Down
3 changes: 2 additions & 1 deletion src/Consolonia.Core/Drawing/LineBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public class LineBrush : Animatable, IImmutableBrush
{
//todo: we don't really implement immutable brush
public static readonly StyledProperty<IBrush> BrushProperty =
AvaloniaProperty.Register<LineBrush, IBrush>(CommonInternalHelper.GetStyledPropertyName());
AvaloniaProperty.Register<LineBrush, IBrush>(
CommonInternalHelper.GetStyledPropertyName() /*todo: re-use this method everywhere*/);

public static readonly StyledProperty<LineStyle> LineStyleProperty =
AvaloniaProperty.Register<LineBrush, LineStyle>(CommonInternalHelper.GetStyledPropertyName());
Expand Down
Loading