diff --git a/CursorLang/Models/PopupPlacement.cs b/CursorLang/Models/PopupPlacement.cs index 0dfc1e6..826a7b9 100644 --- a/CursorLang/Models/PopupPlacement.cs +++ b/CursorLang/Models/PopupPlacement.cs @@ -37,8 +37,10 @@ public enum AnchorSide public enum ScreenPosition { TopLeft, + Top, TopRight, - BottomLeft, - BottomRight, Center, + BottomLeft, + Bottom, + BottomRight, } diff --git a/CursorLang/Resources/Strings.resx b/CursorLang/Resources/Strings.resx index c9d1eb8..b0f7173 100644 --- a/CursorLang/Resources/Strings.resx +++ b/CursorLang/Resources/Strings.resx @@ -112,6 +112,12 @@ Top left + + Top center + + + Bottom center + Top right diff --git a/CursorLang/Resources/Strings.ru.resx b/CursorLang/Resources/Strings.ru.resx index c5dcffd..1ef9918 100644 --- a/CursorLang/Resources/Strings.ru.resx +++ b/CursorLang/Resources/Strings.ru.resx @@ -112,6 +112,12 @@ Слева сверху + + Сверху по центру + + + Снизу по центру + Справа сверху diff --git a/CursorLang/Views/LayoutPopupWindow.xaml.cs b/CursorLang/Views/LayoutPopupWindow.xaml.cs index 5c78302..7e68645 100644 --- a/CursorLang/Views/LayoutPopupWindow.xaml.cs +++ b/CursorLang/Views/LayoutPopupWindow.xaml.cs @@ -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);