Browse Source

Invalidate visual's rect if it's moved in the global coordinate space

Nikita Tsukanov 3 years ago
parent
commit
7a9d9ea304
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs

+ 8 - 1
src/Avalonia.Base/Rendering/Composition/Server/ServerVisual.cs

@@ -69,7 +69,14 @@ namespace Avalonia.Rendering.Composition.Server
             //TODO: check effective opacity too
             IsVisibleInFrame = Visible && Opacity > 0;
             CombinedTransformMatrix = res;
-            GlobalTransformMatrix = res * transform;
+            var newTransform = res * transform;
+            if (GlobalTransformMatrix != newTransform)
+            {
+                // Visual was moved alongside with its parent
+                _isDirty = true;
+                Root.AddDirtyRect(TransformedBounds);
+            }
+            GlobalTransformMatrix = newTransform;
             //TODO: Cache
             TransformedBounds = ContentBounds.TransformToAABB(MatrixUtils.ToMatrix(GlobalTransformMatrix));