diff --git a/package.json b/package.json index c5464e0..e83a1f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@antv/hierarchy", - "version": "0.6.5", + "version": "0.6.6", "description": "layout algorithms for visualizing hierarchical data", "main": "build/hierarchy.js", "browser": "build/hierarchy.js", diff --git a/src/layout/hierarchy.js b/src/layout/hierarchy.js index 4507c78..0a2536d 100644 --- a/src/layout/hierarchy.js +++ b/src/layout/hierarchy.js @@ -82,7 +82,7 @@ util.assign(Node.prototype, { let current; while (current = nodes.shift()) { callback(current); - nodes = nodes.concat(current.children); + nodes = current.children.concat(nodes); } }, diff --git a/src/layout/indented.js b/src/layout/indented.js index 4bf7ee6..71b7486 100644 --- a/src/layout/indented.js +++ b/src/layout/indented.js @@ -1,7 +1,7 @@ function positionNode(node, previousNode, dx, dropCap) { if (!dropCap) { try { - if (node.id === node.parent.children[node.parent.children.length - 1].id) { + if (node.id === node.parent.children[0].id) { node.x += dx * node.depth; node.y = previousNode ? previousNode.y : 0; return;