fix group element text clipping
fixes group element header text clipping outside of the header and into the settings icon (if there is one). Also some extra code to handle script editor, as that displays some extra icons in the header.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -361,7 +361,7 @@ namespace FlaxEngine.GUI
|
||||
var style = Style.Current;
|
||||
var enabled = EnabledInHierarchy;
|
||||
|
||||
// Paint Background
|
||||
// Draw Background
|
||||
var backgroundColor = BackgroundColor;
|
||||
if (backgroundColor.A > 0.0f)
|
||||
{
|
||||
@@ -388,7 +388,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;
|
||||
@@ -397,7 +397,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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user