ソースを参照

Fixed an issue with auto-scroll in Library window when there is no area to scroll
Fixed GUI tree view so that selection overlay is removed when mouse leaves the area
Potentially fixing an issue where undocking a window was causing a crash because GUIWidget was alive for a frame longer than its parent window

BearishSun 10 年 前
コミット
cf37238b9d

+ 2 - 2
BansheeEditor/Source/BsDockManager.cpp

@@ -240,7 +240,7 @@ namespace BansheeEngine
 
 		if (mGUIWidgetSO != nullptr)
 		{
-			mGUIWidgetSO->destroy();
+			mGUIWidgetSO->destroy(true);
 			mGUIWidgetSO = nullptr;
 		}
 
@@ -310,7 +310,7 @@ namespace BansheeEngine
 				bs_delete(mWidgets);
 				mWidgets = nullptr;
 
-				mGUIWidgetSO->destroy();
+				mGUIWidgetSO->destroy(true);
 				mGUIWidgetSO = nullptr;
 
 				mIsLeaf = true;

+ 5 - 0
BansheeEditor/Source/BsGUITreeView.cpp

@@ -433,6 +433,11 @@ namespace BansheeEngine
 			mDragInProgress = false;
 			_markLayoutAsDirty();
 		}
+		else if(event.getType() == GUIMouseEventType::MouseDragAndDropLeft)
+		{
+			mDragInProgress = false;
+			_markLayoutAsDirty();
+		}
 
 		return false;
 	}

+ 6 - 2
BansheeEngine/Source/BsGUIScrollArea.cpp

@@ -270,22 +270,26 @@ namespace BansheeEngine
 
 		// Recalculate offsets in case scroll percent got updated externally (this needs to be delayed to this point because
 		// at the time of the update content and visible sizes might be out of date).
+		UINT32 scrollableHeight = (UINT32)std::max(0, INT32(mContentSize.y) - INT32(mVisibleSize.y));
 		if (mRecalculateVertOffset)
 		{
-			UINT32 scrollableHeight = (UINT32)std::max(0, INT32(mContentSize.y) - INT32(vertScrollBounds.height));
 			mVertOffset = scrollableHeight * Math::clamp01(mVertScroll->getScrollPos());
 
 			mRecalculateVertOffset = false;
 		}
 
+		UINT32 scrollableWidth = (UINT32)std::max(0, INT32(mContentSize.x) - INT32(mVisibleSize.x));
 		if (mRecalculateHorzOffset)
 		{
-			UINT32 scrollableWidth = (UINT32)std::max(0, INT32(mContentSize.x) - INT32(horzScrollBounds.width));
 			mHorzOffset = scrollableWidth * Math::clamp01(mHorzScroll->getScrollPos());
 
 			mRecalculateHorzOffset = false;
 		}
 
+		// Reset offset in case layout size changed so everything fits
+		mVertOffset = Math::clamp(mVertOffset, 0.0f, (float)scrollableHeight);
+		mHorzOffset = Math::clamp(mHorzOffset, 0.0f, (float)scrollableWidth);
+
 		// Layout
 		if (mContentLayout->_isActive())
 		{

+ 1 - 1
MBansheeEditor/Inspector/InspectableFloat.cs

@@ -47,7 +47,7 @@ namespace BansheeEditor
         public override InspectableState Refresh(int layoutIndex)
         {
             if (guiFloatField != null && !guiFloatField.HasInputFocus)
-                guiFloatField.Value = property.GetValue<int>();
+                guiFloatField.Value = property.GetValue<float>();
 
             InspectableState oldState = state;
             if (state.HasFlag(InspectableState.Modified))

+ 1 - 1
MBansheeEditor/Library/LibraryWindow.cs

@@ -31,7 +31,7 @@ namespace BansheeEditor
         }
 
         private const int DRAG_SCROLL_HEIGHT = 20;
-        private const int DRAG_SCROLL_AMOUNT_PER_SECOND = 100;
+        private const int DRAG_SCROLL_AMOUNT_PER_SECOND = 300;
         private const int FOLDER_BUTTON_WIDTH = 30;
         private const int FOLDER_SEPARATOR_WIDTH = 10;
         private const string CURRENT_LIBRARY_DIRECTORY_KEY = "__CurrentLibDir";

+ 1 - 5
MBansheeEditor/ProjectWindow.cs

@@ -1,11 +1,7 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 using System;
-using System.Collections.Generic;
 using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using BansheeEngine;
 
 namespace BansheeEditor
@@ -13,7 +9,7 @@ namespace BansheeEditor
     /// <summary>
     /// Project management window that allows the user to open and create new projects.
     /// </summary>
-    public class ProjectWindow : ModalWindow
+    internal sealed class ProjectWindow : ModalWindow
     {
         private GUITextField projectInputBox;
         private GUIScrollArea recentProjectsArea;