fixed some cpp tests compilation issues, improved c# value struct
This commit is contained in:
@@ -31,12 +31,12 @@ namespace Facebook.Yoga
|
||||
Spacing margin = null,
|
||||
Spacing padding = null,
|
||||
Border border = null,
|
||||
YogaValue? Width = null,
|
||||
YogaValue? Height = null,
|
||||
YogaValue? MaxWidth = null,
|
||||
YogaValue? MaxHeight = null,
|
||||
YogaValue? MinWidth = null,
|
||||
YogaValue? MinHeight = null)
|
||||
YogaValue? width = null,
|
||||
YogaValue? height = null,
|
||||
YogaValue? maxWidth = null,
|
||||
YogaValue? maxHeight = null,
|
||||
YogaValue? minWidth = null,
|
||||
YogaValue? minHeight = null)
|
||||
{
|
||||
YogaNode node = new YogaNode();
|
||||
|
||||
@@ -197,34 +197,34 @@ namespace Facebook.Yoga
|
||||
}
|
||||
}
|
||||
|
||||
if (Width.HasValue)
|
||||
if (width.HasValue)
|
||||
{
|
||||
node.Width = Width.Value;
|
||||
node.Width = width.Value;
|
||||
}
|
||||
|
||||
if (Height.HasValue)
|
||||
if (height.HasValue)
|
||||
{
|
||||
node.Height = Height.Value;
|
||||
node.Height = height.Value;
|
||||
}
|
||||
|
||||
if (MinWidth.HasValue)
|
||||
if (minWidth.HasValue)
|
||||
{
|
||||
node.MinWidth = MinWidth.Value;
|
||||
node.MinWidth = minWidth.Value;
|
||||
}
|
||||
|
||||
if (MinHeight.HasValue)
|
||||
if (minHeight.HasValue)
|
||||
{
|
||||
node.MinHeight = MinHeight.Value;
|
||||
node.MinHeight = minHeight.Value;
|
||||
}
|
||||
|
||||
if (MaxWidth.HasValue)
|
||||
if (maxWidth.HasValue)
|
||||
{
|
||||
node.MaxWidth = MaxWidth.Value;
|
||||
node.MaxWidth = maxWidth.Value;
|
||||
}
|
||||
|
||||
if (MaxHeight.HasValue)
|
||||
if (maxHeight.HasValue)
|
||||
{
|
||||
node.MaxHeight = MaxHeight.Value;
|
||||
node.MaxHeight = maxHeight.Value;
|
||||
}
|
||||
|
||||
return node;
|
||||
|
@@ -16,7 +16,7 @@ namespace Facebook.Yoga
|
||||
{
|
||||
private float Value;
|
||||
private YogaUnit Unit;
|
||||
private byte isDefined;
|
||||
private byte isDefined; /* use byte to keep struct blitable */
|
||||
|
||||
public bool IsDefined => isDefined != 0;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Facebook.Yoga
|
||||
return new YogaValue
|
||||
{
|
||||
Value = value,
|
||||
isDefined = 1,
|
||||
isDefined = YogaConstants.IsUndefined(value) ? (byte)0 : (byte)1,
|
||||
Unit = YogaUnit.Pixel
|
||||
};
|
||||
}
|
||||
@@ -49,12 +49,22 @@ namespace Facebook.Yoga
|
||||
}
|
||||
}
|
||||
|
||||
public static YogaValue Undefined()
|
||||
{
|
||||
return new YogaValue
|
||||
{
|
||||
Value = YogaConstants.Undefined,
|
||||
isDefined = 0,
|
||||
Unit = YogaUnit.Pixel
|
||||
};
|
||||
}
|
||||
|
||||
public static YogaValue Percent(float value)
|
||||
{
|
||||
return new YogaValue
|
||||
{
|
||||
Value = value,
|
||||
isDefined = 1,
|
||||
isDefined = YogaConstants.IsUndefined(value) ? (byte)0 : (byte)1,,
|
||||
Unit = YogaUnit.Percent
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user