This commit is contained in:
CortexCore
2024-06-17 14:38:09 +08:00
parent 3d447499fe
commit 65f9e40105
8 changed files with 86 additions and 14 deletions

View File

@@ -133,22 +133,14 @@ namespace BITKit
};
if (fieldInfo is not null && Attribute.IsDefined(fieldInfo, typeof(ReadOnlyAttribute), true))
{
var attribute = fieldInfo.GetCustomAttribute<ReadOnlyAttribute>();
field.pickingMode = PickingMode.Ignore;
field.SetEnabled(false);
field.style.opacity = 1;
var x = field.Q("unity-text-input");
var clearColor = new Color(0, 0, 0, 0);
if (x is not null)
field.AddToClassList("readonly");
if (attribute.HideLabel)
{
x.style.backgroundColor = clearColor;
x.style.borderTopColor = clearColor;
x.style.borderBottomColor = clearColor;
x.style.borderLeftColor = clearColor;
x.style.borderRightColor = clearColor;
foreach (var visualElement in field.Children())
{
visualElement.pickingMode = PickingMode.Ignore;
}
field.AddToClassList("hide-label");
}
}