diff --git a/VPet-Simulator.Core/Display/MainDisplay.cs b/VPet-Simulator.Core/Display/MainDisplay.cs
index 08f3251..b325e11 100644
--- a/VPet-Simulator.Core/Display/MainDisplay.cs
+++ b/VPet-Simulator.Core/Display/MainDisplay.cs
@@ -28,6 +28,7 @@ namespace VPet_Simulator.Core
///
public void DisplayToNomal()
{
+ this.Core.Controller.ResetPosition();
switch (State)
{
default:
diff --git a/VPet-Simulator.Core/Handle/IController.cs b/VPet-Simulator.Core/Handle/IController.cs
index 2456661..2fd018d 100644
--- a/VPet-Simulator.Core/Handle/IController.cs
+++ b/VPet-Simulator.Core/Handle/IController.cs
@@ -49,6 +49,12 @@
/// 显示面板窗体
///
void ShowPanel();
+
+ ///
+ /// 在边缘时重新靠边,防止被阻挡
+ ///
+ void ResetPosition();
+
///
/// 启用计算等数据功能
///
diff --git a/VPet-Simulator.Windows/Function/MWController.cs b/VPet-Simulator.Windows/Function/MWController.cs
index 939ab50..f2ebcb6 100644
--- a/VPet-Simulator.Windows/Function/MWController.cs
+++ b/VPet-Simulator.Windows/Function/MWController.cs
@@ -107,6 +107,35 @@ namespace VPet_Simulator.Windows
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 int PressLength => mw.Set.PressLength;