Browse Source
Merge pull request #12699 from AvaloniaUI/popup-safearea
Adjust popup working area with toplevel's safe area padding
pull/12708/head
Max Katz
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
1 deletions
-
src/Avalonia.Controls/Primitives/OverlayPopupHost.cs
|
|
|
@ -78,7 +78,7 @@ namespace Avalonia.Controls.Primitives |
|
|
|
Rect? rect = null) |
|
|
|
{ |
|
|
|
_positionerParameters.ConfigurePosition((TopLevel)_overlayLayer.GetVisualRoot()!, target, placement, offset, anchor, |
|
|
|
gravity, constraintAdjustment, rect, FlowDirection); |
|
|
|
gravity, constraintAdjustment | PopupPositionerConstraintAdjustment.All, rect, FlowDirection); |
|
|
|
UpdatePosition(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -110,6 +110,13 @@ namespace Avalonia.Controls.Primitives |
|
|
|
get |
|
|
|
{ |
|
|
|
var rc = new Rect(default, _overlayLayer.AvailableSize); |
|
|
|
var topLevel = TopLevel.GetTopLevel(this); |
|
|
|
if(topLevel != null) |
|
|
|
{ |
|
|
|
var padding = topLevel.InsetsManager?.SafeAreaPadding ?? default; |
|
|
|
rc = rc.Deflate(padding); |
|
|
|
} |
|
|
|
|
|
|
|
return new[] {new ManagedPopupPositionerScreenInfo(rc, rc)}; |
|
|
|
} |
|
|
|
} |
|
|
|
|