From 0901ae19e67f9b2e9c95971d4b2210c04814ab24 Mon Sep 17 00:00:00 2001 From: Murdo R Ergeaux Date: Sun, 5 Feb 2023 10:29:05 +0000 Subject: [PATCH] Fix invalidation after hidden --- Source/OxyPlot.Avalonia/PlotBase.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Source/OxyPlot.Avalonia/PlotBase.cs b/Source/OxyPlot.Avalonia/PlotBase.cs index 1241b6e..2e79650 100644 --- a/Source/OxyPlot.Avalonia/PlotBase.cs +++ b/Source/OxyPlot.Avalonia/PlotBase.cs @@ -237,7 +237,6 @@ public void InvalidatePlot(bool updateData = true) { if (Interlocked.CompareExchange(ref isUpdateRequired, updateState, currentState) == currentState) { - isUpdateRequired = updateState; BeginInvoke(() => UpdateModel(updateData)); break; } @@ -394,6 +393,7 @@ protected void UpdateModel(bool updateData = true) { if (Width <= 0 || Height <= 0 || ActualModel == null) { + isUpdateRequired = 0; return; } @@ -403,7 +403,7 @@ protected void UpdateModel(bool updateData = true) if (updateState > 0) { - ((IPlotModel)ActualModel).Update(updateState == 2); + ((IPlotModel)ActualModel).Update(updateState == 2 || updateData); } } @@ -413,7 +413,6 @@ protected void UpdateModel(bool updateData = true) // After the invalidation, the element will have its layout updated, // which will occur asynchronously unless subsequently forced by UpdateLayout. BeginInvoke(InvalidateArrange); - BeginInvoke(InvalidateVisual); } }