Refactor ContextMenuChildMenu to inherit from ContextMenuButton

This commit is contained in:
Wojciech Figat
2021-11-16 20:45:12 +01:00
parent d33829f5eb
commit 4722b58a40
2 changed files with 4 additions and 36 deletions

View File

@@ -108,7 +108,6 @@ namespace FlaxEditor.GUI.ContextMenu
/// <inheritdoc />
public override void Draw()
{
// Cache data
var style = Style.Current;
var backgroundRect = new Rectangle(-X + 3, 0, Parent.Width - 6, Height);
var textRect = new Rectangle(0, 0, Width - 8, Height);
@@ -228,15 +227,11 @@ namespace FlaxEditor.GUI.ContextMenu
{
var style = Style.Current;
float width = 20;
if (style.FontMedium)
{
width += style.FontMedium.MeasureText(Text).X;
if (ShortKeys.Length > 0)
{
if (!string.IsNullOrEmpty(ShortKeys))
width += 40 + style.FontMedium.MeasureText(ShortKeys).X;
}
}
return Mathf.Max(width, base.MinimumWidth);