Merge branch 'ContentSearchMouseOverFocusFix' of https://github.com/xxSeys1/FlaxEngine into xxSeys1-ContentSearchMouseOverFocusFix
This commit is contained in:
@@ -20,6 +20,11 @@ namespace FlaxEditor.Windows.Search
|
||||
/// </summary>
|
||||
protected Image _icon;
|
||||
|
||||
/// <summary>
|
||||
/// The color of the accent strip.
|
||||
/// </summary>
|
||||
protected Color _accentColor;
|
||||
|
||||
/// <summary>
|
||||
/// The item name.
|
||||
/// </summary>
|
||||
@@ -56,7 +61,7 @@ namespace FlaxEditor.Windows.Search
|
||||
var icon = new Image
|
||||
{
|
||||
Size = new Float2(logoSize),
|
||||
Location = new Float2(5, (height - logoSize) / 2)
|
||||
Location = new Float2(7, (height - logoSize) / 2)
|
||||
};
|
||||
_icon = icon;
|
||||
|
||||
@@ -74,6 +79,20 @@ namespace FlaxEditor.Windows.Search
|
||||
typeLabel.TextColor = Style.Current.ForegroundGrey;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseDown(Float2 location, MouseButton button)
|
||||
{
|
||||
// Select and focus the item on right click to prevent the search from being cleared
|
||||
if (button == MouseButton.Right)
|
||||
{
|
||||
_finder.SelectedItem = this;
|
||||
_finder.Hand = true;
|
||||
Focus();
|
||||
return true;
|
||||
}
|
||||
return base.OnMouseUp(location, button);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnMouseUp(Float2 location, MouseButton button)
|
||||
{
|
||||
@@ -86,6 +105,15 @@ namespace FlaxEditor.Windows.Search
|
||||
return base.OnMouseUp(location, button);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
{
|
||||
if (IsMouseOver)
|
||||
Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), Style.Current.BackgroundHighlighted);
|
||||
|
||||
base.Draw();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseEnter(Float2 location)
|
||||
{
|
||||
@@ -93,12 +121,7 @@ namespace FlaxEditor.Windows.Search
|
||||
|
||||
var root = RootWindow;
|
||||
if (root != null)
|
||||
{
|
||||
root.Cursor = CursorType.Hand;
|
||||
}
|
||||
|
||||
_finder.SelectedItem = this;
|
||||
_finder.Hand = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -128,6 +151,7 @@ namespace FlaxEditor.Windows.Search
|
||||
{
|
||||
_asset = item;
|
||||
_asset.AddReference(this);
|
||||
_accentColor = Editor.Instance.ContentDatabase.GetProxy(item).AccentColor;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -176,9 +200,7 @@ namespace FlaxEditor.Windows.Search
|
||||
{
|
||||
string importLocation = System.IO.Path.GetDirectoryName(importPath);
|
||||
if (!string.IsNullOrEmpty(importLocation) && System.IO.Directory.Exists(importLocation))
|
||||
{
|
||||
cm.AddButton("Show import location", () => FileSystem.ShowFileExplorer(importLocation));
|
||||
}
|
||||
}
|
||||
}
|
||||
cm.AddSeparator();
|
||||
@@ -212,6 +234,10 @@ namespace FlaxEditor.Windows.Search
|
||||
// Draw icon
|
||||
var iconRect = _icon.Bounds;
|
||||
_asset.DrawThumbnail(ref iconRect);
|
||||
|
||||
// Draw color strip
|
||||
var rect = iconRect with { Width = 2, Height = Height, Location = new Float2(2, 0) };
|
||||
Render2D.FillRectangle(rect, _accentColor);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user