@antv/layout 2.0.0-alpha.3 → 2.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -693,10 +693,13 @@
693
693
  model.setNodeOrder(nodes);
694
694
  return model;
695
695
  }
696
- function orderByDegree(model) {
696
+ function orderByDegree(model, order = 'desc') {
697
697
  return sort$1(model, (nodeA, nodeB) => {
698
698
  const degreeA = model.degree(nodeA.id);
699
699
  const degreeB = model.degree(nodeB.id);
700
+ if (order === 'asc') {
701
+ return degreeA - degreeB; // ascending order
702
+ }
700
703
  return degreeB - degreeA; // descending order
701
704
  });
702
705
  }
@@ -5476,7 +5479,7 @@
5476
5479
  }
5477
5480
  else if (ordering === 'degree') {
5478
5481
  // layout according to the descent order of degrees
5479
- orderByDegree(this.model);
5482
+ orderByDegree(this.model, 'asc');
5480
5483
  }
5481
5484
  let { radius, startRadius, endRadius } = this.options;
5482
5485
  const nodes = this.model.nodes();
@@ -7447,14 +7450,7 @@
7447
7450
  });
7448
7451
  }
7449
7452
  parseOptions(options) {
7450
- var _a, _b;
7451
7453
  const _ = options;
7452
- // process nodeSize
7453
- if (_.collide && ((_a = _.collide) === null || _a === void 0 ? void 0 : _a.radius) === undefined) {
7454
- _.collide = _.collide || {};
7455
- // @ts-ignore
7456
- _.collide.radius = (_b = _.nodeSize) !== null && _b !== void 0 ? _b : 10;
7457
- }
7458
7454
  // process iterations
7459
7455
  if (_.iterations === undefined) {
7460
7456
  if (_.link && _.link.iterations === undefined) {
@@ -7650,13 +7646,14 @@
7650
7646
  }
7651
7647
  }
7652
7648
  getCollisionOptions(options) {
7653
- if (options.preventOverlap === false || options.collide === false)
7649
+ if (options.preventOverlap === false &&
7650
+ (options.collide === false || options.collide === undefined))
7654
7651
  return undefined;
7655
7652
  const radius = options.nodeSize || options.nodeSpacing
7656
7653
  ? (d) => formatNodeSizeFn(options.nodeSize, options.nodeSpacing)(d._original) / 2
7657
7654
  : undefined;
7658
7655
  return assignDefined({}, options.collide || {}, {
7659
- radius: options.collide || radius,
7656
+ radius: (options.collide && options.collide.radius) || radius,
7660
7657
  strength: options.collideStrength,
7661
7658
  iterations: options.collideIterations,
7662
7659
  });
@@ -32443,9 +32440,9 @@ ${indent}columns: ${matrix.columns}
32443
32440
  ? { type: 'force', preventOverlap: true }
32444
32441
  : { type: 'concentric', preventOverlap: true },
32445
32442
  nodeSize: 20,
32446
- nodeSpacing: 10,
32447
- comboPadding: 20,
32448
- comboSpacing: 80,
32443
+ nodeSpacing: 0,
32444
+ comboPadding: 10,
32445
+ comboSpacing: 0,
32449
32446
  };
32450
32447
  const ROOT_ID = 'root';
32451
32448
  /**