diff --git a/Source/Editor/Windows/Search/SearchItem.cs b/Source/Editor/Windows/Search/SearchItem.cs index 11bc79991..63263cc58 100644 --- a/Source/Editor/Windows/Search/SearchItem.cs +++ b/Source/Editor/Windows/Search/SearchItem.cs @@ -20,6 +20,11 @@ namespace FlaxEditor.Windows.Search /// protected Image _icon; + /// + /// The color of the accent strip. + /// + protected Color _accentColor; + /// /// The item name. /// @@ -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; } + /// + 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); + } + /// public override bool OnMouseUp(Float2 location, MouseButton button) { @@ -86,6 +105,15 @@ namespace FlaxEditor.Windows.Search return base.OnMouseUp(location, button); } + /// + public override void Draw() + { + if (IsMouseOver) + Render2D.FillRectangle(new Rectangle(Float2.Zero, Size), Style.Current.BackgroundHighlighted); + + base.Draw(); + } + /// 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; } /// @@ -128,6 +151,7 @@ namespace FlaxEditor.Windows.Search { _asset = item; _asset.AddReference(this); + _accentColor = Editor.Instance.ContentDatabase.GetProxy(item).AccentColor; } /// @@ -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); } ///