Browse Source

Use widened bounds for GeometryNode.Bounds.

Steven Kirk 8 years ago
parent
commit
4ce2e09ef3

+ 1 - 1
src/Avalonia.Visuals/Rendering/SceneGraph/GeometryNode.cs

@@ -11,7 +11,7 @@ namespace Avalonia.Rendering.SceneGraph
     {
         public GeometryNode(Matrix transform, IBrush brush, Pen pen, IGeometryImpl geometry)
         {
-            Bounds = geometry.Bounds.TransformToAABB(transform);
+            Bounds = geometry.GetRenderBounds(pen.Thickness).TransformToAABB(transform);
             Transform = transform;
             Brush = brush;
             Pen = pen;

+ 1 - 4
tests/Avalonia.Visuals.UnitTests/VisualTree/MockRenderInterface.cs

@@ -73,10 +73,7 @@ namespace Avalonia.Visuals.UnitTests.VisualTree
                 return false;
             }
 
-            public Rect GetRenderBounds(double strokeThickness)
-            {
-                throw new NotImplementedException();
-            }
+            public Rect GetRenderBounds(double strokeThickness) => Bounds;
 
             public IStreamGeometryContextImpl Open()
             {

+ 0 - 1
tests/Avalonia.Visuals.UnitTests/VisualTree/VisualExtensionsTests_GetVisualsAt.cs

@@ -441,7 +441,6 @@ namespace Avalonia.Visuals.UnitTests.VisualTree
                 container.Arrange(new Rect(container.DesiredSize));
 
                 var context = new DrawingContext(Mock.Of<IDrawingContextImpl>());
-                ////context.Render(container);
 
                 var result = container.GetVisualsAt(new Point(100, 100));
                 Assert.Equal(new[] { path }, result);