From 6104ee4c711d175263338019bbafc5dec8189ea9 Mon Sep 17 00:00:00 2001 From: Tienyu Yang <53754724+lingrottin@users.noreply.github.com> Date: Thu, 5 Oct 2023 00:24:44 +0800 Subject: [PATCH] Solve #1 --- MapTP.App/MainWindow.xaml.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/MapTP.App/MainWindow.xaml.cs b/MapTP.App/MainWindow.xaml.cs index 81e994c..dedddc6 100644 --- a/MapTP.App/MainWindow.xaml.cs +++ b/MapTP.App/MainWindow.xaml.cs @@ -444,13 +444,21 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b InputX = x.X; InputY = x.Y; - if (started && (tpsx <= x.X && x.X <= tpex) && (tpsy <= x.Y && x.Y <= tpey)) + if (started) { try { int X, Y; - X = (int)Math.Floor((((decimal)(x.X - tpsx) / tpgx * scgx) + scsx) / ScreenSizeX * 65535); - Y = (int)Math.Floor((((decimal)(x.Y - tpsy) / tpgy * scgy) + scsy) / ScreenSizeY * 65535); + X = (tpsx <= x.X ? + (tpex >= x.X ? + (int)Math.Floor((((decimal)(x.X - tpsx) / tpgx * scgx) + scsx) / ScreenSizeX * 65535) + : (int)Math.Floor((decimal)scex/ScreenSizeX*65535) ) + : (int)Math.Floor((decimal)scsx / ScreenSizeX * 65535) ); + Y = (tpsy <= x.Y ? + (tpey >= x.Y ? + (int)Math.Floor((((decimal)(x.Y - tpsy) / tpgy * scgy) + scsy) / ScreenSizeY * 65535) + : (int)Math.Floor((decimal)scey / ScreenSizeY * 65535) ) + : (int)Math.Floor((decimal)scsy / ScreenSizeY * 65535) ); mouseProcessor.MoveCursor(X, Y); }