|
|
@ -3,6 +3,7 @@ using System.Collections.Specialized; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using Avalonia.Media; |
|
|
using Avalonia.Media; |
|
|
using Avalonia.Rendering; |
|
|
using Avalonia.Rendering; |
|
|
|
|
|
using Avalonia.Utilities; |
|
|
using Avalonia.VisualTree; |
|
|
using Avalonia.VisualTree; |
|
|
|
|
|
|
|
|
namespace Avalonia.Controls.Primitives |
|
|
namespace Avalonia.Controls.Primitives |
|
|
@ -78,15 +79,20 @@ namespace Avalonia.Controls.Primitives |
|
|
|
|
|
|
|
|
private void UpdateClip(IControl control, TransformedBounds bounds) |
|
|
private void UpdateClip(IControl control, TransformedBounds bounds) |
|
|
{ |
|
|
{ |
|
|
var clip = control.Clip as RectangleGeometry; |
|
|
if (!(control.Clip is RectangleGeometry clip)) |
|
|
|
|
|
|
|
|
if (clip == null) |
|
|
|
|
|
{ |
|
|
{ |
|
|
clip = new RectangleGeometry { Transform = new MatrixTransform() }; |
|
|
clip = new RectangleGeometry(); |
|
|
control.Clip = clip; |
|
|
control.Clip = clip; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
clip.Rect = bounds.Bounds; |
|
|
var clipBounds = bounds.Bounds; |
|
|
|
|
|
|
|
|
|
|
|
if (bounds.Transform.HasInverse) |
|
|
|
|
|
{ |
|
|
|
|
|
clipBounds = bounds.Clip.TransformToAABB(bounds.Transform.Invert()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
clip.Rect = clipBounds; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void ChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) |
|
|
private void ChildrenCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) |
|
|
|