FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(flexbox): justify content calculations · NativeScript/NativeScript@d025c0e · GitHub

Commit d025c0e

Browse files
committed
fix(flexbox): justify content calculations
1 parent f3ea75f commit d025c0e

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

‎tns-core-modules/ui/layouts/flexbox-layout/flexbox-layout.ios.ts‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,24 +1003,24 @@ export class FlexboxLayout extends FlexboxLayoutBase {
10031003
childRight = width - paddingRight;
10041004
break;
10051005
case JustifyContent.FLEX_END:
1006-
childLeft = width - flexLine._mainSize + paddingRight;
1007-
childRight = flexLine._mainSize - paddingLeft;
1006+
childLeft = width - flexLine._mainSize - paddingRight;
1007+
childRight = flexLine._mainSize + paddingLeft;
10081008
break;
10091009
case JustifyContent.CENTER:
1010-
childLeft = paddingLeft + (width - flexLine._mainSize) / 2.0;
1011-
childRight = width - paddingRight - (width - flexLine._mainSize) / 2.0;
1010+
childLeft = paddingLeft + (width - insets.left - insets.right - flexLine._mainSize) / 2.0;
1011+
childRight = width - paddingRight - (width - insets.left - insets.right - flexLine._mainSize) / 2.0;
10121012
break;
10131013
case JustifyContent.SPACE_AROUND:
10141014
if (flexLine._itemCount !== 0) {
1015-
spaceBetweenItem = (width - flexLine.mainSize) / flexLine._itemCount;
1015+
spaceBetweenItem = (width - insets.left - insets.right - flexLine.mainSize) / flexLine._itemCount;
10161016
}
10171017
childLeft = paddingLeft + spaceBetweenItem / 2.0;
10181018
childRight = width - paddingRight - spaceBetweenItem / 2.0;
10191019
break;
10201020
case JustifyContent.SPACE_BETWEEN:
10211021
childLeft = paddingLeft;
10221022
let denominator = flexLine.itemCount !== 1 ? flexLine.itemCount - 1 : 1.0;
1023-
spaceBetweenItem = (width - flexLine.mainSize) / denominator;
1023+
spaceBetweenItem = (width - insets.left - insets.right - flexLine.mainSize) / denominator;
10241024
childRight = width - paddingRight;
10251025
break;
10261026
default:
@@ -1164,24 +1164,24 @@ export class FlexboxLayout extends FlexboxLayoutBase {
11641164
childBottom = height - paddingBottom;
11651165
break;
11661166
case JustifyContent.FLEX_END:
1167-
childTop = height - flexLine._mainSize + paddingBottom;
1168-
childBottom = flexLine._mainSize - paddingTop;
1167+
childTop = height - flexLine._mainSize - paddingBottom;
1168+
childBottom = flexLine._mainSize + paddingTop;
11691169
break;
11701170
case JustifyContent.CENTER:
1171-
childTop = paddingTop + (height - flexLine._mainSize) / 2.0;
1172-
childBottom = height - paddingBottom - (height - flexLine._mainSize) / 2.0;
1171+
childTop = paddingTop + (height - insets.top - insets.bottom - flexLine._mainSize) / 2.0;
1172+
childBottom = height - paddingBottom - (height - insets.top - insets.bottom - flexLine._mainSize) / 2.0;
11731173
break;
11741174
case JustifyContent.SPACE_AROUND:
11751175
if (flexLine._itemCount !== 0) {
1176-
spaceBetweenItem = (height - flexLine._mainSize) / flexLine.itemCount;
1176+
spaceBetweenItem = (height - insets.top - insets.bottom - flexLine._mainSize) / flexLine.itemCount;
11771177
}
11781178
childTop = paddingTop + spaceBetweenItem / 2.0;
11791179
childBottom = height - paddingBottom - spaceBetweenItem / 2.0;
11801180
break;
11811181
case JustifyContent.SPACE_BETWEEN:
11821182
childTop = paddingTop;
11831183
let denominator = flexLine.itemCount !== 1 ? flexLine.itemCount - 1 : 1.0;
1184-
spaceBetweenItem = (height - flexLine.mainSize) / denominator;
1184+
spaceBetweenItem = (height - insets.top - insets.bottom - flexLine.mainSize) / denominator;
11851185
childBottom = height - paddingBottom;
11861186
break;
11871187
default:

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL