diff --git a/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs b/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs index 954599347..9844f3fda 100644 --- a/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs +++ b/Source/Editor/CustomEditors/Dedicated/ScriptsEditor.cs @@ -909,7 +909,8 @@ namespace FlaxEditor.CustomEditors.Dedicated settingsButton.Tag = script; settingsButton.Clicked += OnSettingsButtonClicked; - group.Panel.HeaderTextMargin = new Margin(scriptDrag.Right - 12, 15, 2, 2); + // Adjust margin to not overlap with other ui elements in the header + group.Panel.HeaderTextMargin = group.Panel.HeaderTextMargin with { Left = scriptDrag.Right - 12, Right = settingsButton.Width + Utilities.Constants.UIMargin }; group.Object(values, editor); // Remove drop down arrows and containment lines if no objects in the group if (group.Children.Count == 0) diff --git a/Source/Editor/CustomEditors/Elements/Container/GroupElement.cs b/Source/Editor/CustomEditors/Elements/Container/GroupElement.cs index 64bc9080b..055c6a29d 100644 --- a/Source/Editor/CustomEditors/Elements/Container/GroupElement.cs +++ b/Source/Editor/CustomEditors/Elements/Container/GroupElement.cs @@ -44,7 +44,8 @@ namespace FlaxEditor.CustomEditors.Elements { var style = Style.Current; var settingsButtonSize = Panel.HeaderHeight; - return new Image + Panel.HeaderTextMargin = Panel.HeaderTextMargin with { Right = settingsButtonSize + Utilities.Constants.UIMargin }; +; return new Image { TooltipText = "Settings", AutoFocus = true, diff --git a/Source/Engine/UI/GUI/Panels/DropPanel.cs b/Source/Engine/UI/GUI/Panels/DropPanel.cs index de80f9fc5..b3eae40a5 100644 --- a/Source/Engine/UI/GUI/Panels/DropPanel.cs +++ b/Source/Engine/UI/GUI/Panels/DropPanel.cs @@ -368,7 +368,7 @@ namespace FlaxEngine.GUI var style = Style.Current; var enabled = EnabledInHierarchy; - // Paint Background + // Draw Background var backgroundColor = BackgroundColor; if (backgroundColor.A > 0.0f) { @@ -395,7 +395,7 @@ namespace FlaxEngine.GUI ArrowImageOpened?.Draw(dropDownRect, arrowColor); } - // Text + // Header text var textRect = new Rectangle(textLeft, 0, Width - textLeft, HeaderHeight); _headerTextMargin.ShrinkRectangle(ref textRect); var textColor = HeaderTextColor; @@ -404,7 +404,9 @@ namespace FlaxEngine.GUI textColor *= 0.6f; } + Render2D.PushClip(textRect); Render2D.DrawText(HeaderTextFont.GetFont(), HeaderTextMaterial, HeaderText, textRect, textColor, TextAlignment.Near, TextAlignment.Center); + Render2D.PopClip(); if (!_isClosed && EnableContainmentLines) {