Browse Source

Change mouse position logic

Mouse position past the screen will only be calculated while the left
mouse button is held down.
habeebweeb 4 years ago
parent
commit
aae90d7bc1
1 changed files with 6 additions and 5 deletions
  1. 6 5
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Utility.cs

+ 6 - 5
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Utility.cs

@@ -223,14 +223,15 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
 
         private void Update()
         {
-            mousePosition.x += Input.GetAxis("Mouse X") * 20;
-            mousePosition.y += Input.GetAxis("Mouse Y") * 20;
-
-            if (Input.GetMouseButtonUp(0) || Input.GetMouseButtonDown(0)) mousePosition = Input.mousePosition;
+            if (Input.GetMouseButton(0))
+            {
+                mousePosition.x += Input.GetAxis("Mouse X") * 20;
+                mousePosition.y += Input.GetAxis("Mouse Y") * 20;
+            }
+            else mousePosition = Input.mousePosition;
         }
     }
 
-
     public static class BinaryExtensions
     {
         public static string ReadNullableString(this BinaryReader binaryReader)