added top center and bottom center to side in point to screen mode

This commit is contained in:
2026-08-08 23:37:49 +05:00
parent 2af494d2f6
commit 8a19cb6a9c
4 changed files with 30 additions and 8 deletions
+14 -6
View File
@@ -145,14 +145,22 @@ public partial class LayoutPopupWindow : Window
int height = ToPixels(_contentSize.Height, scale);
int margin = ToPixels(_settings.ScreenMargin, scale);
int left = work.Left + margin;
int right = work.Right - margin - width;
int top = work.Top + margin;
int bottom = work.Bottom - margin - height;
int centerX = work.Left + ((work.Right - work.Left - width) / 2);
int centerY = work.Top + ((work.Bottom - work.Top - height) / 2);
(int x, int y) = _settings.ScreenPosition switch
{
ScreenPosition.TopLeft => (work.Left + margin, work.Top + margin),
ScreenPosition.TopRight => (work.Right - margin - width, work.Top + margin),
ScreenPosition.BottomLeft => (work.Left + margin, work.Bottom - margin - height),
ScreenPosition.BottomRight => (work.Right - margin - width, work.Bottom - margin - height),
_ => (work.Left + ((work.Right - work.Left - width) / 2),
work.Top + ((work.Bottom - work.Top - height) / 2)),
ScreenPosition.TopLeft => (left, top),
ScreenPosition.Top => (centerX, top),
ScreenPosition.TopRight => (right, top),
ScreenPosition.BottomLeft => (left, bottom),
ScreenPosition.Bottom => (centerX, bottom),
ScreenPosition.BottomRight => (right, bottom),
_ => (centerX, centerY),
};
PopupWindowNative.SetBounds(handle, x, y, width, height);