Rename YGUnitPixel to YGPoint...

Summary:
...to reflect the modern world we live in with dynamic DPI platforms :)
Closes https://github.com/facebook/yoga/pull/375

Reviewed By: dshahidehpour

Differential Revision: D4528518

Pulled By: emilsjolander

fbshipit-source-id: e422bd4ae148e02c598a7b484a6adfa8c0e1e0c9
This commit is contained in:
David Hart
2017-02-14 14:26:13 -08:00
committed by Facebook Github Bot
parent 1146013e9e
commit 9d2839f8ca
18 changed files with 96 additions and 96 deletions

View File

@@ -12,7 +12,7 @@ namespace Facebook.Yoga
public enum YogaUnit
{
Undefined,
Pixel,
Point,
Percent,
Auto,
}

View File

@@ -33,12 +33,12 @@ namespace Facebook.Yoga
}
}
public static YogaValue Pixel(float value)
public static YogaValue Point(float value)
{
return new YogaValue
{
value = value,
unit = YogaConstants.IsUndefined(value) ? YogaUnit.Undefined : YogaUnit.Pixel
unit = YogaConstants.IsUndefined(value) ? YogaUnit.Undefined : YogaUnit.Point
};
}
@@ -88,9 +88,9 @@ namespace Facebook.Yoga
};
}
public static implicit operator YogaValue(float pixelValue)
public static implicit operator YogaValue(float pointValue)
{
return Pixel(pixelValue);
return Point(pointValue);
}
}
}

View File

@@ -16,9 +16,9 @@ namespace Facebook.Yoga
return YogaValue.Percent(value);
}
public static YogaValue Px(this float value)
public static YogaValue Pt(this float value)
{
return YogaValue.Pixel(value);
return YogaValue.Point(value);
}
public static YogaValue Percent(this int value)
@@ -26,9 +26,9 @@ namespace Facebook.Yoga
return YogaValue.Percent(value);
}
public static YogaValue Px(this int value)
public static YogaValue Pt(this int value)
{
return YogaValue.Pixel(value);
return YogaValue.Point(value);
}
}
}

View File

@@ -854,9 +854,9 @@ namespace Facebook.YogaKit
}
}
static double RoundPixelValue(float value)
static double RoundPointValue(float value)
{
float scale = NativePixelScale;
float scale = NativePointScale;
return Math.Round(value * scale) / scale;
}

View File

@@ -30,7 +30,7 @@ namespace Facebook.YogaKit
{
var topLeft = new CGPoint(node.LayoutX, node.LayoutY);
var bottomRight = new CGPoint(topLeft.X + node.LayoutWidth, topLeft.Y + node.LayoutHeight);
view.Frame = new CGRect(RoundPixelValue((float)topLeft.X), RoundPixelValue((float)topLeft.Y), RoundPixelValue((float)bottomRight.X) - RoundPixelValue((float)topLeft.X), RoundPixelValue((float)bottomRight.Y) - RoundPixelValue((float)topLeft.Y));
view.Frame = new CGRect(RoundPointValue((float)topLeft.X), RoundPointValue((float)topLeft.Y), RoundPointValue((float)bottomRight.X) - RoundPointValue((float)topLeft.X), RoundPointValue((float)bottomRight.Y) - RoundPointValue((float)topLeft.Y));
}
bool _disposed;