- Increasing width of CM slightly when using description panel

- Some padding and size changes
- A tiny bit of cleanup
This commit is contained in:
Nils Hausfeld
2024-06-16 12:37:46 +02:00
parent b0953e9494
commit 62778fc1e9

View File

@@ -66,7 +66,6 @@ namespace FlaxEditor.Surface.ContextMenu
private readonly VerticalPanel _descriptionInputPanel; private readonly VerticalPanel _descriptionInputPanel;
private readonly VerticalPanel _descriptionOutputPanel; private readonly VerticalPanel _descriptionOutputPanel;
private VisjectCMItem _selectedItem; private VisjectCMItem _selectedItem;
/// <summary> /// <summary>
@@ -75,7 +74,7 @@ namespace FlaxEditor.Surface.ContextMenu
public VisjectCMItem SelectedItem public VisjectCMItem SelectedItem
{ {
get => _selectedItem; get => _selectedItem;
set private set
{ {
_selectedItem = value; _selectedItem = value;
_selectedItem?.OnSelect(); _selectedItem?.OnSelect();
@@ -166,7 +165,7 @@ namespace FlaxEditor.Surface.ContextMenu
_surfaceStyle = info.Style; _surfaceStyle = info.Style;
// Context menu dimensions // Context menu dimensions
Size = new Float2(300, 400); Size = new Float2(_useDescriptionPanel ? 350 : 300, 400);
var headerPanel = new Panel(ScrollBars.None) var headerPanel = new Panel(ScrollBars.None)
{ {
@@ -253,9 +252,6 @@ namespace FlaxEditor.Surface.ContextMenu
{ {
Parent = _descriptionPanel, Parent = _descriptionPanel,
Brush = new SpriteBrush(spriteHandle), Brush = new SpriteBrush(spriteHandle),
Color = Color.Aqua,
MouseOverColor = Color.Aqua,
AutoFocus = false,
}; };
var signatureFontReference = new FontReference(Style.Current.FontMedium.Asset, 9f); var signatureFontReference = new FontReference(Style.Current.FontMedium.Asset, 9f);
@@ -285,16 +281,16 @@ namespace FlaxEditor.Surface.ContextMenu
_descriptionInputPanel = new VerticalPanel() _descriptionInputPanel = new VerticalPanel()
{ {
Parent = _descriptionPanel, Parent = _descriptionPanel,
Width = Width * 0.5f, X = 8,
AnchorPreset = AnchorPresets.TopLeft, Width = Width * 0.5f - 16,
AutoSize = true, AutoSize = true,
}; };
_descriptionOutputPanel = new VerticalPanel() _descriptionOutputPanel = new VerticalPanel()
{ {
Parent = _descriptionPanel, Parent = _descriptionPanel,
X = Width * 0.5f, X = Width * 0.5f + 8,
Width = Width * 0.5f, Width = Width * 0.5f - 16,
AutoSize = true, AutoSize = true,
}; };
} }
@@ -829,7 +825,7 @@ namespace FlaxEditor.Surface.ContextMenu
_descriptionSignatureLabel.Text = memberInfo.DeclaringType + "." + name; _descriptionSignatureLabel.Text = memberInfo.DeclaringType + "." + name;
if (!memberInfo.IsStatic) if (!memberInfo.IsStatic)
AddInputOutputElement(archetype, declaringType, false, $">Instance ({memberInfo.DeclaringType.Name})"); AddInputOutputElement(archetype, declaringType, false, $"Instance ({memberInfo.DeclaringType.Name})");
if (memberInfo.ValueType != ScriptType.Null && memberInfo.ValueType != ScriptType.Void) if (memberInfo.ValueType != ScriptType.Null && memberInfo.ValueType != ScriptType.Void)
{ {
@@ -842,7 +838,7 @@ namespace FlaxEditor.Surface.ContextMenu
for(int i = 0; i < memberInfo.ParametersCount; i++) for(int i = 0; i < memberInfo.ParametersCount; i++)
{ {
var param = memberInfo.GetParameters()[i]; var param = memberInfo.GetParameters()[i];
AddInputOutputElement(archetype, param.Type, param.IsOut, $">{param.Name} ({param.Type.Name})"); AddInputOutputElement(archetype, param.Type, param.IsOut, $"{param.Name} ({param.Type.Name})");
} }
} }
else else
@@ -878,9 +874,9 @@ namespace FlaxEditor.Surface.ContextMenu
{ {
bool isOutput = element.Type == NodeElementType.Output; bool isOutput = element.Type == NodeElementType.Output;
if (element.ConnectionsType == null) if (element.ConnectionsType == null)
AddInputOutputElement(archetype, element.ConnectionsType, isOutput, $"-{element.Text} ({archetype.ConnectionsHints.ToString()})"); AddInputOutputElement(archetype, element.ConnectionsType, isOutput, $"{element.Text} ({archetype.ConnectionsHints.ToString()})");
else else
AddInputOutputElement(archetype, element.ConnectionsType, isOutput, $"-{element.Text} ({element.ConnectionsType.Name})"); AddInputOutputElement(archetype, element.ConnectionsType, isOutput, $"{element.Text} ({element.ConnectionsType.Name})");
} }
} }
} }