Jelajahi Sumber

[Avalonia] Fix background image and reset animation time when switching images

Ruben 1 tahun lalu
induk
melakukan
2a673e7e5a

+ 1 - 0
src/PicView.Avalonia/AnimatedImage/CustomVisualHandler.cs

@@ -31,6 +31,7 @@ public class CustomVisualHandler : CompositionCustomVisualHandler
         {
             _currentInstance?.Dispose();
             _currentInstance = instance;
+            _animationElapsed = TimeSpan.Zero;
         }
     }
 

+ 1 - 0
src/PicView.Avalonia/CustomControls/PicBox.cs

@@ -208,6 +208,7 @@ public class PicBox : Control
         }
 
         context.Dispose(); // Fixes transparent images
+        RenderBackground(context);
         _stream = new FileStream(InitialAnimatedSource, FileMode.Open, FileAccess.Read);
         UpdateAnimationInstance(_stream);
         AnimationUpdate();