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:
committed by
Facebook Github Bot
parent
1146013e9e
commit
9d2839f8ca
@@ -88,7 +88,7 @@ module.exports = {
|
||||
|
||||
UNIT_COUNT: 4,
|
||||
UNIT_UNDEFINED: 0,
|
||||
UNIT_PIXEL: 1,
|
||||
UNIT_POINT: 1,
|
||||
UNIT_PERCENT: 2,
|
||||
UNIT_AUTO: 3,
|
||||
|
||||
|
@@ -102,7 +102,7 @@ module.exports = function (bind, lib) {
|
||||
|
||||
switch (this.unit) {
|
||||
|
||||
case constants.UNIT_PIXEL:
|
||||
case constants.UNIT_POINT:
|
||||
return `${this.value}`;
|
||||
|
||||
case constants.UNIT_PERCENT:
|
||||
@@ -129,7 +129,7 @@ module.exports = function (bind, lib) {
|
||||
|
||||
for (let fnName of [ `setPosition`, `setMargin`, `setFlexBasis`, `setWidth`, `setHeight`, `setMinWidth`, `setMinHeight`, `setMaxWidth`, `setMaxHeight`, `setPadding` ]) {
|
||||
|
||||
let methods = { [constants.UNIT_PIXEL]: lib.Node.prototype[fnName], [constants.UNIT_PERCENT]: lib.Node.prototype[`${fnName}Percent`] };
|
||||
let methods = { [constants.UNIT_POINT]: lib.Node.prototype[fnName], [constants.UNIT_PERCENT]: lib.Node.prototype[`${fnName}Percent`] };
|
||||
|
||||
if (Object.keys(methods).some(method => methods[method] == null))
|
||||
throw new Error(`Assertion failed; some unit derivates of ${fnName} seem missing`);
|
||||
@@ -149,7 +149,7 @@ module.exports = function (bind, lib) {
|
||||
|
||||
} else {
|
||||
|
||||
unit = typeof value === `string` && value.endsWith(`%`) ? constants.UNIT_PERCENT : constants.UNIT_PIXEL;
|
||||
unit = typeof value === `string` && value.endsWith(`%`) ? constants.UNIT_PERCENT : constants.UNIT_POINT;
|
||||
asNumber = parseFloat(value);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user