Fix border placement in Dropdown control

This commit is contained in:
Wojtek Figat
2024-08-07 17:50:23 +02:00
parent 6e01cca9ad
commit 143d9bcce6

View File

@@ -489,12 +489,14 @@ namespace FlaxEngine.GUI
BorderColor = BorderColorHighlighted,
Width = 4.0f,
AnchorPreset = AnchorPresets.StretchAll,
Offsets = Margin.Zero,
Parent = popup,
};
var itemsHeight = 20.0f;
var itemsMargin = 20.0f;
// Scale height and margive with text height if needed
// Scale height and margin with text height if needed
var textHeight = Font.GetFont().Height;
if (textHeight > itemsHeight)
{
@@ -509,6 +511,7 @@ namespace FlaxEngine.GUI
itemsWidth = Mathf.Max(itemsWidth, itemsMargin + 4 + font.MeasureText(_items[i]).X);
}
*/
var itemsWidth = Width;
var height = container.Margin.Height;
@@ -612,7 +615,7 @@ namespace FlaxEngine.GUI
{
// Find canvas scalar and set as root if it exists.
ContainerControl c = Parent;
while(c.Parent != Root && c.Parent != null)
while (c.Parent != Root && c.Parent != null)
{
c = c.Parent;
if (c is CanvasScaler scalar)