constructor()

in src/vis/Layout.js [6:32]


  constructor() {
    this.isRunning = false;
    this.simulation = d3adaptor(d3)
      .flowLayout('x', 5)
      .avoidOverlaps(true)
      // .symmetricDiffLinkLengths(5)
      .jaccardLinkLengths(10)
      .linkDistance(5);

    this.dispatcher = d3.dispatch('start', 'tick', 'end');

    this.simulation.on('start.default', () => {
      this.isRunning = true;
      this.dispatcher.call('start', this);
    });

    this.simulation.on('tick.default', () => {
      this.dispatcher.call('tick', this);
    });

    this.simulation.on('end.default', () => {
      if (this.isRunning) {
        this.isRunning = false;
        this.dispatcher.call('end', this);
      }
    });
  }