Преглед изворни кода

Fixed scene camera so it doesn't force the cursor to always be displayed

BearishSun пре 9 година
родитељ
комит
e0dee9de45
1 измењених фајлова са 10 додато и 5 уклоњено
  1. 10 5
      Source/MBansheeEditor/Windows/Scene/SceneCamera.cs

+ 10 - 5
Source/MBansheeEditor/Windows/Scene/SceneCamera.cs

@@ -55,7 +55,7 @@ namespace BansheeEditor
         private float currentSpeed;
         private Degree yaw;
         private Degree pitch;
-        private bool lastButtonState;
+        private bool lastHideCursorState;
         private Camera camera;
         private bool inputEnabled = true;
 
@@ -168,7 +168,7 @@ namespace BansheeEditor
                 bool isPanning = VirtualInput.IsButtonHeld(panBtn);
 
                 bool hideCursor = camActive || isPanning;
-                if (hideCursor != lastButtonState)
+                if (hideCursor != lastHideCursorState)
                 {
                     if (hideCursor)
                     {
@@ -188,7 +188,7 @@ namespace BansheeEditor
                         Cursor.ClipDisable();
                     }
 
-                    lastButtonState = hideCursor;
+                    lastHideCursorState = hideCursor;
                 }
 
                 float frameDelta = Time.FrameDelta;
@@ -261,8 +261,13 @@ namespace BansheeEditor
             }
             else
             {
-                Cursor.Show();
-                Cursor.ClipDisable();
+                if (lastHideCursorState)
+                {
+                    Cursor.Show();
+                    Cursor.ClipDisable();
+
+                    lastHideCursorState = false;
+                }
             }
 
             SceneWindow sceneWindow = EditorWindow.GetWindow<SceneWindow>();