com.alicizax.unity.editor.e.../Editor/Toolbar/RecommendedStyles/DropdownFieldRecommendedStyle.cs

27 lines
757 B
C#
Raw Permalink Normal View History

2025-08-01 19:32:29 +08:00
using UnityEngine.UIElements;
namespace Paps.UnityToolbarExtenderUIToolkit
{
internal class DropdownFieldRecommendedStyle : RecommendedStyle
{
private DropdownField _dropdownField;
public DropdownFieldRecommendedStyle(DropdownField dropdownField)
{
_dropdownField = dropdownField;
}
protected override void ApplyRootElementStyle()
{
_dropdownField.labelElement.style.minWidth = Length.Auto();
var inputFieldIndex = 1;
if (string.IsNullOrEmpty(_dropdownField.label))
inputFieldIndex = 0;
var inputElement = _dropdownField[inputFieldIndex];
inputElement.style.overflow = Overflow.Visible;
}
}
}