Skip to content

Commit 9144e95

Browse files
committed
Fix parent position when walking child nodes
The child node needs to know its parent's absolute position in order to determine its own absolute position. Previously, the parent's relative position (in relation to its own parent) has been passed. This leads to wrong positioning of nested nodes after several levels of recursion. I fixed this by passing the current node's absolute position to the child nodes' layout function.
1 parent ae41e0f commit 9144e95

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/layoutNode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function walkNode (node, parentLeft, parentTop) {
3737
node.layer.frame.height = node.layout.height;
3838
if (node.children && node.children.length > 0) {
3939
node.children.forEach(function (child) {
40-
walkNode(child, node.layout.left, node.layout.top);
40+
walkNode(child, node.layer.frame.x, node.layer.frame.y);
4141
});
4242
}
4343
}

0 commit comments

Comments
 (0)