handle position: absolute margin as child correctly
This commit is contained in:
@@ -221,12 +221,12 @@ var computeLayout = (function() {
|
|||||||
child.layout[pos[mainAxis]] += mainPos;
|
child.layout[pos[mainAxis]] += mainPos;
|
||||||
if (getPositionType(child) === 'relative') {
|
if (getPositionType(child) === 'relative') {
|
||||||
mainPos += getDimWithMargin(child, mainAxis) + betweenMainDim;
|
mainPos += getDimWithMargin(child, mainAxis) + betweenMainDim;
|
||||||
}
|
|
||||||
|
|
||||||
if (!isUndefined(child.layout[dim[crossAxis]])) {
|
if (!isUndefined(child.layout[dim[crossAxis]])) {
|
||||||
var/*float*/ childCrossDim = getDimWithMargin(child, crossAxis);
|
var/*float*/ childCrossDim = getDimWithMargin(child, crossAxis);
|
||||||
if (childCrossDim > crossDim) {
|
if (childCrossDim > crossDim) {
|
||||||
crossDim = childCrossDim;
|
crossDim = childCrossDim;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -482,6 +482,17 @@ describe('Layout', function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should layout node with child with position: absolute and margin', function() {
|
||||||
|
testLayout(
|
||||||
|
{style: {}, children: [
|
||||||
|
{style: {marginRight: 15, position: 'absolute'}}
|
||||||
|
]},
|
||||||
|
{width: 0, height: 0, top: 0, left: 0, children: [
|
||||||
|
{width: 0, height: 0, top: 0, left: 0}
|
||||||
|
]}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should layout randomly', function() {
|
it('should layout randomly', function() {
|
||||||
function RNG(seed) {
|
function RNG(seed) {
|
||||||
this.state = seed;
|
this.state = seed;
|
||||||
|
Reference in New Issue
Block a user