mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
靠近边缘时重新归位
This commit is contained in:
parent
f5a0341020
commit
dfa4d3df3e
@ -28,6 +28,7 @@ namespace VPet_Simulator.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void DisplayToNomal()
|
public void DisplayToNomal()
|
||||||
{
|
{
|
||||||
|
this.Core.Controller.ResetPosition();
|
||||||
switch (State)
|
switch (State)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
@ -49,6 +49,12 @@
|
|||||||
/// 显示面板窗体
|
/// 显示面板窗体
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void ShowPanel();
|
void ShowPanel();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 在边缘时重新靠边,防止被阻挡
|
||||||
|
/// </summary>
|
||||||
|
void ResetPosition();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启用计算等数据功能
|
/// 启用计算等数据功能
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -107,6 +107,35 @@ namespace VPet_Simulator.Windows
|
|||||||
panelWindow.Show();
|
panelWindow.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResetPosition()
|
||||||
|
{
|
||||||
|
mw.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
if (RePostionActive)
|
||||||
|
{
|
||||||
|
if (mw.Core.Controller.GetWindowsDistanceUp() < -0.25 * mw.Height && mw.Core.Controller.GetWindowsDistanceDown() < System.Windows.SystemParameters.PrimaryScreenHeight)
|
||||||
|
{
|
||||||
|
mw.Core.Controller.MoveWindows(0, -mw.Core.Controller.GetWindowsDistanceUp() / mw.Core.Controller.ZoomRatio);
|
||||||
|
}
|
||||||
|
else if (mw.Core.Controller.GetWindowsDistanceDown() < -0.25 * mw.Height && mw.Core.Controller.GetWindowsDistanceUp() < System.Windows.SystemParameters.PrimaryScreenHeight)
|
||||||
|
{
|
||||||
|
mw.Core.Controller.MoveWindows(0, mw.Core.Controller.GetWindowsDistanceDown() / mw.Core.Controller.ZoomRatio);
|
||||||
|
}
|
||||||
|
if (mw.Core.Controller.GetWindowsDistanceLeft() < -0.25 * mw.Width && mw.Core.Controller.GetWindowsDistanceRight() < System.Windows.SystemParameters.PrimaryScreenWidth)
|
||||||
|
{
|
||||||
|
mw.Core.Controller.MoveWindows(-mw.Core.Controller.GetWindowsDistanceLeft() / mw.Core.Controller.ZoomRatio, 0);
|
||||||
|
}
|
||||||
|
else if (mw.Core.Controller.GetWindowsDistanceRight() < -0.25 * mw.Width && mw.Core.Controller.GetWindowsDistanceLeft() < System.Windows.SystemParameters.PrimaryScreenWidth)
|
||||||
|
{
|
||||||
|
mw.Core.Controller.MoveWindows(mw.Core.Controller.GetWindowsDistanceRight() / mw.Core.Controller.ZoomRatio, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool RePostionActive = true;
|
||||||
|
|
||||||
public double ZoomRatio => mw.Set.ZoomLevel;
|
public double ZoomRatio => mw.Set.ZoomLevel;
|
||||||
|
|
||||||
public int PressLength => mw.Set.PressLength;
|
public int PressLength => mw.Set.PressLength;
|
||||||
|
Loading…
Reference in New Issue
Block a user