feat: combo force layout with preventOverlap.

This commit is contained in:
Yanyan-Wang 2020-04-08 13:51:16 +08:00 committed by Yanyan Wang
parent 21f58c2a71
commit 610b4dd099
2 changed files with 4 additions and 8 deletions

View File

@ -156,6 +156,7 @@ export default class ComboForce extends BaseLayout {
self.initVals();
// init the positions to make the nodes with same combo gather
self.initPos(comboMap);
// iterate
for (let i = 0; i < maxIteration; i++) {
@ -470,6 +471,7 @@ export default class ComboForce extends BaseLayout {
self.updateComboSizes(comboMap);
self.calRepulsive(displacements, vecMap, comboMap);
self.calAttractive(displacements, vecMap);
const preventComboOverlap = self.preventComboOverlap;
if (preventComboOverlap) self.comboNonOverlapping(displacements, comboMap);
}

View File

@ -493,7 +493,6 @@ const G6ForceLayout = () => {
container: container.current as string | HTMLElement,
width: 800,
height: 500,
<<<<<<< HEAD
fitView: true,
modes: {
default: ['drag-canvas', 'drag-node', 'zoom-canvas'],
@ -501,14 +500,13 @@ const G6ForceLayout = () => {
layout: {
type: 'comboForce',
linkDistance: 1000,
=======
fitView: true,
modes: {
default: ['drag-canvas', 'drag-node'],
default: ['drag-canvas', 'drag-node', 'zoom-canvas'],
},
layout: {
type: 'comboForce',
linkDistance: 100,
>>>>>>> feat: layout for combo. feat: nonoverlap for combo layout in first stage.
// comboIding: true,
// comboIdGravity: 5,
// preventOverlap: true,
@ -517,15 +515,11 @@ const G6ForceLayout = () => {
nodeStrength: 30,
linkStrength: 0.1,
// preventOverlap: true,
<<<<<<< HEAD
preventComboOverlap: true,
collideStrength: 0.5,
maxIteration: 10,
comboPadding: 5,
comboSpacing: 10
=======
preventComboOverlap: true
>>>>>>> feat: layout for combo. feat: nonoverlap for combo layout in first stage.
},
defaultEdge: {
size: 3,