fix search item hover auto focusing item
Change what happens when search items get focused to prevent focus being taken away from search box. Also adds a highlight to mouse hovered search item.
This commit is contained in:
@@ -74,6 +74,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 +100,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 +116,7 @@ namespace FlaxEditor.Windows.Search
|
||||
|
||||
var root = RootWindow;
|
||||
if (root != null)
|
||||
{
|
||||
root.Cursor = CursorType.Hand;
|
||||
}
|
||||
|
||||
_finder.SelectedItem = this;
|
||||
_finder.Hand = true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -176,9 +194,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();
|
||||
|
||||
Reference in New Issue
Block a user