mirror of
https://gitee.com/antv/g6.git
synced 2024-12-05 05:09:07 +08:00
fix: redundant code
This commit is contained in:
parent
7599e2712a
commit
bedcbd80ae
@ -3300,9 +3300,7 @@
|
||||
maxIteration: 200,
|
||||
focusNode,
|
||||
unitRadius: mainUnitRadius,
|
||||
linkDistance: 230,
|
||||
nodeSize: 20,
|
||||
nonOverlap: true
|
||||
linkDistance: 250
|
||||
});
|
||||
|
||||
G6.registerBehavior('click-add-node', {
|
||||
@ -3376,7 +3374,8 @@
|
||||
const maxDegree = 4;
|
||||
// the max degree about foces(clicked) node in the original data
|
||||
const oMaxDegree = 3;
|
||||
const unitRadius = 60;
|
||||
const unitRadius = 40;
|
||||
const focusNodeId = "2";
|
||||
// re-place the clicked node far away the exisiting items
|
||||
// along the radius from center node to it
|
||||
const vx = itemModel.x - focusNode.x;
|
||||
@ -3389,11 +3388,9 @@
|
||||
const subRadialLayout = new Radial({
|
||||
center: [ itemModel.x, itemModel.y ],
|
||||
maxIteration: 200,
|
||||
focusNode: itemModel,
|
||||
focusNode: "2",
|
||||
unitRadius,
|
||||
linkDistance: 120,
|
||||
nodeSize: 20,
|
||||
nonOverlap: true
|
||||
linkDistance: 180
|
||||
});
|
||||
graph.addPlugin(subRadialLayout);
|
||||
// only layout the newly added part around the clicked node
|
||||
@ -3401,8 +3398,6 @@
|
||||
{'nodes': newNodeModels,
|
||||
'edges': newEdgeModels}
|
||||
);
|
||||
|
||||
focusNode = itemModel;
|
||||
graph.changeData({"nodes": allNodeModels, "edges": allEdgeModels});
|
||||
}
|
||||
});
|
||||
|
@ -198,8 +198,6 @@ class Radial extends Base {
|
||||
const self = this;
|
||||
const vparam = 1 - param;
|
||||
const focusIndex = self.get('focusIndex');
|
||||
const nonOverlap = self.get('nonOverlap');
|
||||
const nodeRadius = self.get('nodeRadius');
|
||||
positions.forEach((v, i) => { // v
|
||||
const originDis = Util.getEDistance(v, [ 0, 0 ]);
|
||||
const reciODis = originDis === 0 ? 0 : 1 / originDis;
|
||||
@ -213,10 +211,7 @@ class Radial extends Base {
|
||||
// the euclidean distance between v and u
|
||||
const edis = Util.getEDistance(v, u);
|
||||
const reciEdis = edis === 0 ? 0 : 1 / edis;
|
||||
let idealDis = D[j][i];
|
||||
if (nonOverlap && radii[i] === radii[j] && param < 0.2 && edis < (2 * nodeRadius)) {
|
||||
idealDis += (nodeRadius * 2);
|
||||
}
|
||||
const idealDis = D[j][i];
|
||||
// same for x and y
|
||||
denominator += W[i][j];
|
||||
// x
|
||||
|
Loading…
Reference in New Issue
Block a user