Browse Source

Merge pull request #2111 from AvaloniaUI/fixes/popup-obey-screen-edges-dpi

fix SnapInsideScreenEdges so that it obeys screen scaling.
danwalmsley 7 years ago
parent
commit
090f89142d
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/Avalonia.Controls/Primitives/PopupRoot.cs

+ 4 - 2
src/Avalonia.Controls/Primitives/PopupRoot.cs

@@ -84,8 +84,10 @@ namespace Avalonia.Controls.Primitives
 
             if (screen != null)
             {
-                var screenX = Position.X + Bounds.Width - screen.Bounds.X;
-                var screenY = Position.Y + Bounds.Height - screen.Bounds.Y;
+                var scaling = VisualRoot.RenderScaling;
+
+                var screenX = Position.X + (Bounds.Width * scaling) - screen.Bounds.X;
+                var screenY = Position.Y + (Bounds.Height * scaling) - screen.Bounds.Y;
 
                 if (screenX > screen.Bounds.Width)
                 {