This commit is contained in:
2026-05-19 17:39:03 +07:00
parent bf0ebe447d
commit 5da832bb57
559 changed files with 69543 additions and 1 deletions

View File

@@ -0,0 +1,50 @@
using UnityEngine.UIElements;
using UnityEditor.UIElements;
using UnityEditor;
namespace Rive.EditorTools
{
/// <summary>
/// A field for editing a Vector2Int representing width and height.
/// </summary>
internal class WidthHeightDimensionsField : VisualElement
{
public IntegerField WidthField { get; private set; }
public IntegerField HeightField { get; private set; }
public WidthHeightDimensionsField(string label, string widthLabel = "Width", string heightLabel = "Height", string tooltip = null)
{
var foldout = new Foldout
{
text = label,
tooltip = tooltip,
value = true // Start expanded
};
Add(foldout);
var container = new VisualElement();
foldout.Add(container);
WidthField = new IntegerField(widthLabel)
{
style = { marginTop = 4 }
};
WidthField.AddToClassList(BaseField<int>.alignedFieldUssClassName);
container.Add(WidthField);
HeightField = new IntegerField(heightLabel)
{
style = { marginTop = 4 }
};
HeightField.AddToClassList(BaseField<int>.alignedFieldUssClassName);
container.Add(HeightField);
}
public void BindProperty(SerializedProperty property)
{
WidthField.BindProperty(property.FindPropertyRelative("x"));
HeightField.BindProperty(property.FindPropertyRelative("y"));
}
}
}