|
@@ -680,6 +680,7 @@ namespace BansheeEditor
|
|
|
ContentInfo contentInfo = new ContentInfo(this, viewType);
|
|
ContentInfo contentInfo = new ContentInfo(this, viewType);
|
|
|
|
|
|
|
|
Rect2I scrollBounds = contentScrollArea.Bounds;
|
|
Rect2I scrollBounds = contentScrollArea.Bounds;
|
|
|
|
|
+ int availableWidth = scrollBounds.width;
|
|
|
LibraryEntry[] childEntries = entry.Children;
|
|
LibraryEntry[] childEntries = entry.Children;
|
|
|
|
|
|
|
|
if (childEntries.Length == 0)
|
|
if (childEntries.Length == 0)
|
|
@@ -713,7 +714,16 @@ namespace BansheeEditor
|
|
|
rowLayout.AddFlexibleSpace();
|
|
rowLayout.AddFlexibleSpace();
|
|
|
|
|
|
|
|
int elemSize = tileSize + GRID_ENTRY_SPACING;
|
|
int elemSize = tileSize + GRID_ENTRY_SPACING;
|
|
|
- int elemsPerRow = (scrollBounds.width - GRID_ENTRY_SPACING*2)/elemSize;
|
|
|
|
|
|
|
+ int elemsPerRow = (availableWidth - GRID_ENTRY_SPACING * 2) / elemSize;
|
|
|
|
|
+ int numRows = MathEx.CeilToInt(childEntries.Length/(float) elemsPerRow);
|
|
|
|
|
+ int neededHeight = numRows*(elemSize);
|
|
|
|
|
+
|
|
|
|
|
+ bool requiresScrollbar = neededHeight > scrollBounds.height;
|
|
|
|
|
+ if (requiresScrollbar)
|
|
|
|
|
+ {
|
|
|
|
|
+ availableWidth -= contentScrollArea.ScrollBarWidth;
|
|
|
|
|
+ elemsPerRow = (availableWidth - GRID_ENTRY_SPACING * 2) / elemSize;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
int elemsInRow = 0;
|
|
int elemsInRow = 0;
|
|
|
|
|
|
|
@@ -763,11 +773,8 @@ namespace BansheeEditor
|
|
|
|
|
|
|
|
Rect2I contentBounds = contentInfo.main.Bounds;
|
|
Rect2I contentBounds = contentInfo.main.Bounds;
|
|
|
Rect2I minimalBounds = GetScrollAreaBounds();
|
|
Rect2I minimalBounds = GetScrollAreaBounds();
|
|
|
- contentBounds.width = Math.Max(contentBounds.width, minimalBounds.width);
|
|
|
|
|
contentBounds.height = Math.Max(contentBounds.height, minimalBounds.height);
|
|
contentBounds.height = Math.Max(contentBounds.height, minimalBounds.height);
|
|
|
|
|
|
|
|
- Debug.Log(contentBounds + " - " + minimalBounds);
|
|
|
|
|
-
|
|
|
|
|
GUIButton catchAll = new GUIButton("", EditorStyles.Blank);
|
|
GUIButton catchAll = new GUIButton("", EditorStyles.Blank);
|
|
|
catchAll.Bounds = contentBounds;
|
|
catchAll.Bounds = contentBounds;
|
|
|
catchAll.OnClick += OnCatchAllClicked;
|
|
catchAll.OnClick += OnCatchAllClicked;
|
|
@@ -779,11 +786,6 @@ namespace BansheeEditor
|
|
|
|
|
|
|
|
private void OnContentsFocusChanged(bool focus)
|
|
private void OnContentsFocusChanged(bool focus)
|
|
|
{
|
|
{
|
|
|
- if(focus)
|
|
|
|
|
- Debug.Log("GOT FOCUS");
|
|
|
|
|
- else
|
|
|
|
|
- Debug.Log("LOST FOCUS");
|
|
|
|
|
-
|
|
|
|
|
hasContentFocus = focus;
|
|
hasContentFocus = focus;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -879,6 +881,7 @@ namespace BansheeEditor
|
|
|
bounds.y += searchBarBounds.height;
|
|
bounds.y += searchBarBounds.height;
|
|
|
bounds.height -= searchBarBounds.height;
|
|
bounds.height -= searchBarBounds.height;
|
|
|
|
|
|
|
|
|
|
+
|
|
|
return bounds;
|
|
return bounds;
|
|
|
}
|
|
}
|
|
|
|
|
|