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
|
public enum ScreenPosition
|
||||||
{
|
{
|
||||||
TopLeft,
|
TopLeft,
|
||||||
|
Top,
|
||||||
TopRight,
|
TopRight,
|
||||||
BottomLeft,
|
|
||||||
BottomRight,
|
|
||||||
Center,
|
Center,
|
||||||
|
BottomLeft,
|
||||||
|
Bottom,
|
||||||
|
BottomRight,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,6 +112,12 @@
|
|||||||
<data name="ScreenPosition_TopLeft" xml:space="preserve">
|
<data name="ScreenPosition_TopLeft" xml:space="preserve">
|
||||||
<value>Top left</value>
|
<value>Top left</value>
|
||||||
</data>
|
</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">
|
<data name="ScreenPosition_TopRight" xml:space="preserve">
|
||||||
<value>Top right</value>
|
<value>Top right</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -112,6 +112,12 @@
|
|||||||
<data name="ScreenPosition_TopLeft" xml:space="preserve">
|
<data name="ScreenPosition_TopLeft" xml:space="preserve">
|
||||||
<value>Слева сверху</value>
|
<value>Слева сверху</value>
|
||||||
</data>
|
</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">
|
<data name="ScreenPosition_TopRight" xml:space="preserve">
|
||||||
<value>Справа сверху</value>
|
<value>Справа сверху</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -145,14 +145,22 @@ public partial class LayoutPopupWindow : Window
|
|||||||
int height = ToPixels(_contentSize.Height, scale);
|
int height = ToPixels(_contentSize.Height, scale);
|
||||||
int margin = ToPixels(_settings.ScreenMargin, 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
|
(int x, int y) = _settings.ScreenPosition switch
|
||||||
{
|
{
|
||||||
ScreenPosition.TopLeft => (work.Left + margin, work.Top + margin),
|
ScreenPosition.TopLeft => (left, top),
|
||||||
ScreenPosition.TopRight => (work.Right - margin - width, work.Top + margin),
|
ScreenPosition.Top => (centerX, top),
|
||||||
ScreenPosition.BottomLeft => (work.Left + margin, work.Bottom - margin - height),
|
ScreenPosition.TopRight => (right, top),
|
||||||
ScreenPosition.BottomRight => (work.Right - margin - width, work.Bottom - margin - height),
|
ScreenPosition.BottomLeft => (left, bottom),
|
||||||
_ => (work.Left + ((work.Right - work.Left - width) / 2),
|
ScreenPosition.Bottom => (centerX, bottom),
|
||||||
work.Top + ((work.Bottom - work.Top - height) / 2)),
|
ScreenPosition.BottomRight => (right, bottom),
|
||||||
|
_ => (centerX, centerY),
|
||||||
};
|
};
|
||||||
|
|
||||||
PopupWindowNative.SetBounds(handle, x, y, width, height);
|
PopupWindowNative.SetBounds(handle, x, y, width, height);
|
||||||
|
|||||||
Reference in New Issue
Block a user