From 0596a63b30d827348029e60950dc6a11e03e6ee3 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 13 May 2024 16:39:48 +0800 Subject: [PATCH] fix: skip to render contents when Bounds.Width is zero --- src/Views/Statistics.axaml.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Views/Statistics.axaml.cs b/src/Views/Statistics.axaml.cs index b44da160..8cd8ea15 100644 --- a/src/Views/Statistics.axaml.cs +++ b/src/Views/Statistics.axaml.cs @@ -45,13 +45,13 @@ namespace SourceGit.Views { c._hitBoxes.Clear(); c._lastHitIdx = -1; - c.InvalidateVisual(); + c.InvalidateMeasure(); }); } public override void Render(DrawingContext context) { - if (Samples == null) + if (Samples == null || Bounds.Width == 0) return; var samples = Samples; @@ -97,7 +97,7 @@ namespace SourceGit.Views var height = Bounds.Height; // Transparent background to block mouse move events. - context.DrawRectangle(Brushes.Transparent, null, new Rect(0, 0, Bounds.Width, Bounds.Height)); + context.DrawRectangle(Brushes.Transparent, null, new Rect(0, 0, width, height)); // Draw coordinate var maxLabel = new FormattedText($"{maxV}", CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, 12.0, LineBrush);