cross padding and margin
This commit is contained in:
@@ -490,6 +490,17 @@ describe('Layout', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should layout node with padding and a child with margin', function() {
|
||||||
|
testLayout(
|
||||||
|
{style: {padding: 5}, children: [
|
||||||
|
{style: {margin: 5}}
|
||||||
|
]},
|
||||||
|
{width: 20, height: 20, top: 0, left: 0, children: [
|
||||||
|
{width: 0, height: 0, top: 10, left: 10}
|
||||||
|
]}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should layout randomly', function() {
|
it('should layout randomly', function() {
|
||||||
function RNG(seed) {
|
function RNG(seed) {
|
||||||
this.state = seed;
|
this.state = seed;
|
||||||
|
@@ -164,7 +164,7 @@ function computeLayout(node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var crossDim = getPadding(node, leading[crossAxis]);
|
var crossDim = 0;
|
||||||
var mainPos = getPadding(node, leading[mainAxis]) + leadingMainDim;
|
var mainPos = getPadding(node, leading[mainAxis]) + leadingMainDim;
|
||||||
children.forEach(function(child) {
|
children.forEach(function(child) {
|
||||||
child.layout[pos[mainAxis]] += mainPos;
|
child.layout[pos[mainAxis]] += mainPos;
|
||||||
@@ -178,7 +178,8 @@ function computeLayout(node) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
mainPos += getPadding(node, trailing[mainAxis]);
|
mainPos += getPadding(node, trailing[mainAxis]);
|
||||||
crossDim += getPadding(node, trailing[crossAxis]);
|
crossDim += getPadding(node, leading[crossAxis]) +
|
||||||
|
getPadding(node, trailing[crossAxis]);
|
||||||
|
|
||||||
if (node.layout[dim[mainAxis]] === undefined && !mainDimInStyle) {
|
if (node.layout[dim[mainAxis]] === undefined && !mainDimInStyle) {
|
||||||
node.layout[dim[mainAxis]] = Math.max(mainPos, 0);
|
node.layout[dim[mainAxis]] = Math.max(mainPos, 0);
|
||||||
|
Reference in New Issue
Block a user