Skip to content

Commit

Permalink
修复第一次拖动没有位移的错误
Browse files Browse the repository at this point in the history
  • Loading branch information
LorisYounger committed Jul 31, 2024
1 parent 5099954 commit 6e79f24
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions VPet-Simulator.Core/Display/MainDisplay.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using LinePutScript.Localization.WPF;
using LinePutScript.Converter;
using LinePutScript.Localization.WPF;
using System;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using static VPet_Simulator.Core.GraphInfo;
Expand Down Expand Up @@ -326,6 +329,15 @@ public void DisplayRaised()
MainGrid.MouseMove -= MainGrid_MouseWave;
MainGrid.MouseMove -= MainGrid_MouseMove;
MainGrid.MouseMove += MainGrid_MouseMove;

var mp = Dispatcher.Invoke(() => Mouse.GetPosition(MainGrid));
var x = mp.X - Core.Graph.GraphConfig.RaisePoint[(int)Core.Save.Mode].X;
var y = mp.Y - Core.Graph.GraphConfig.RaisePoint[(int)Core.Save.Mode].Y;
if (Math.Abs(x) < 1)
x = 0;
if (Math.Abs(y) < 1)
y = 0;
Core.Controller.MoveWindows(x, y);
rasetype = 0;
DisplayRaising();
}
Expand Down Expand Up @@ -495,6 +507,9 @@ public void Display(IGraph graph, Action EndAction = null)
{
nodisplayLoop = 0;
}
#if DEBUG
Debug.WriteLine(LPSConvert.SerializeObject(graph.GraphInfo, "DISPLAY" + DateTime.Now.Minute, convertNoneLineAttribute: true).ToString());
#endif
//if(graph.GraphType == GraphType.Climb_Up_Left)
//{
// Dispatcher.Invoke(() => Say(graph.GraphType.ToString()));
Expand All @@ -506,7 +521,7 @@ public void Display(IGraph graph, Action EndAction = null)
if (graph.Equals(PetGridTag))
{
petgridcrlf = true;
if(PetGrid2Tag is IGraph ig)
if (PetGrid2Tag is IGraph ig)
ig.Stop(true);
Dispatcher.Invoke(() =>
{
Expand Down

0 comments on commit 6e79f24

Please sign in to comment.