Skip to content

Commit 0596a63

Browse files
committed
fix: skip to render contents when Bounds.Width is zero
1 parent bd09a44 commit 0596a63

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Views/Statistics.axaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ static Chart()
4545
{
4646
c._hitBoxes.Clear();
4747
c._lastHitIdx = -1;
48-
c.InvalidateVisual();
48+
c.InvalidateMeasure();
4949
});
5050
}
5151

5252
public override void Render(DrawingContext context)
5353
{
54-
if (Samples == null)
54+
if (Samples == null || Bounds.Width == 0)
5555
return;
5656

5757
var samples = Samples;
@@ -97,7 +97,7 @@ public override void Render(DrawingContext context)
9797
var height = Bounds.Height;
9898

9999
// Transparent background to block mouse move events.
100-
context.DrawRectangle(Brushes.Transparent, null, new Rect(0, 0, Bounds.Width, Bounds.Height));
100+
context.DrawRectangle(Brushes.Transparent, null, new Rect(0, 0, width, height));
101101

102102
// Draw coordinate
103103
var maxLabel = new FormattedText($"{maxV}", CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, 12.0, LineBrush);

0 commit comments

Comments
 (0)