Files
yoga/src/Layout.js

29 lines
496 B
JavaScript
Raw Normal View History

2014-03-30 17:12:38 -07:00
function computeLayout(node) {
2014-03-30 19:18:06 -07:00
var top = 0;
var children = [];
(node.children || []).forEach(function(child) {
console.log(child);
children.push({
top: top,
left: 0,
width: child.style.width,
height: child.style.height
});
top += child.style.height;
});
var result = {
2014-03-30 17:12:38 -07:00
top: 0,
left: 0,
width: node.style.width,
height: node.style.height
};
2014-03-30 19:18:06 -07:00
if (children.length > 0) {
result.children = children;
}
return result;
2014-03-30 17:12:38 -07:00
}