2021-12-07 10:20:36 -05:00
|
|
|
|
using TriInspector;
|
|
|
|
|
using TriInspector.Drawers;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2022-01-06 12:11:27 -05:00
|
|
|
|
[assembly: RegisterTriAttributeDrawer(typeof(PropertySpaceDrawer), TriDrawerOrder.Inspector)]
|
2021-12-07 10:20:36 -05:00
|
|
|
|
|
|
|
|
|
namespace TriInspector.Drawers
|
|
|
|
|
{
|
|
|
|
|
public class PropertySpaceDrawer : TriAttributeDrawer<PropertySpaceAttribute>
|
|
|
|
|
{
|
|
|
|
|
public override float GetHeight(float width, TriProperty property, TriElement next)
|
|
|
|
|
{
|
|
|
|
|
var totalSpace = Attribute.SpaceBefore + Attribute.SpaceAfter;
|
|
|
|
|
|
|
|
|
|
return next.GetHeight(width) + totalSpace;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnGUI(Rect position, TriProperty property, TriElement next)
|
|
|
|
|
{
|
|
|
|
|
var contentPosition = new Rect(position)
|
|
|
|
|
{
|
|
|
|
|
yMin = position.yMin + Attribute.SpaceBefore,
|
|
|
|
|
yMax = position.yMax - Attribute.SpaceAfter,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
next.OnGUI(contentPosition);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|