@cosmos.gl/graph 2.0.0 → 2.1.0

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.
@@ -43,6 +43,7 @@ export declare const defaultConfigValues: {
43
43
  showFPSMonitor: boolean;
44
44
  pixelRatio: number;
45
45
  scalePointsOnZoom: boolean;
46
+ scaleLinksOnZoom: boolean;
46
47
  enableZoom: boolean;
47
48
  enableSimulationDuringZoom: boolean;
48
49
  enableDrag: boolean;
@@ -53,6 +54,7 @@ export declare const defaultConfigValues: {
53
54
  pointSamplingDistance: number;
54
55
  attribution: string;
55
56
  rescalePositions: undefined;
57
+ enableRightClickRepulsion: boolean;
56
58
  };
57
59
  export declare const hoveredPointRingOpacity = 0.7;
58
60
  export declare const focusedPointRingOpacity = 0.95;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cosmos.gl/graph",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "GPU-based force graph layout and rendering",
5
5
  "jsdelivr": "dist/index.min.js",
6
6
  "main": "dist/index.js",
package/src/config.ts CHANGED
@@ -143,6 +143,11 @@ export interface GraphConfigInterface {
143
143
  * Default value: `1`
144
144
  */
145
145
  linkWidthScale?: number;
146
+ /**
147
+ * Increase or decrease the size of the links when zooming in or out.
148
+ * Default value: `false`
149
+ */
150
+ scaleLinksOnZoom?: boolean;
146
151
  /**
147
152
  * If set to true, links are rendered as curved lines.
148
153
  * Otherwise as straight lines.
@@ -252,6 +257,13 @@ export interface GraphConfigInterface {
252
257
  * Default value: `2`
253
258
  */
254
259
  simulationRepulsionFromMouse?: number;
260
+ /**
261
+ * Enable or disable the repulsion force from mouse when right-clicking.
262
+ * When set to `true`, holding the right mouse button will activate the mouse repulsion force.
263
+ * When set to `false`, right-clicking will not trigger any repulsion force.
264
+ * Default value: `false`
265
+ */
266
+ enableRightClickRepulsion?: boolean;
255
267
  /**
256
268
  * Friction coefficient.
257
269
  * Values range from 0 (high friction, stops quickly) to 1 (no friction, keeps moving).
@@ -405,7 +417,7 @@ export interface GraphConfigInterface {
405
417
  pixelRatio?: number;
406
418
  /**
407
419
  * Increase or decrease the size of the points when zooming in or out.
408
- * Default value: true
420
+ * Default value: `false`
409
421
  */
410
422
  scalePointsOnZoom?: boolean;
411
423
  /**
@@ -522,6 +534,7 @@ export class GraphConfig implements GraphConfigInterface {
522
534
  public curvedLinkControlPointDistance = defaultConfigValues.curvedLinkControlPointDistance
523
535
  public linkArrows = defaultConfigValues.arrowLinks
524
536
  public linkArrowsSizeScale = defaultConfigValues.arrowSizeScale
537
+ public scaleLinksOnZoom = defaultConfigValues.scaleLinksOnZoom
525
538
  public linkVisibilityDistanceRange = defaultConfigValues.linkVisibilityDistanceRange
526
539
  public linkVisibilityMinTransparency = defaultConfigValues.linkVisibilityMinTransparency
527
540
  public useClassicQuadtree = defaultConfigValues.useClassicQuadtree
@@ -536,6 +549,7 @@ export class GraphConfig implements GraphConfigInterface {
536
549
  public simulationLinkDistance = defaultConfigValues.simulation.linkDistance
537
550
  public simulationLinkDistRandomVariationRange = defaultConfigValues.simulation.linkDistRandomVariationRange
538
551
  public simulationRepulsionFromMouse = defaultConfigValues.simulation.repulsionFromMouse
552
+ public enableRightClickRepulsion = defaultConfigValues.enableRightClickRepulsion
539
553
  public simulationFriction = defaultConfigValues.simulation.friction
540
554
  public simulationCluster = defaultConfigValues.simulation.cluster
541
555
 
package/src/index.ts CHANGED
@@ -886,6 +886,39 @@ export class Graph {
886
886
  if (this._isDestroyed || !this.reglInstance) return
887
887
  window.clearTimeout(this._fitViewOnInitTimeoutID)
888
888
  this.stopFrames()
889
+
890
+ // Remove all event listeners
891
+ if (this.canvasD3Selection) {
892
+ this.canvasD3Selection
893
+ .on('mouseenter.cosmos', null)
894
+ .on('mousemove.cosmos', null)
895
+ .on('mouseleave.cosmos', null)
896
+ .on('click', null)
897
+ .on('mousemove', null)
898
+ .on('contextmenu', null)
899
+ .on('.drag', null)
900
+ .on('.zoom', null)
901
+ }
902
+
903
+ select(document)
904
+ .on('keydown.cosmos', null)
905
+ .on('keyup.cosmos', null)
906
+
907
+ if (this.zoomInstance?.behavior) {
908
+ this.zoomInstance.behavior
909
+ .on('start.detect', null)
910
+ .on('zoom.detect', null)
911
+ .on('end.detect', null)
912
+ }
913
+
914
+ if (this.dragInstance?.behavior) {
915
+ this.dragInstance.behavior
916
+ .on('start.detect', null)
917
+ .on('drag.detect', null)
918
+ .on('end.detect', null)
919
+ }
920
+
921
+ this.fpsMonitor?.destroy()
889
922
  this.reglInstance.destroy()
890
923
  // Clears the canvas after particle system is destroyed
891
924
  this.reglInstance.clear({
@@ -893,9 +926,21 @@ export class Graph {
893
926
  depth: 1,
894
927
  stencil: 0,
895
928
  })
896
- select(this.canvas).style('cursor', null)
897
- this.fpsMonitor?.destroy()
929
+
930
+ if (this.canvas && this.canvas.parentNode) {
931
+ this.canvas.parentNode.removeChild(this.canvas)
932
+ }
933
+
934
+ if (this.attributionDivElement && this.attributionDivElement.parentNode) {
935
+ this.attributionDivElement.parentNode.removeChild(this.attributionDivElement)
936
+ }
937
+
898
938
  document.getElementById('gl-bench-style')?.remove()
939
+
940
+ this.canvasD3Selection = undefined
941
+ this.reglInstance = undefined
942
+ this.attributionDivElement = undefined
943
+
899
944
  this._isDestroyed = true
900
945
  }
901
946
 
@@ -991,8 +1036,7 @@ export class Graph {
991
1036
  if (!this.dragInstance.isActive) this.findHoveredPoint()
992
1037
 
993
1038
  if (enableSimulation) {
994
- if (this.isRightClickMouse) {
995
- if (!isSimulationRunning) this.start(0.1)
1039
+ if (this.isRightClickMouse && this.config.enableRightClickRepulsion) {
996
1040
  this.forceMouse?.run()
997
1041
  this.points?.updatePosition()
998
1042
  }
@@ -1023,7 +1067,7 @@ export class Graph {
1023
1067
  }
1024
1068
 
1025
1069
  this.store.alpha += this.store.addAlpha(this.config.simulationDecay ?? defaultConfigValues.simulation.decay)
1026
- if (this.isRightClickMouse) this.store.alpha = Math.max(this.store.alpha, 0.1)
1070
+ if (this.isRightClickMouse && this.config.enableRightClickRepulsion) this.store.alpha = Math.max(this.store.alpha, 0.1)
1027
1071
  this.store.simulationProgress = Math.sqrt(Math.min(1, ALPHA_MIN / this.store.alpha))
1028
1072
  this.config.onSimulationTick?.(
1029
1073
  this.store.alpha,
@@ -3,9 +3,8 @@ precision highp float;
3
3
  varying vec4 rgbaColor;
4
4
  varying vec2 pos;
5
5
  varying float arrowLength;
6
- varying float linkWidthArrowWidthRatio;
7
- varying float smoothWidthRatio;
8
6
  varying float useArrow;
7
+ varying float smoothing;
9
8
 
10
9
  float map(float value, float min1, float max1, float min2, float max2) {
11
10
  return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
@@ -14,22 +13,22 @@ float map(float value, float min1, float max1, float min2, float max2) {
14
13
  void main() {
15
14
  float opacity = 1.0;
16
15
  vec3 color = rgbaColor.rgb;
17
- float smoothDelta = smoothWidthRatio / 2.0;
16
+
18
17
  if (useArrow > 0.5) {
19
18
  float end_arrow = 0.5 + arrowLength / 2.0;
20
19
  float start_arrow = end_arrow - arrowLength;
21
- float arrowWidthDelta = linkWidthArrowWidthRatio / 2.0;
22
- float linkOpacity = rgbaColor.a * smoothstep(0.5 - arrowWidthDelta, 0.5 - arrowWidthDelta - smoothDelta, abs(pos.y));
20
+ float arrowWidthDelta = 0.25;
21
+ float linkOpacity = rgbaColor.a * smoothstep(0.5 - arrowWidthDelta, 0.5 - arrowWidthDelta - smoothing / 2.0, abs(pos.y));
23
22
  float arrowOpacity = 1.0;
24
23
  if (pos.x > start_arrow && pos.x < start_arrow + arrowLength) {
25
24
  float xmapped = map(pos.x, start_arrow, end_arrow, 0.0, 1.0);
26
- arrowOpacity = rgbaColor.a * smoothstep(xmapped - smoothDelta, xmapped, map(abs(pos.y), 0.5, 0.0, 0.0, 1.0));
25
+ arrowOpacity = rgbaColor.a * smoothstep(xmapped - smoothing, xmapped, map(abs(pos.y), 0.5, 0.0, 0.0, 1.0));
27
26
  if (linkOpacity != arrowOpacity) {
28
- linkOpacity += arrowOpacity;
27
+ linkOpacity = max(linkOpacity, arrowOpacity);
29
28
  }
30
29
  }
31
30
  opacity = linkOpacity;
32
- } else opacity = rgbaColor.a * smoothstep(0.5, 0.5 - smoothDelta, abs(pos.y));
31
+ } else opacity = rgbaColor.a * smoothstep(0.5, 0.5 - smoothing, abs(pos.y));
33
32
 
34
33
  gl_FragColor = vec4(color, opacity);
35
34
  }
@@ -1,8 +1,10 @@
1
1
  precision highp float;
2
+
2
3
  attribute vec2 position, pointA, pointB;
3
4
  attribute vec4 color;
4
5
  attribute float width;
5
6
  attribute float arrow;
7
+
6
8
  uniform sampler2D positionsTexture;
7
9
  uniform sampler2D pointGreyoutStatus;
8
10
  uniform mat3 transformationMatrix;
@@ -11,20 +13,20 @@ uniform float widthScale;
11
13
  uniform float arrowSizeScale;
12
14
  uniform float spaceSize;
13
15
  uniform vec2 screenSize;
14
- uniform float ratio;
15
16
  uniform vec2 linkVisibilityDistanceRange;
16
17
  uniform float linkVisibilityMinTransparency;
17
18
  uniform float greyoutOpacity;
18
19
  uniform float curvedWeight;
19
20
  uniform float curvedLinkControlPointDistance;
20
21
  uniform float curvedLinkSegments;
22
+ uniform bool scaleLinksOnZoom;
23
+ uniform float maxPointSize;
21
24
 
22
25
  varying vec4 rgbaColor;
23
26
  varying vec2 pos;
24
27
  varying float arrowLength;
25
- varying float linkWidthArrowWidthRatio;
26
- varying float smoothWidthRatio;
27
28
  varying float useArrow;
29
+ varying float smoothing;
28
30
 
29
31
  float map(float value, float min1, float max1, float min2, float max2) {
30
32
  return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
@@ -36,19 +38,48 @@ vec2 conicParametricCurve(vec2 A, vec2 B, vec2 ControlPoint, float t, float w) {
36
38
  return divident / divisor;
37
39
  }
38
40
 
41
+ float calculateLinkWidth(float width) {
42
+ float linkWidth;
43
+ if (scaleLinksOnZoom) {
44
+ // Use original width if links should scale with zoom
45
+ linkWidth = width;
46
+ } else {
47
+ // Adjust width based on zoom level to maintain visual size
48
+ linkWidth = width / transformationMatrix[0][0];
49
+ // Apply a non-linear scaling to avoid extreme widths
50
+ linkWidth *= min(5.0, max(1.0, transformationMatrix[0][0] * 0.01));
51
+ }
52
+ // Limit link width based on whether it has an arrow
53
+ if (useArrow > 0.5) {
54
+ return min(linkWidth, (maxPointSize * 2.0) / transformationMatrix[0][0]);
55
+ } else {
56
+ return min(linkWidth, maxPointSize / transformationMatrix[0][0]);
57
+ }
58
+ }
59
+
60
+ float calculateArrowWidth(float arrowWidth) {
61
+ if (scaleLinksOnZoom) {
62
+ return arrowWidth;
63
+ } else {
64
+ return arrowWidth / transformationMatrix[0][0];
65
+ }
66
+ }
67
+
39
68
  void main() {
40
69
  pos = position;
41
70
 
42
71
  vec2 pointTexturePosA = (pointA + 0.5) / pointsTextureSize;
43
72
  vec2 pointTexturePosB = (pointB + 0.5) / pointsTextureSize;
44
- // Greyed out status of points
73
+
45
74
  vec4 greyoutStatusA = texture2D(pointGreyoutStatus, pointTexturePosA);
46
75
  vec4 greyoutStatusB = texture2D(pointGreyoutStatus, pointTexturePosB);
47
- // Position
76
+
48
77
  vec4 pointPositionA = texture2D(positionsTexture, pointTexturePosA);
49
78
  vec4 pointPositionB = texture2D(positionsTexture, pointTexturePosB);
50
79
  vec2 a = pointPositionA.xy;
51
80
  vec2 b = pointPositionB.xy;
81
+
82
+ // Calculate direction vector and its perpendicular
52
83
  vec2 xBasis = b - a;
53
84
  vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
54
85
 
@@ -57,50 +88,69 @@ void main() {
57
88
  float h = curvedLinkControlPointDistance;
58
89
  vec2 controlPoint = (a + b) / 2.0 + yBasis * linkDist * h;
59
90
 
91
+ // Convert link distance to screen pixels
60
92
  float linkDistPx = linkDist * transformationMatrix[0][0];
61
93
 
94
+ // Calculate line width using the width scale
62
95
  float linkWidth = width * widthScale;
63
96
  float k = 2.0;
97
+ // Arrow width is proportionally larger than the line width
64
98
  float arrowWidth = max(5.0, linkWidth * k);
65
99
  arrowWidth *= arrowSizeScale;
66
100
 
67
- float arrowWidthPx = arrowWidth / transformationMatrix[0][0];
101
+ // Calculate arrow width in pixels
102
+ float arrowWidthPx = calculateArrowWidth(arrowWidth);
103
+
104
+ // Calculate arrow length proportional to its width
105
+ // 0.866 is approximately sqrt(3)/2 - related to equilateral triangle geometry
106
+ // Cap the length to avoid overly long arrows on short links
68
107
  arrowLength = min(0.3, (0.866 * arrowWidthPx * 2.0) / linkDist);
69
108
 
70
- float smoothWidth = 2.0;
71
- float arrowExtraWidth = arrowWidth - linkWidth;
72
- linkWidth += smoothWidth / 2.0;
73
109
  useArrow = arrow;
74
110
  if (useArrow > 0.5) {
75
- linkWidth += arrowExtraWidth;
111
+ linkWidth *= 2.0;
76
112
  }
77
- smoothWidthRatio = smoothWidth / linkWidth;
78
- linkWidthArrowWidthRatio = arrowExtraWidth / linkWidth;
79
113
 
80
- float linkWidthPx = linkWidth / transformationMatrix[0][0];
114
+ // Calculate final link width in pixels with smoothing
115
+ float linkWidthPx = calculateLinkWidth(linkWidth);
116
+ float smoothingPx = 0.5 / transformationMatrix[0][0];
117
+ smoothing = smoothingPx / linkWidthPx;
118
+ linkWidthPx += smoothingPx;
81
119
 
82
- // Color
120
+ // Calculate final color with opacity based on link distance
83
121
  vec3 rgbColor = color.rgb;
122
+ // Adjust opacity based on link distance
84
123
  float opacity = color.a * max(linkVisibilityMinTransparency, map(linkDistPx, linkVisibilityDistanceRange.g, linkVisibilityDistanceRange.r, 0.0, 1.0));
85
124
 
125
+ // Apply greyed out opacity if either endpoint is greyed out
86
126
  if (greyoutStatusA.r > 0.0 || greyoutStatusB.r > 0.0) {
87
127
  opacity *= greyoutOpacity;
88
128
  }
89
129
 
130
+ // Pass final color to fragment shader
90
131
  rgbaColor = vec4(rgbColor, opacity);
91
132
 
133
+ // Calculate position on the curved path
92
134
  float t = position.x;
93
135
  float w = curvedWeight;
136
+
94
137
  float tPrev = t - 1.0 / curvedLinkSegments;
95
138
  float tNext = t + 1.0 / curvedLinkSegments;
139
+
96
140
  vec2 pointCurr = conicParametricCurve(a, b, controlPoint, t, w);
141
+
97
142
  vec2 pointPrev = conicParametricCurve(a, b, controlPoint, max(0.0, tPrev), w);
98
143
  vec2 pointNext = conicParametricCurve(a, b, controlPoint, min(tNext, 1.0), w);
144
+
99
145
  vec2 xBasisCurved = pointNext - pointPrev;
100
146
  vec2 yBasisCurved = normalize(vec2(-xBasisCurved.y, xBasisCurved.x));
147
+
101
148
  pointCurr += yBasisCurved * linkWidthPx * position.y;
149
+
150
+ // Transform to clip space coordinates
102
151
  vec2 p = 2.0 * pointCurr / spaceSize - 1.0;
103
152
  p *= spaceSize / screenSize;
104
- vec3 final = transformationMatrix * vec3(p, 1);
153
+ vec3 final = transformationMatrix * vec3(p, 1);
154
+
105
155
  gl_Position = vec4(final.rg, 0, 1);
106
156
  }
@@ -63,16 +63,15 @@ export class Lines extends CoreModule {
63
63
  pointGreyoutStatus: () => this.points?.greyoutStatusFbo,
64
64
  transformationMatrix: () => store.transform,
65
65
  pointsTextureSize: () => store.pointsTextureSize,
66
- pointSizeScale: () => config.pointSizeScale,
67
66
  widthScale: () => config.linkWidthScale,
68
67
  arrowSizeScale: () => config.linkArrowsSizeScale,
69
68
  spaceSize: () => store.adjustedSpaceSize,
70
69
  screenSize: () => store.screenSize,
71
- ratio: () => config.pixelRatio,
72
70
  linkVisibilityDistanceRange: () => config.linkVisibilityDistanceRange,
73
71
  linkVisibilityMinTransparency: () => config.linkVisibilityMinTransparency,
74
72
  greyoutOpacity: () => config.linkGreyoutOpacity,
75
- scalePointsOnZoom: () => config.scalePointsOnZoom,
73
+ scaleLinksOnZoom: () => config.scaleLinksOnZoom,
74
+ maxPointSize: () => store.maxPointSize,
76
75
  curvedWeight: () => config.curvedLinkWeight,
77
76
  curvedLinkControlPointDistance: () => config.curvedLinkControlPointDistance,
78
77
  curvedLinkSegments: () => config.curvedLinks ? config.curvedLinkSegments ?? defaultConfigValues.curvedLinkSegments : 1,
@@ -24,6 +24,7 @@ import { Meta } from "@storybook/blocks";
24
24
  | linkGreyoutOpacity | Greyed out link opacity value when the selection is active | `0.1` |
25
25
  | linkWidth | The default width value to use for links when no link widths are provided or if the width value in the array is `undefined` or `null` | `1` |
26
26
  | linkWidthScale | Scale factor for the link width | `1` |
27
+ | scaleLinksOnZoom | Increase/decrease link width when zooming | `false` |
27
28
  | curvedLinks | If set to true, links are rendered as curved lines. Otherwise as straight lines | `false` |
28
29
  | curvedLinkSegments | Number of segments in a curved line | `19` |
29
30
  | curvedLinkWeight | Weight affects the shape of the curve | `0.8` |
@@ -35,7 +36,7 @@ import { Meta } from "@storybook/blocks";
35
36
  | useClassicQuadtree | Use the classic [quadtree algorithm](https://en.wikipedia.org/wiki/Barnes%E2%80%93Hut_simulation) for the Many-Body force. This property will be applied only on component initialization and it can't be changed using the `setConfig` method.<br /><br /> ⚠ The algorithm might not work on some GPUs (e.g. Nvidia) and on Windows (unless you disable ANGLE in the browser settings). | `false` |
36
37
  | showFPSMonitor | Show WebGL performance monitor | `false` |
37
38
  | pixelRatio | Canvas pixel ratio | `2` |
38
- | scalePointsOnZoom | Increase/decrease point size when zooming | `true` |
39
+ | scalePointsOnZoom | Increase/decrease point size when zooming | `false` |
39
40
  | initialZoomLevel | Initial zoom level (set once during initialization) | `undefined` |
40
41
  | enableZoom | Enables zooming interactions | `true` |
41
42
  | enableSimulationDuringZoom | Keep simulation running during zoom operations | `false` |
@@ -70,6 +71,7 @@ cosmos.gl layout algorithm was inspired by the [d3-force](https://github.com/d3/
70
71
  | simulationLinkDistance | Minimum link distance | 1 – 20 | `10` |
71
72
  | simulationLinkDistRandomVariationRange | Link distance randomness multiplier range | [0.8 – 1.2,<br/> 1.2 – 2.0] | `[1.0, 1.2]` |
72
73
  | simulationRepulsionFromMouse | Repulsion from the mouse pointer force coefficient. The repulsion force is activated by pressing the right mouse button. | 0.0 – 5.0 | `2.0`
74
+ | enableRightClickRepulsion | Enable or disable the repulsion force from mouse when right-clicking. When set to `true`, holding the right mouse button will activate the mouse repulsion force. When set to `false`, right-clicking will not trigger any repulsion force. | - | `false` |
73
75
  | simulationFriction | Friction coefficient. Values range from `0` (high friction, stops quickly) to `1` (no friction, keeps moving). | 0.0 – 1.0 | `0.85` |
74
76
  | simulationCluster | Cluster coefficient | 0.0 – 1.0 | `0.1` |
75
77
 
@@ -24,7 +24,8 @@ export const basicSetUp = (): { graph: Graph; div: HTMLDivElement} => {
24
24
  backgroundColor: '#2d313a',
25
25
  pointSize: 4,
26
26
  pointColor: '#4B5BBF',
27
- linkWidth: 0.1,
27
+ linkWidth: 0.6,
28
+ scalePointsOnZoom: true,
28
29
  linkColor: '#5F74C2',
29
30
  linkArrows: false,
30
31
  linkGreyoutOpacity: 0,
@@ -30,7 +30,8 @@ export const pointLabels = (
30
30
  const graph = new Graph(graphDiv, {
31
31
  spaceSize: 4096,
32
32
  backgroundColor: '#2d313a',
33
- linkWidth: 0.1,
33
+ scalePointsOnZoom: true,
34
+ linkWidth: 0.6,
34
35
  linkColor: '#5F74C2',
35
36
  linkArrows: false,
36
37
  fitViewOnInit: false,
@@ -9,6 +9,7 @@ export const quickStart = (): { graph: Graph; div: HTMLDivElement} => {
9
9
  spaceSize: 4096,
10
10
  backgroundColor: '#2d313a',
11
11
  pointColor: '#F069B4',
12
+ scalePointsOnZoom: true,
12
13
  simulationFriction: 0.1, // keeps the graph inert
13
14
  simulationGravity: 0, // disables gravity
14
15
  simulationRepulsion: 0.5, // increases repulsion between points
@@ -5,8 +5,9 @@ export const config: GraphConfigInterface = {
5
5
  backgroundColor: '#2d313a',
6
6
  pointSize: 4,
7
7
  pointColor: '#4B5BBF',
8
+ scalePointsOnZoom: true,
8
9
  pointGreyoutOpacity: 0.1,
9
- linkWidth: 0.1,
10
+ linkWidth: 0.6,
10
11
  linkColor: '#5F74C2',
11
12
  linkArrows: false,
12
13
  linkGreyoutOpacity: 0,
@@ -25,7 +25,8 @@ export const createCosmos = (props: CosmosStoryProps): { div: HTMLDivElement; gr
25
25
  pointSize: 3,
26
26
  pointColor: '#4B5BBF',
27
27
  pointGreyoutOpacity: 0.1,
28
- linkWidth: 0.2,
28
+ scalePointsOnZoom: true,
29
+ linkWidth: 0.8,
29
30
  linkColor: '#5F74C2',
30
31
  linkArrows: false,
31
32
  linkGreyoutOpacity: 0,
@@ -104,7 +104,7 @@ export function generateMeshData (
104
104
  linkColors[i * 4 + 2] = rgba[2]
105
105
  linkColors[i * 4 + 3] = 0.9
106
106
 
107
- linkWidths[i] = getRandom(0.1, 0.5)
107
+ linkWidths[i] = getRandom(0.4, 0.8)
108
108
  // linkStrength[i] = (n * m - sourcePointIndex) / (n * m)
109
109
  }
110
110
 
package/src/variables.ts CHANGED
@@ -43,7 +43,8 @@ export const defaultConfigValues = {
43
43
  },
44
44
  showFPSMonitor: false,
45
45
  pixelRatio: 2,
46
- scalePointsOnZoom: true,
46
+ scalePointsOnZoom: false,
47
+ scaleLinksOnZoom: false,
47
48
  enableZoom: true,
48
49
  enableSimulationDuringZoom: false,
49
50
  enableDrag: false,
@@ -54,6 +55,7 @@ export const defaultConfigValues = {
54
55
  pointSamplingDistance: 150,
55
56
  attribution: '',
56
57
  rescalePositions: undefined,
58
+ enableRightClickRepulsion: false,
57
59
  }
58
60
 
59
61
  export const hoveredPointRingOpacity = 0.7