Browse Source
Merge pull request #6039 from MarchingCube/fix-textpresenter-caretbrush
Fix problems with mutable brush being passed to an immutable pen.
pull/6046/head
Steven Kirk
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
9 additions and
9 deletions
-
src/Avalonia.Controls/Presenters/TextPresenter.cs
-
src/Avalonia.Visuals/Media/Immutable/ImmutablePen.cs
|
|
|
@ -361,9 +361,9 @@ namespace Avalonia.Controls.Presenters |
|
|
|
|
|
|
|
RenderInternal(context); |
|
|
|
|
|
|
|
if (selectionStart == selectionEnd) |
|
|
|
if (selectionStart == selectionEnd && _caretBlink) |
|
|
|
{ |
|
|
|
var caretBrush = CaretBrush; |
|
|
|
var caretBrush = CaretBrush?.ToImmutable(); |
|
|
|
|
|
|
|
if (caretBrush is null) |
|
|
|
{ |
|
|
|
@ -382,13 +382,10 @@ namespace Avalonia.Controls.Presenters |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (_caretBlink) |
|
|
|
{ |
|
|
|
var (p1, p2) = GetCaretPoints(); |
|
|
|
context.DrawLine( |
|
|
|
new ImmutablePen(caretBrush, 1), |
|
|
|
p1, p2); |
|
|
|
} |
|
|
|
var (p1, p2) = GetCaretPoints(); |
|
|
|
context.DrawLine( |
|
|
|
new ImmutablePen(caretBrush, 1), |
|
|
|
p1, p2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Diagnostics; |
|
|
|
|
|
|
|
namespace Avalonia.Media.Immutable |
|
|
|
{ |
|
|
|
@ -44,6 +45,8 @@ namespace Avalonia.Media.Immutable |
|
|
|
PenLineJoin lineJoin = PenLineJoin.Miter, |
|
|
|
double miterLimit = 10.0) |
|
|
|
{ |
|
|
|
Debug.Assert(!(brush is IMutableBrush)); |
|
|
|
|
|
|
|
Brush = brush; |
|
|
|
Thickness = thickness; |
|
|
|
LineCap = lineCap; |
|
|
|
|