mirror of
https://gitee.com/antv/g6.git
synced 2024-12-01 03:08:33 +08:00
feat: layout for combo. feat: nonoverlap for combo layout in first stage.
This commit is contained in:
parent
d1feaea737
commit
9d1ff111d0
@ -1220,13 +1220,10 @@ export default class Graph extends EventEmitter implements IGraph {
|
||||
const self = this;
|
||||
const comboTrees = this.get('comboTrees');
|
||||
const itemController: ItemController = self.get('itemController');
|
||||
|
||||
const itemMap = self.get('itemMap');
|
||||
comboTrees && comboTrees.forEach((ctree: ComboTree) => {
|
||||
traverseTreeUp<ComboTree>(ctree, child => {
|
||||
if (!child) {
|
||||
return false
|
||||
}
|
||||
|
||||
const childItem = itemMap[child.id];
|
||||
if (childItem && childItem.getType() === 'combo') {
|
||||
itemController.updateCombo(childItem, child.children);
|
||||
|
@ -385,7 +385,6 @@ export default class ComboForce extends BaseLayout {
|
||||
});
|
||||
c.cx /= c.count;
|
||||
c.cy /= c.count;
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
@ -430,7 +429,6 @@ export default class ComboForce extends BaseLayout {
|
||||
const childIdx = nodeIdxMap[node.id];
|
||||
displacements[childIdx].x -= vecX * comboGravity * alpha / l * gravityScale;
|
||||
displacements[childIdx].y -= vecY * comboGravity * alpha / l * gravityScale;
|
||||
|
||||
if (isNumber(node.x)) {
|
||||
c.cx += node.x;
|
||||
}
|
||||
@ -440,7 +438,6 @@ export default class ComboForce extends BaseLayout {
|
||||
});
|
||||
c.cx /= c.count;
|
||||
c.cy /= c.count;
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
@ -611,7 +608,6 @@ export default class ComboForce extends BaseLayout {
|
||||
if (!isNumber(v.x) || !isNumber(u.x) || !isNumber(v.y) || !isNumber(u.y)) return;
|
||||
let { vl, vx, vy } = vecMap[`${v.id}-${u.id}`];
|
||||
if (vl > max) return;
|
||||
|
||||
const depthDiff = Math.abs(u.depth - v.depth);
|
||||
let depthParam = depthDiff ? Math.pow(scale, depthDiff) : 1;
|
||||
if (u.comboId !== v.comboId && depthParam === 1) {
|
||||
@ -672,7 +668,6 @@ export default class ComboForce extends BaseLayout {
|
||||
const vecX = vx * l;
|
||||
const vecY = vy * l;
|
||||
const b = bias[i];
|
||||
|
||||
const depthDiff = Math.abs(u.depth - v.depth);
|
||||
let depthParam = depthDiff ? Math.pow(scale, depthDiff) : 1;
|
||||
if (u.comboId !== v.comboId && depthParam === 1) {
|
||||
|
@ -501,6 +501,7 @@ export const plainCombosToTrees = (array: ComboConfig[], nodes?: INode[]) => {
|
||||
addedMap[nodeModel.id] = cnode;
|
||||
}
|
||||
});
|
||||
|
||||
result.forEach((tree: ComboTree) => {
|
||||
tree.depth = 0;
|
||||
traverse<ComboTree>(tree, child => {
|
||||
|
@ -519,7 +519,6 @@ const G6ForceLayout = () => {
|
||||
color: '#666',
|
||||
}
|
||||
});
|
||||
|
||||
graph.node(node => {
|
||||
const color = colors[node.comboId as string];
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user