From 0983f4906c952a47ad07bd15fdaf30ffe31fe2b7 Mon Sep 17 00:00:00 2001 From: Evgeny Gorbovoy Date: Sun, 15 Dec 2024 17:42:21 +0100 Subject: [PATCH] null LineBrush is ignored (like other transparent stuff) (#210) --- src/Consolonia.Core/Drawing/DrawingContextImpl.cs | 6 ++++-- src/Consolonia.Core/Drawing/LineBrush.cs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Consolonia.Core/Drawing/DrawingContextImpl.cs b/src/Consolonia.Core/Drawing/DrawingContextImpl.cs index 735bae47..9d562f13 100644 --- a/src/Consolonia.Core/Drawing/DrawingContextImpl.cs +++ b/src/Consolonia.Core/Drawing/DrawingContextImpl.cs @@ -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); diff --git a/src/Consolonia.Core/Drawing/LineBrush.cs b/src/Consolonia.Core/Drawing/LineBrush.cs index 990cd461..25e9d66b 100644 --- a/src/Consolonia.Core/Drawing/LineBrush.cs +++ b/src/Consolonia.Core/Drawing/LineBrush.cs @@ -9,7 +9,8 @@ public class LineBrush : Animatable, IImmutableBrush { //todo: we don't really implement immutable brush public static readonly StyledProperty BrushProperty = - AvaloniaProperty.Register(CommonInternalHelper.GetStyledPropertyName()); + AvaloniaProperty.Register( + CommonInternalHelper.GetStyledPropertyName() /*todo: re-use this method everywhere*/); public static readonly StyledProperty LineStyleProperty = AvaloniaProperty.Register(CommonInternalHelper.GetStyledPropertyName());