Browse Source

Fix issue where camera zooms while scrolling GUI

habeebweeb 4 years ago
parent
commit
586f7b0462
1 changed files with 29 additions and 17 deletions
  1. 29 17
      MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Gui.cs

+ 29 - 17
MultipleMaids/CM3D2/MultipleMaids/Plugin/MultipleMaids.Gui.cs

@@ -130,6 +130,14 @@ namespace CM3D2.MultipleMaids.Plugin
 
                     saveManagerRect = GUI.Window(131, saveManagerRect, SaveManagerWindow, "", style);
 
+                    if (Input.GetAxis("Mouse ScrollWheel") != 0f)
+                    {
+                        if (saveManagerRect.Contains(Event.current.mousePosition))
+                        {
+                            Input.ResetInputAxes();
+                        }
+                    }
+
                     if (!saveManagerInitialize) InitializeSaveManager();
 
                     Rect rect = default;
@@ -226,15 +234,16 @@ namespace CM3D2.MultipleMaids.Plugin
                     if (bgmCombo.isClickedComboButton || bgCombo.isClickedComboButton || doguCombo.isClickedComboButton
                         || parCombo.isClickedComboButton)
                     {
-                        if (Input.GetAxis("Mouse ScrollWheel") != 0.0)
+                        if (Input.GetAxis("Mouse ScrollWheel") != 0f)
                         {
-                            GameMain.Instance.MainCamera.SetControl(!rectWin.Contains(new Vector2(Input.mousePosition.x,
-                                                                                                   Screen.height
-                                                                                                  - Input.mousePosition.y)));
+                            if (rectWin.Contains(Event.current.mousePosition))
+                            {
+                                Input.ResetInputAxes();
+                            }
                         }
                     }
                     else if (!yotogiFlg && sceneLevel != 3 && sceneLevel != 5
-                             && rectWin.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y))
+                             && rectWin.Contains(Event.current.mousePosition)
                              && Input.GetMouseButtonDown(0))
                     {
                         Input.ResetInputAxes();
@@ -244,11 +253,12 @@ namespace CM3D2.MultipleMaids.Plugin
                 }
                 else if (kankyo2Flg)
                 {
-                    if (Input.GetAxis("Mouse ScrollWheel") != 0.0)
+                    if (Input.GetAxis("Mouse ScrollWheel") != 0f)
                     {
-                        GameMain.Instance.MainCamera.SetControl(!rectWin.Contains(new Vector2(Input.mousePosition.x,
-                                                                                               Screen.height
-                                                                                              - Input.mousePosition.y)));
+                        if (rectWin.Contains(Event.current.mousePosition))
+                        {
+                            Input.ResetInputAxes();
+                        }
                     }
 
                     if (!yotogiFlg && sceneLevel != 3 && sceneLevel != 5
@@ -264,11 +274,12 @@ namespace CM3D2.MultipleMaids.Plugin
                 {
                     if (poseGroupCombo.isClickedComboButton || poseCombo.isClickedComboButton || itemCombo.isClickedComboButton)
                     {
-                        if (Input.GetAxis("Mouse ScrollWheel") != 0.0)
+                        if (Input.GetAxis("Mouse ScrollWheel") != 0f)
                         {
-                            GameMain.Instance.MainCamera.SetControl(!rectWin.Contains(new Vector2(Input.mousePosition.x,
-                                                                                                   Screen.height
-                                                                                                  - Input.mousePosition.y)));
+                            if (rectWin.Contains(Event.current.mousePosition))
+                            {
+                                Input.ResetInputAxes();
+                            }
                         }
                     }
                     else if (!yotogiFlg && sceneLevel != 3 && sceneLevel != 5
@@ -284,11 +295,12 @@ namespace CM3D2.MultipleMaids.Plugin
                 {
                     if (faceCombo.isClickedComboButton)
                     {
-                        if (Input.GetAxis("Mouse ScrollWheel") != 0.0)
+                        if (Input.GetAxis("Mouse ScrollWheel") != 0f)
                         {
-                            GameMain.Instance.MainCamera.SetControl(!rectWin.Contains(new Vector2(Input.mousePosition.x,
-                                                                                                   Screen.height
-                                                                                                  - Input.mousePosition.y)));
+                            if (rectWin.Contains(Event.current.mousePosition))
+                            {
+                                Input.ResetInputAxes();
+                            }
                         }
                     }
                     else if (!yotogiFlg && sceneLevel != 3 && sceneLevel != 5