mirror of
https://github.com/codewriter-packages/Tri-Inspector.git
synced 2025-01-22 00:08:51 -05:00
Fix applyOnArrayElement
This commit is contained in:
parent
7dd7768132
commit
28cae2b146
@ -26,12 +26,6 @@ namespace TriInspector.Elements
|
||||
{
|
||||
var drawer = drawers[index];
|
||||
|
||||
if (_property.IsArrayElement && !drawer.ApplyOnArrayElement ||
|
||||
_property.IsArray && drawer.ApplyOnArrayElement)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var canDrawMessage = drawer.CanDraw(_property);
|
||||
if (!string.IsNullOrEmpty(canDrawMessage))
|
||||
{
|
||||
|
@ -88,7 +88,9 @@ namespace TriInspector
|
||||
if (_hideProcessorsBackingField == null)
|
||||
{
|
||||
_hideProcessorsBackingField =
|
||||
TriDrawersUtilities.CreateHideProcessorsFor(Attributes).ToList();
|
||||
TriDrawersUtilities.CreateHideProcessorsFor(Attributes)
|
||||
.Where(it => CanApplyOn(this, applyOnArrayElement: false))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return _hideProcessorsBackingField;
|
||||
@ -102,7 +104,9 @@ namespace TriInspector
|
||||
if (_disableProcessorsBackingField == null)
|
||||
{
|
||||
_disableProcessorsBackingField =
|
||||
TriDrawersUtilities.CreateDisableProcessorsFor(Attributes).ToList();
|
||||
TriDrawersUtilities.CreateDisableProcessorsFor(Attributes)
|
||||
.Where(it => CanApplyOn(this, applyOnArrayElement: false))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return _disableProcessorsBackingField;
|
||||
@ -118,6 +122,7 @@ namespace TriInspector
|
||||
_drawersBackingField = Enumerable.Empty<TriCustomDrawer>()
|
||||
.Concat(TriDrawersUtilities.CreateValueDrawersFor(FieldType))
|
||||
.Concat(TriDrawersUtilities.CreateAttributeDrawersFor(Attributes))
|
||||
.Where(it => CanApplyOn(this, it.ApplyOnArrayElement))
|
||||
.OrderBy(it => it.Order)
|
||||
.ToList();
|
||||
}
|
||||
@ -135,6 +140,7 @@ namespace TriInspector
|
||||
_validatorsBackingField = Enumerable.Empty<TriValidator>()
|
||||
.Concat(TriDrawersUtilities.CreateValueValidatorsFor(FieldType))
|
||||
.Concat(TriDrawersUtilities.CreateAttributeValidatorsFor(Attributes))
|
||||
.Where(it => CanApplyOn(this, it.ApplyOnArrayElement))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@ -230,5 +236,16 @@ namespace TriInspector
|
||||
{
|
||||
return (self, obj, value) => { };
|
||||
}
|
||||
|
||||
private static bool CanApplyOn(TriPropertyDefinition definition, bool applyOnArrayElement)
|
||||
{
|
||||
if (definition.IsArrayElement && !applyOnArrayElement ||
|
||||
definition.IsArray && applyOnArrayElement)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user