better handling for padding in a top/bottom or left/right configuration
This commit is contained in:
@@ -490,12 +490,13 @@ var computeLayout = (function() {
|
|||||||
getPaddingAndBorderAxis(node, mainAxis)
|
getPaddingAndBorderAxis(node, mainAxis)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
child.layout[dim[mainAxis]] = fmaxf(0,
|
child.layout[dim[mainAxis]] = fmaxf(
|
||||||
|
getPaddingAndBorderAxis(child, mainAxis),
|
||||||
node.layout[dim[mainAxis]] -
|
node.layout[dim[mainAxis]] -
|
||||||
child.layout[pos[mainAxis]] -
|
child.layout[pos[mainAxis]] -
|
||||||
getMargin(child, trailing[mainAxis]) -
|
getMargin(child, trailing[mainAxis]) -
|
||||||
getPosition(child, trailing[mainAxis])
|
getPosition(child, trailing[mainAxis])
|
||||||
) + getPaddingAndBorderAxis(child, mainAxis);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -528,12 +529,20 @@ var computeLayout = (function() {
|
|||||||
getPosition(child, trailing[crossAxis]);
|
getPosition(child, trailing[crossAxis]);
|
||||||
}
|
}
|
||||||
if (leadingPos && trailingPos) {
|
if (leadingPos && trailingPos) {
|
||||||
child.layout[dim[crossAxis]] = fmaxf(0,
|
if (isDimDefined(child, crossAxis)) {
|
||||||
node.layout[dim[crossAxis]] -
|
child.layout[dim[crossAxis]] = fmaxf(
|
||||||
child.layout[pos[crossAxis]] -
|
child.style[dim[crossAxis]],
|
||||||
getMargin(child, trailing[crossAxis]) -
|
getPaddingAndBorderAxis(node, crossAxis)
|
||||||
getPosition(child, trailing[crossAxis])
|
);
|
||||||
);
|
} else {
|
||||||
|
child.layout[dim[crossAxis]] = fmaxf(
|
||||||
|
getPaddingAndBorderAxis(child, crossAxis),
|
||||||
|
node.layout[dim[crossAxis]] -
|
||||||
|
child.layout[pos[crossAxis]] -
|
||||||
|
getMargin(child, trailing[crossAxis]) -
|
||||||
|
getPosition(child, trailing[crossAxis])
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var/*float*/ leadingCrossDim = getPaddingAndBorder(node, leading[crossAxis]);
|
var/*float*/ leadingCrossDim = getPaddingAndBorder(node, leading[crossAxis]);
|
||||||
|
@@ -983,6 +983,28 @@ describe('Layout', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should layout with position absolute left, right and width', function() {
|
||||||
|
testLayout(
|
||||||
|
{style: {}, children: [
|
||||||
|
{style: {left: 5, right: -1, width: 300, position: 'absolute'}}
|
||||||
|
]},
|
||||||
|
{width: 0, height: 0, top: 0, left: 0, children: [
|
||||||
|
{width: 300, height: 0, top: 0, left: 5}
|
||||||
|
]}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should layout with position absolute top, bottom and min padding', function() {
|
||||||
|
testLayout(
|
||||||
|
{style: {}, children: [
|
||||||
|
{style: {top: -5, bottom: -5, paddingTop: 5, position: 'absolute'}}
|
||||||
|
]},
|
||||||
|
{width: 0, height: 0, top: 0, left: 0, children: [
|
||||||
|
{width: 0, height: 10, top: -5, left: 0}
|
||||||
|
]}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
xit('should layout text with alignItems: stretch', function() {
|
xit('should layout text with alignItems: stretch', function() {
|
||||||
testLayout(
|
testLayout(
|
||||||
{style: {width: 80, padding: 7, alignItems: 'stretch', measure: text('loooooooooong with space')}},
|
{style: {width: 80, padding: 7, alignItems: 'stretch', measure: text('loooooooooong with space')}},
|
||||||
|
Reference in New Issue
Block a user