From c3a1312285cd3415b6e42881833958b773633d59 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Wed, 2 Sep 2026 23:08:23 +0200 Subject: [PATCH] Add RMB and MMB actions to Type Editor control --- .../CustomEditors/Editors/TypeEditor.cs | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/Editor/CustomEditors/Editors/TypeEditor.cs b/Source/Editor/CustomEditors/Editors/TypeEditor.cs index 9b0a0d3db..fec571017 100644 --- a/Source/Editor/CustomEditors/Editors/TypeEditor.cs +++ b/Source/Editor/CustomEditors/Editors/TypeEditor.cs @@ -32,7 +32,7 @@ namespace FlaxEditor.CustomEditors.Editors private DragHandlers _dragHandlers; /// - /// Gets or sets the allowed type (given type and all sub classes). Must be type of any subclass. + /// Gets or sets the allowed type (given type and all subclasses). Must be type of any subclass. /// public ScriptType Type { @@ -209,7 +209,6 @@ namespace FlaxEditor.CustomEditors.Editors /// public override bool OnMouseUp(Float2 location, MouseButton button) { - // Cache data bool isSelected = _value != ScriptType.Null; var frameRect = new Rectangle(0, 0, Width - 16, 16); if (isSelected && _type == ScriptType.Null) @@ -220,11 +219,30 @@ namespace FlaxEditor.CustomEditors.Editors // Deselect if (_value && button1Rect.Contains(ref location) && _type == ScriptType.Null) + { + Focus(); Value = ScriptType.Null; + return true; + } // Picker dropdown menu if ((isSelected && _type == ScriptType.Null ? button2Rect : button1Rect).Contains(ref location)) + { ShowDropDownMenu(); + return true; + } + + // Clear value with MMB or show picker with RMB + if (button == MouseButton.Middle) + { + Focus(); + Value = ScriptType.Null; + return true; + } + if (button == MouseButton.Right) + { + ShowDropDownMenu(); + } return base.OnMouseUp(location, button); }