indented,direction为H时,root节点的左右节点无法同时顶部对齐 #3265
liyuying12 posted onGitHub
- I have searched the issues of this repository and believe that this is not a duplicate.
What problem does this feature solve?
缩进树,左右模式分布,root节点的左右节点无法同时顶部对齐 layout: { type: 'indented', direction: 'H', dropCap: false, indent: 200, getHeight: () => { return 60; }, }, https://g6.antv.vision/zh/examples/tree/indented#intendAlignTop
What does the proposed API look like?
function positionNode(node, previousNode, dx, dropCap) { if (!dropCap) { try { // TODO H布局 要区分左右的第一个 都这样处理 if (node.id === node.parent.children[0].id) { node.x = dx * node.depth; node.y = previousNode ? previousNode.y : 0; return; } } catch (e) { // skip to normal when a node has no parent } }
node.x = dx * node.depth; node.y = previousNode ? previousNode.y previousNode.height : 0; return; }
<!-- generated by antv-issue-helper. DO NOT REMOVE -->