force-graph 1.42.7 → 1.42.8

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.
@@ -72,8 +72,8 @@ interface ForceGraphGenericInstance<ChainableInstance> {
72
72
  nodeAutoColorBy(colorByAccessor: NodeAccessor<string | null>): ChainableInstance;
73
73
  nodeCanvasObject(): CanvasCustomRenderFn<NodeObject>;
74
74
  nodeCanvasObject(renderFn: CanvasCustomRenderFn<NodeObject>): ChainableInstance;
75
- nodeCanvasObjectMode(): string | ((obj: NodeObject) => CanvasCustomRenderMode);
76
- nodeCanvasObjectMode(modeAccessor: string | ((obj: NodeObject) => CanvasCustomRenderMode)): ChainableInstance;
75
+ nodeCanvasObjectMode(): string | ((obj: NodeObject) => CanvasCustomRenderMode | any);
76
+ nodeCanvasObjectMode(modeAccessor: string | ((obj: NodeObject) => CanvasCustomRenderMode | any)): ChainableInstance;
77
77
  nodePointerAreaPaint(): CanvasPointerAreaPaintFn<NodeObject>;
78
78
  nodePointerAreaPaint(renderFn: CanvasPointerAreaPaintFn<NodeObject>): ChainableInstance;
79
79
 
@@ -1,4 +1,4 @@
1
- // Version 1.42.7 force-graph - https://github.com/vasturiano/force-graph
1
+ // Version 1.42.8 force-graph - https://github.com/vasturiano/force-graph
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4
4
  typeof define === 'function' && define.amd ? define(factory) :
@@ -9166,12 +9166,16 @@
9166
9166
  return [];
9167
9167
  }
9168
9168
 
9169
- const trm = v2 * v2 - 4 * v1 * v3,
9170
- sq = Math.sqrt(trm),
9171
- d2 = 2 * v1;
9169
+ const d2 = 2 * v1;
9172
9170
 
9173
9171
  if (utils.approximately(d2, 0)) return [];
9174
9172
 
9173
+ const trm = v2 * v2 - 4 * v1 * v3;
9174
+
9175
+ if (trm < 0) return [];
9176
+
9177
+ const sq = Math.sqrt(trm);
9178
+
9175
9179
  return [(sq - v2) / d2, -(v2 + sq) / d2].filter(function (r) {
9176
9180
  return 0 <= r && r <= 1;
9177
9181
  });
@@ -9760,7 +9764,7 @@
9760
9764
  __normal2(t) {
9761
9765
  const d = this.derivative(t);
9762
9766
  const q = sqrt(d.x * d.x + d.y * d.y);
9763
- return { x: -d.y / q, y: d.x / q };
9767
+ return { t, x: -d.y / q, y: d.x / q };
9764
9768
  }
9765
9769
 
9766
9770
  __normal3(t) {
@@ -9799,6 +9803,7 @@
9799
9803
  ];
9800
9804
  // normal vector:
9801
9805
  const n = {
9806
+ t,
9802
9807
  x: R[0] * r1.x + R[1] * r1.y + R[2] * r1.z,
9803
9808
  y: R[3] * r1.x + R[4] * r1.y + R[5] * r1.z,
9804
9809
  z: R[6] * r1.x + R[7] * r1.y + R[8] * r1.z,