Merge remote-tracking branch 'origin/master' into 1.9
This commit is contained in:
@@ -103,9 +103,9 @@ namespace FlaxEditor.GUI
|
||||
|
||||
private Rectangle Button1Rect => new Rectangle(Height + ButtonsOffset, 0, ButtonsSize, ButtonsSize);
|
||||
|
||||
private Rectangle Button2Rect => new Rectangle(Height + ButtonsOffset, ButtonsSize, ButtonsSize, ButtonsSize);
|
||||
private Rectangle Button2Rect => new Rectangle(Height + ButtonsOffset, ButtonsSize + 2, ButtonsSize, ButtonsSize);
|
||||
|
||||
private Rectangle Button3Rect => new Rectangle(Height + ButtonsOffset, ButtonsSize * 2, ButtonsSize, ButtonsSize);
|
||||
private Rectangle Button3Rect => new Rectangle(Height + ButtonsOffset, (ButtonsSize + 2) * 2, ButtonsSize, ButtonsSize);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
@@ -147,6 +147,13 @@ namespace FlaxEditor.GUI
|
||||
style.Foreground,
|
||||
TextAlignment.Near,
|
||||
TextAlignment.Center);
|
||||
Render2D.DrawText(
|
||||
style.FontSmall,
|
||||
$"{TypeUtils.GetTypeDisplayName(Validator.AssetType.Type)}",
|
||||
new Rectangle(button1Rect.Right + 2, ButtonsSize + 2, sizeForTextLeft, ButtonsSize),
|
||||
style.ForegroundGrey,
|
||||
TextAlignment.Near,
|
||||
TextAlignment.Center);
|
||||
}
|
||||
}
|
||||
// Check if has no item but has an asset (eg. virtual asset)
|
||||
@@ -169,6 +176,13 @@ namespace FlaxEditor.GUI
|
||||
style.Foreground,
|
||||
TextAlignment.Near,
|
||||
TextAlignment.Center);
|
||||
Render2D.DrawText(
|
||||
style.FontSmall,
|
||||
$"{TypeUtils.GetTypeDisplayName(Validator.AssetType.Type)}",
|
||||
new Rectangle(button1Rect.Right + 2, ButtonsSize + 2, sizeForTextLeft, ButtonsSize),
|
||||
style.ForegroundGrey,
|
||||
TextAlignment.Near,
|
||||
TextAlignment.Center);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -176,6 +190,24 @@ namespace FlaxEditor.GUI
|
||||
// No element selected
|
||||
Render2D.FillRectangle(iconRect, style.BackgroundNormal);
|
||||
Render2D.DrawText(style.FontMedium, "No asset\nselected", iconRect, Color.Orange, TextAlignment.Center, TextAlignment.Center, TextWrapping.NoWrap, 1.0f, Height / DefaultIconSize);
|
||||
float sizeForTextLeft = Width - button1Rect.Right;
|
||||
if (sizeForTextLeft > 30)
|
||||
{
|
||||
Render2D.DrawText(
|
||||
style.FontSmall,
|
||||
$"None",
|
||||
new Rectangle(button1Rect.Right + 2, 0, sizeForTextLeft, ButtonsSize),
|
||||
style.Foreground,
|
||||
TextAlignment.Near,
|
||||
TextAlignment.Center);
|
||||
Render2D.DrawText(
|
||||
style.FontSmall,
|
||||
$"{TypeUtils.GetTypeDisplayName(Validator.AssetType.Type)}",
|
||||
new Rectangle(button1Rect.Right + 2, ButtonsSize + 2, sizeForTextLeft, ButtonsSize),
|
||||
style.ForegroundGrey,
|
||||
TextAlignment.Near,
|
||||
TextAlignment.Center);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if drag is over
|
||||
|
||||
@@ -629,7 +629,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
|
||||
internal void MoveTabRight(int index)
|
||||
{
|
||||
if (index < _tabs.Count - 2)
|
||||
if (index < _tabs.Count - 1)
|
||||
{
|
||||
var tab = _tabs[index];
|
||||
_tabs.RemoveAt(index);
|
||||
|
||||
@@ -51,6 +51,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
public DockWindow StartDragAsyncWindow;
|
||||
|
||||
private Rectangle HeaderRectangle => new Rectangle(0, 0, Width, DockPanel.DefaultHeaderHeight);
|
||||
private bool IsSingleFloatingWindow => _panel.TabsCount == 1 && _panel.IsFloating && _panel.ChildPanelsCount == 0;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DockPanelProxy"/> class.
|
||||
@@ -187,6 +188,10 @@ namespace FlaxEditor.GUI.Docking
|
||||
var headerRect = HeaderRectangle;
|
||||
var tabsCount = _panel.TabsCount;
|
||||
|
||||
// Return and don't draw tab if only 1 window and it is floating
|
||||
if (IsSingleFloatingWindow)
|
||||
return;
|
||||
|
||||
// Check if has only one window docked
|
||||
if (tabsCount == 1)
|
||||
{
|
||||
@@ -321,6 +326,9 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
|
||||
{
|
||||
if (IsSingleFloatingWindow)
|
||||
return base.OnMouseDoubleClick(location, button);
|
||||
|
||||
// Maximize/restore on double click
|
||||
var tab = GetTabAtPos(location, out _);
|
||||
var rootWindow = tab?.RootWindow;
|
||||
@@ -339,6 +347,8 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||
{
|
||||
if (IsSingleFloatingWindow)
|
||||
return base.OnMouseDown(location, button);
|
||||
MouseDownWindow = GetTabAtPos(location, out IsMouseDownOverCross);
|
||||
|
||||
// Check buttons
|
||||
@@ -368,6 +378,9 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseUp(Float2 location, MouseButton button)
|
||||
{
|
||||
if (IsSingleFloatingWindow)
|
||||
return base.OnMouseUp(location, button);
|
||||
|
||||
// Check tabs under mouse position at the beginning and at the end
|
||||
var tab = GetTabAtPos(location, out var overCross);
|
||||
|
||||
@@ -410,7 +423,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
public override void OnMouseMove(Float2 location)
|
||||
{
|
||||
MousePosition = location;
|
||||
if (IsMouseLeftButtonDown)
|
||||
if (IsMouseLeftButtonDown && !IsSingleFloatingWindow)
|
||||
{
|
||||
// Check if mouse is outside the header
|
||||
if (!HeaderRectangle.Contains(location))
|
||||
@@ -501,7 +514,10 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// <inheritdoc />
|
||||
public override void GetDesireClientArea(out Rectangle rect)
|
||||
{
|
||||
rect = new Rectangle(0, DockPanel.DefaultHeaderHeight, Width, Height - DockPanel.DefaultHeaderHeight);
|
||||
if (IsSingleFloatingWindow)
|
||||
rect = new Rectangle(0, 0, Width, Height);
|
||||
else
|
||||
rect = new Rectangle(0, DockPanel.DefaultHeaderHeight, Width, Height - DockPanel.DefaultHeaderHeight);
|
||||
}
|
||||
|
||||
private DragDropEffect TrySelectTabUnderLocation(ref Float2 location)
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace FlaxEditor.GUI
|
||||
ContentItem = item;
|
||||
ContentItem.AddReference(this);
|
||||
|
||||
Name = item.ShortName;
|
||||
OnItemRenamed(item);
|
||||
TooltipText = item.Path;
|
||||
|
||||
Height = IconSize + 4;
|
||||
@@ -82,7 +82,9 @@ namespace FlaxEditor.GUI
|
||||
/// <inheritdoc />
|
||||
public void OnItemRenamed(ContentItem item)
|
||||
{
|
||||
Name = ContentItem.ShortName;
|
||||
Name = item.ShortName;
|
||||
if (item is ScriptItem)
|
||||
Name = item.FileName; // Show extension for scripts (esp. for .h and .cpp files of the same name)
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user