multiple flex and margin
This commit is contained in:
@@ -193,7 +193,9 @@ var computeLayout = (function() {
|
|||||||
} else {
|
} else {
|
||||||
flexibleChildrenCount++;
|
flexibleChildrenCount++;
|
||||||
mainContentDim += getPadding(child, leading[mainAxis]) +
|
mainContentDim += getPadding(child, leading[mainAxis]) +
|
||||||
getPadding(child, trailing[mainAxis]);
|
getPadding(child, trailing[mainAxis]) +
|
||||||
|
getMargin(child, leading[mainAxis]) +
|
||||||
|
getMargin(child, trailing[mainAxis]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,9 +212,7 @@ var computeLayout = (function() {
|
|||||||
for (var/*int*/ i = 0; i < node.children.length; ++i) {
|
for (var/*int*/ i = 0; i < node.children.length; ++i) {
|
||||||
var/*css_node_t**/ child = node.children[i];
|
var/*css_node_t**/ child = node.children[i];
|
||||||
if (getFlex(child)) {
|
if (getFlex(child)) {
|
||||||
child.layout[dim[mainAxis]] = flexibleMainDim -
|
child.layout[dim[mainAxis]] = flexibleMainDim +
|
||||||
getMargin(child, leading[mainAxis]) -
|
|
||||||
getMargin(child, trailing[mainAxis]) +
|
|
||||||
getPadding(child, leading[mainAxis]) +
|
getPadding(child, leading[mainAxis]) +
|
||||||
getPadding(child, trailing[mainAxis]);
|
getPadding(child, trailing[mainAxis]);
|
||||||
layoutNode(child);
|
layoutNode(child);
|
||||||
|
@@ -632,6 +632,18 @@ describe('Layout', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should layout node with multiple flex and margin', function() {
|
||||||
|
testLayout(
|
||||||
|
{style: {width: 700, flexDirection: 'row'}, children: [
|
||||||
|
{style: {flex: 1}},
|
||||||
|
{style: {marginLeft: 5, flex: 1}}
|
||||||
|
]},
|
||||||
|
{width: 700, height: 0, top: 0, left: 0, children: [
|
||||||
|
{width: 347.5, height: 0, top: 0, left: 0},
|
||||||
|
{width: 347.5, height: 0, top: 0, left: 352.5}
|
||||||
|
]}
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
it('should layout randomly', function() {
|
it('should layout randomly', function() {
|
||||||
function RNG(seed) {
|
function RNG(seed) {
|
||||||
|
Reference in New Issue
Block a user