added top center and bottom center to side in point to screen mode
This commit is contained in:
@@ -37,8 +37,10 @@ public enum AnchorSide
|
||||
public enum ScreenPosition
|
||||
{
|
||||
TopLeft,
|
||||
Top,
|
||||
TopRight,
|
||||
BottomLeft,
|
||||
BottomRight,
|
||||
Center,
|
||||
BottomLeft,
|
||||
Bottom,
|
||||
BottomRight,
|
||||
}
|
||||
|
||||
@@ -112,6 +112,12 @@
|
||||
<data name="ScreenPosition_TopLeft" xml:space="preserve">
|
||||
<value>Top left</value>
|
||||
</data>
|
||||
<data name="ScreenPosition_Top" xml:space="preserve">
|
||||
<value>Top center</value>
|
||||
</data>
|
||||
<data name="ScreenPosition_Bottom" xml:space="preserve">
|
||||
<value>Bottom center</value>
|
||||
</data>
|
||||
<data name="ScreenPosition_TopRight" xml:space="preserve">
|
||||
<value>Top right</value>
|
||||
</data>
|
||||
|
||||
@@ -112,6 +112,12 @@
|
||||
<data name="ScreenPosition_TopLeft" xml:space="preserve">
|
||||
<value>Слева сверху</value>
|
||||
</data>
|
||||
<data name="ScreenPosition_Top" xml:space="preserve">
|
||||
<value>Сверху по центру</value>
|
||||
</data>
|
||||
<data name="ScreenPosition_Bottom" xml:space="preserve">
|
||||
<value>Снизу по центру</value>
|
||||
</data>
|
||||
<data name="ScreenPosition_TopRight" xml:space="preserve">
|
||||
<value>Справа сверху</value>
|
||||
</data>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user