Browse Source
Fix Adorner Layer Clipping (#13921 )
* Don't overwrite IsClipEnabled.
The user should be able to set this on an adorner themselves.
* Use correct clip bounds for adorners.
Only take the adorned visual's clip bounds into account if the adorner is clipped to these bounds.
* Disable clipping on GridSplitter adorner.
Fixes #10700
* Don't clip adorners in ControlCatalog.
Default setting is `true`, but this was being overridden in `AdornerLayer.AddVisualAdorner`. That was fixed by an earlier commit in this PR, so property needs to be set explicitly to false in ControlCatalog.
pull/14243/head
Steven Kirk
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
4 additions and
3 deletions
samples/ControlCatalog/Pages/AdornerLayerPage.xaml
src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs
src/Avalonia.Controls/GridSplitter.cs
src/Avalonia.Controls/Primitives/AdornerLayer.cs
@ -50,7 +50,8 @@
Background="Cyan"
Background="Cyan"
IsHitTestVisible="False"
IsHitTestVisible="False"
Opacity="0.3"
Opacity="0.3"
IsVisible="True">
IsVisible="True"
AdornerLayer.IsClipEnabled="False">
<Line StartPoint="-10000,0" EndPoint="10000,0" Stroke="Cyan" StrokeThickness="1" />
<Line StartPoint="-10000,0" EndPoint="10000,0" Stroke="Cyan" StrokeThickness="1" />
<Line StartPoint="-10000,42" EndPoint="10000,42" Stroke="Cyan" StrokeThickness="1" />
<Line StartPoint="-10000,42" EndPoint="10000,42" Stroke="Cyan" StrokeThickness="1" />
<Line StartPoint="0,-10000" EndPoint="0,10000" Stroke="Cyan" StrokeThickness="1" />
<Line StartPoint="0,-10000" EndPoint="0,10000" Stroke="Cyan" StrokeThickness="1" />
@ -205,7 +205,7 @@ namespace Avalonia.Rendering.Composition.Server
}
}
_ combinedTransformedClipBounds =
_ combinedTransformedClipBounds =
AdornedVisual ? . _ combinedTransformedClipBounds
( AdornerIsClipped ? AdornedVisual ? . _ combinedTransformedClipBounds : null )
? ? ( Parent ? . Effect = = null ? Parent ? . _ combinedTransformedClipBounds : null )
? ? ( Parent ? . Effect = = null ? Parent ? . _ combinedTransformedClipBounds : null )
? ? new Rect ( Root ! . Size ) ;
? ? new Rect ( Root ! . Size ) ;
@ -341,6 +341,7 @@ namespace Avalonia.Controls
_ resizeData . Adorner = new PreviewAdorner ( builtPreviewContent ) ;
_ resizeData . Adorner = new PreviewAdorner ( builtPreviewContent ) ;
AdornerLayer . SetAdornedElement ( _ resizeData . Adorner , this ) ;
AdornerLayer . SetAdornedElement ( _ resizeData . Adorner , this ) ;
AdornerLayer . SetIsClipEnabled ( _ resizeData . Adorner , false ) ;
adornerLayer . Children . Add ( _ resizeData . Adorner ) ;
adornerLayer . Children . Add ( _ resizeData . Adorner ) ;
@ -174,7 +174,6 @@ namespace Avalonia.Controls.Primitives
}
}
SetAdornedElement ( adorner , visual ) ;
SetAdornedElement ( adorner , visual ) ;
SetIsClipEnabled ( adorner , false ) ;
( ( ISetLogicalParent ) adorner ) . SetParent ( visual ) ;
( ( ISetLogicalParent ) adorner ) . SetParent ( visual ) ;
layer . Children . Add ( adorner ) ;
layer . Children . Add ( adorner ) ;