@krainovsd/graph 0.10.0-rc5 → 0.10.0-rc7

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.
Files changed (79) hide show
  1. package/lib/cjs/index.cjs +1897 -1318
  2. package/lib/cjs/index.cjs.map +1 -1
  3. package/lib/esm/constants/force-controls.js +141 -0
  4. package/lib/esm/constants/force-controls.js.map +1 -0
  5. package/lib/esm/constants/graph-controls.js +25 -0
  6. package/lib/esm/constants/graph-controls.js.map +1 -0
  7. package/lib/esm/constants/highlight-controls.js +452 -0
  8. package/lib/esm/constants/highlight-controls.js.map +1 -0
  9. package/lib/esm/constants/link-controls.js +219 -0
  10. package/lib/esm/constants/link-controls.js.map +1 -0
  11. package/lib/esm/constants/node-controls.js +345 -0
  12. package/lib/esm/constants/node-controls.js.map +1 -0
  13. package/lib/esm/index.js +24 -3
  14. package/lib/esm/index.js.map +1 -1
  15. package/lib/esm/lib/fade-rgb.js.map +1 -1
  16. package/lib/esm/lib/rgb-animation-by-progress.js.map +1 -1
  17. package/lib/esm/module/GraphCanvas/GraphCanvas.js +16 -27
  18. package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
  19. package/lib/esm/module/GraphCanvas/constants/common-settings.js +7 -0
  20. package/lib/esm/module/GraphCanvas/constants/common-settings.js.map +1 -0
  21. package/lib/esm/module/GraphCanvas/constants/force-settings.js +28 -0
  22. package/lib/esm/module/GraphCanvas/constants/force-settings.js.map +1 -0
  23. package/lib/esm/module/GraphCanvas/constants/graph-settings.js +19 -0
  24. package/lib/esm/module/GraphCanvas/constants/graph-settings.js.map +1 -0
  25. package/lib/esm/module/GraphCanvas/constants/highlight-settings.js +62 -0
  26. package/lib/esm/module/GraphCanvas/constants/highlight-settings.js.map +1 -0
  27. package/lib/esm/module/GraphCanvas/constants/link-settings.js +31 -0
  28. package/lib/esm/module/GraphCanvas/constants/link-settings.js.map +1 -0
  29. package/lib/esm/module/GraphCanvas/constants/node-settings.js +50 -0
  30. package/lib/esm/module/GraphCanvas/constants/node-settings.js.map +1 -0
  31. package/lib/esm/module/GraphCanvas/lib/settings/force-settings-getter.js +3 -1
  32. package/lib/esm/module/GraphCanvas/lib/settings/force-settings-getter.js.map +1 -1
  33. package/lib/esm/module/GraphCanvas/lib/settings/graph-settings-getter.js +1 -1
  34. package/lib/esm/module/GraphCanvas/lib/settings/graph-settings-getter.js.map +1 -1
  35. package/lib/esm/module/GraphCanvas/lib/settings/highlight-settings-getter.js +13 -0
  36. package/lib/esm/module/GraphCanvas/lib/settings/highlight-settings-getter.js.map +1 -0
  37. package/lib/esm/module/GraphCanvas/lib/settings/link-settings-getter.js +13 -11
  38. package/lib/esm/module/GraphCanvas/lib/settings/link-settings-getter.js.map +1 -1
  39. package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js +22 -20
  40. package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js.map +1 -1
  41. package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js +8 -4
  42. package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js.map +1 -1
  43. package/lib/esm/module/GraphCanvas/lib/utils/drag-place-coefficient-getter.js.map +1 -1
  44. package/lib/esm/module/GraphCanvas/lib/utils/get-particle-position.js.map +1 -1
  45. package/lib/esm/module/GraphCanvas/lib/utils/is-node-visible.js +3 -1
  46. package/lib/esm/module/GraphCanvas/lib/utils/is-node-visible.js.map +1 -1
  47. package/lib/esm/module/GraphCanvas/lib/utils/is-overlaps-node.js.map +1 -1
  48. package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js +2 -2
  49. package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js.map +1 -1
  50. package/lib/esm/module/GraphCanvas/lib/utils/link-highlight.js +66 -0
  51. package/lib/esm/module/GraphCanvas/lib/utils/link-highlight.js.map +1 -0
  52. package/lib/esm/module/GraphCanvas/lib/utils/link-iteration-extractor.js +2 -3
  53. package/lib/esm/module/GraphCanvas/lib/utils/link-iteration-extractor.js.map +1 -1
  54. package/lib/esm/module/GraphCanvas/lib/utils/node-by-pointer-getter.js.map +1 -1
  55. package/lib/esm/module/GraphCanvas/lib/utils/node-highlight.js +115 -0
  56. package/lib/esm/module/GraphCanvas/lib/utils/node-highlight.js.map +1 -0
  57. package/lib/esm/module/GraphCanvas/lib/utils/node-iteration-extractor.js +2 -3
  58. package/lib/esm/module/GraphCanvas/lib/utils/node-iteration-extractor.js.map +1 -1
  59. package/lib/esm/module/GraphCanvas/slices/draw-links.js +90 -60
  60. package/lib/esm/module/GraphCanvas/slices/draw-links.js.map +1 -1
  61. package/lib/esm/module/GraphCanvas/slices/draw-nodes.js +214 -135
  62. package/lib/esm/module/GraphCanvas/slices/draw-nodes.js.map +1 -1
  63. package/lib/esm/module/GraphCanvas/slices/draw-text.js.map +1 -1
  64. package/lib/esm/module/GraphCanvas/slices/init-dnd.js +4 -4
  65. package/lib/esm/module/GraphCanvas/slices/init-dnd.js.map +1 -1
  66. package/lib/esm/module/GraphCanvas/slices/init-draw.js +4 -15
  67. package/lib/esm/module/GraphCanvas/slices/init-draw.js.map +1 -1
  68. package/lib/esm/module/GraphCanvas/slices/init-pointer.js +17 -17
  69. package/lib/esm/module/GraphCanvas/slices/init-pointer.js.map +1 -1
  70. package/lib/esm/module/GraphCanvas/slices/init-simulation.js +22 -23
  71. package/lib/esm/module/GraphCanvas/slices/init-simulation.js.map +1 -1
  72. package/lib/esm/module/GraphCanvas/slices/init-zoom.js +1 -1
  73. package/lib/esm/module/GraphCanvas/slices/init-zoom.js.map +1 -1
  74. package/lib/index.d.ts +436 -221
  75. package/package.json +1 -1
  76. package/lib/esm/lib/get-controls-info.js +0 -915
  77. package/lib/esm/lib/get-controls-info.js.map +0 -1
  78. package/lib/esm/module/GraphCanvas/constants/settings.js +0 -158
  79. package/lib/esm/module/GraphCanvas/constants/settings.js.map +0 -1
package/lib/cjs/index.cjs CHANGED
@@ -10,6 +10,11 @@ const d3Selection = require('d3-selection');
10
10
  const d3Drag = require('d3-drag');
11
11
  const lodash = require('lodash');
12
12
 
13
+ const COMMON_SETTINGS = {
14
+ nodeRadius: 5,
15
+ nodeSize: 5,
16
+ };
17
+
13
18
  const FORCE_SETTINGS = {
14
19
  forces: true,
15
20
  centerForce: true,
@@ -25,7 +30,6 @@ const FORCE_SETTINGS = {
25
30
  collideIterations: 2,
26
31
  collideOffMax: { links: 0, nodes: 0 },
27
32
  chargeStrength: -40,
28
- chargeDistanceMax: Infinity,
29
33
  chargeDistanceMin: 1,
30
34
  xPosition: 0,
31
35
  xStrength: 0.1,
@@ -36,6 +40,7 @@ const FORCE_SETTINGS = {
36
40
  linkStrength: 1,
37
41
  collideRadius: null,
38
42
  };
43
+
39
44
  const GRAPH_SETTINGS = {
40
45
  zoomExtent: [0.3, 10],
41
46
  translateExtent: [[], []],
@@ -48,57 +53,121 @@ const GRAPH_SETTINGS = {
48
53
  showDrawTime: true,
49
54
  showDrawTimeEveryTick: false,
50
55
  };
51
- const NODE_SETTINGS = {
52
- cache: true,
53
- highlightByNodeOnlyRoot: true,
56
+
57
+ const HIGHLIGHT_SETTINGS = {
54
58
  highlightByHoverNode: true,
59
+ highlightByHoverLink: true,
60
+ linkHoverExtraZone: 2,
61
+ /** Node */
62
+ highlightByNodeOnlyRoot: true,
63
+ highlightByNodeForNodeColorFading: false,
64
+ highlightByNodeForNodeColor: null,
65
+ highlightByNodeForNodeSizingAdditional: 0.5,
66
+ highlightByNodeForNodeSizingAdditionalCoefficient: 0.35,
67
+ highlightByNodeForNodeColorFadingMin: 0.15,
68
+ highlightByNodeForNodeFadingMin: 0.21,
69
+ highlightByNodeForNodeBorderColor: null,
70
+ highlightByNodeForNodeBorderSizingAdditional: 0,
71
+ highlightByLinkForNodeColorFading: false,
72
+ highlightByLinkForNodeColor: null,
73
+ highlightByLinkForNodeSizingAdditional: 0.5,
74
+ highlightByLinkForNodeSizingAdditionalCoefficient: 0.35,
75
+ highlightByLinkForNodeColorFadingMin: 0.15,
76
+ highlightByLinkForNodeFadingMin: 0.21,
77
+ highlightByLinkForNodeBorderColor: null,
78
+ highlightByLinkForNodeBorderSizingAdditional: 0,
79
+ /** Text */
80
+ highlightByNodeForTextShiftXAdditional: 0,
81
+ highlightByNodeForTextShiftYAdditional: 2,
82
+ highlightByNodeForTextSizingAdditional: 1,
83
+ highlightByNodeForTextWeightAdditional: 0,
84
+ highlightByNodeForTextFadingMin: 0.21,
85
+ highlightByLinkForTextShiftXAdditional: 0,
86
+ highlightByLinkForTextShiftYAdditional: 2,
87
+ highlightByLinkForTextSizingAdditional: 1,
88
+ highlightByLinkForTextWeightAdditional: 0,
89
+ highlightByLinkForTextFadingMin: 0.21,
90
+ /** Label */
91
+ highlightByNodeForLabelFadingMin: 0.21,
92
+ highlightByNodeForLabelSizingAdditional: 1,
93
+ highlightByNodeForLabelWeightAdditional: 0,
94
+ highlightByLinkForLabelFadingMin: 0.21,
95
+ highlightByLinkForLabelSizingAdditional: 1,
96
+ highlightByLinkForLabelWeightAdditional: 0,
97
+ /** Link */
98
+ highlightByNodeForLinkFadingMin: 0.21,
99
+ highlightByNodeForLinkSizeAdditional: 0,
100
+ highlightByNodeForLinkColor: null,
101
+ highlightByLinkForLinkFadingMin: 0.21,
102
+ highlightByLinkForLinkSizeAdditional: 0,
103
+ highlightByLinkForLinkColor: null,
104
+ /** Arrow */
105
+ highlightByNodeForArrowFadingMin: 0.21,
106
+ highlightByNodeForArrowSizeAdditional: 0,
107
+ highlightByNodeForArrowColor: null,
108
+ highlightByNodeForArrowBorderColor: null,
109
+ highlightByNodeForArrowBorderSizingAdditional: 0,
110
+ highlightByLinkForArrowFadingMin: 0.21,
111
+ highlightByLinkForArrowSizeAdditional: 0,
112
+ highlightByLinkForArrowColor: null,
113
+ highlightByLinkForArrowBorderColor: null,
114
+ highlightByLinkForArrowBorderSizingAdditional: 0,
115
+ };
116
+
117
+ const LINK_SETTINGS = {
118
+ cacheOptions: true,
119
+ prettyDraw: true,
120
+ linkScaleSwitch: 1,
121
+ linkColorAfterScaleSwitch: "#000000FF",
122
+ linkColorBeforeScaleSwitch: "#999",
123
+ linkWidthAfterScaleSwitch: 0.1,
124
+ linkWidthBeforeScaleSwitch: 1,
125
+ arrow: true,
126
+ arrowByHighlight: true,
127
+ particles: true,
128
+ particleFlexSpeed: true,
129
+ particleFlexSpeedCoefficient: 4,
130
+ };
131
+ const LINK_OPTIONS = {
132
+ alpha: 1,
133
+ arrowAlpha: 1,
134
+ arrowSize: 2,
135
+ arrowBorderColor: "#000000FF",
136
+ arrowBorderWidth: 0.1,
137
+ particleAlpha: 1,
138
+ particleColor: "#000000FF",
139
+ particleBorderColor: "#000000FF",
140
+ particleBorderWidth: 0.1,
141
+ particleCount: 2,
142
+ particleRadius: 0.5,
143
+ particleSteps: 60,
144
+ };
145
+
146
+ const NODE_SETTINGS = {
147
+ cacheOptions: true,
55
148
  nodeRadiusFlexible: true,
56
- nodeSizeFlexible: true,
57
- textNodeDebug: true,
58
- highlightByNodeNodeFading: true,
59
- highlightByNodeNodeColor: false,
60
- highlightByNodeNodeSizing: true,
61
- highlightByNodeTextFading: true,
62
- highlightByNodeTextSizing: true,
63
- highlightByLinkNodeFading: false,
64
- highlightByLinkNodeColor: false,
65
- highlightByLinkNodeSizing: true,
66
- highlightByLinkTextFading: false,
67
- highlightByLinkTextSizing: true,
68
149
  nodeRadiusCoefficient: 5,
69
150
  nodeRadiusFactor: 1,
151
+ nodeSizeFlexible: true,
70
152
  nodeSizeCoefficient: 5,
71
153
  nodeSizeFactor: 0.1,
72
- highlightByNodeNodeSizingAdditional: 0.5,
73
- highlightByNodeNodeSizingAdditionalCoefficient: 0.35,
74
- highlightByNodeNodeColorFadingMin: 0.15,
75
- highlightByNodeTextShiftXAdditional: 0,
76
- highlightByNodeTextShiftYAdditional: 2,
77
- highlightByNodeTextSizingAdditional: 1,
78
- highlightByNodeTextWeightAdditional: 0,
79
- highlightByNodeTextWidthAdditional: 10,
80
- highlightByNodeNodeFadingMin: 0.21,
81
- highlightByNodeTextFadingMin: 0.21,
82
- highlightByLinkNodeSizingAdditional: 0.5,
83
- highlightByLinkNodeSizingAdditionalCoefficient: 0.35,
84
- highlightByLinkNodeColorFadingMin: 0.15,
85
- highlightByLinkTextShiftXAdditional: 0,
86
- highlightByLinkTextShiftYAdditional: 2,
87
- highlightByLinkTextSizingAdditional: 1,
88
- highlightByLinkTextWeightAdditional: 0,
89
- highlightByLinkTextWidthAdditional: 10,
90
- highlightByLinkNodeFadingMin: 0.21,
91
- highlightByLinkTextFadingMin: 0.21,
154
+ textScaleMin: 1.5,
155
+ textScaleMax: 18,
156
+ textSizeMin: 3.5,
157
+ textSizeMax: 1.5,
158
+ textShiftYMin: 4,
159
+ textShiftYMax: 2.5,
160
+ textNodeDebug: false,
92
161
  };
93
162
  const NODE_OPTIONS = {
94
- shape: "text",
163
+ shape: "circle",
95
164
  height: 10,
96
165
  width: 15,
97
166
  borderRadius: 0,
98
167
  radius: 4,
99
168
  alpha: 1,
100
- textNodeXPadding: 1,
101
- textNodeYPadding: 1,
169
+ labelXPadding: 1,
170
+ labelYPadding: 1,
102
171
  borderWidth: 0.1,
103
172
  borderColor: "#000000FF",
104
173
  textAlpha: 1,
@@ -110,56 +179,16 @@ const NODE_OPTIONS = {
110
179
  textStyle: "normal",
111
180
  textWeight: 500,
112
181
  textGap: 0,
113
- };
114
- const LINK_SETTINGS = {
115
- cache: true,
116
- particles: true,
117
- particleFlexSpeed: true,
118
- pretty: true,
119
- arrow: true,
120
- highlightByHoverLink: true,
121
- arrowByHighlight: true,
122
- highlightByNodeLinkFading: true,
123
- highlightByNodeArrowFading: true,
124
- highlightByLinkLinkFading: false,
125
- highlightByLinkArrowFading: false,
126
- particleFlexSpeedCoefficient: 4,
127
- hoverLinkThreshold: 2,
128
- highlightByNodeLinkFadingMin: 0.21,
129
- highlightByNodeArrowFadingMin: 0.21,
130
- highlightByLinkArrowFadingMin: 0.21,
131
- highlightByLinkLinkFadingMin: 0.21,
132
- };
133
- const LINK_OPTIONS = {
134
- alpha: 1,
135
- arrowAlpha: 1,
136
- arrowSize: 2,
137
- arrowBorderColor: "#000000FF",
138
- arrowBorderWidth: 0.1,
139
- particleAlpha: 1,
140
- particleColor: "#000000FF",
141
- particleBorderColor: "#000000FF",
142
- particleBorderWidth: 0.1,
143
- particleCount: 2,
144
- particleRadius: 0.5,
145
- particleSteps: 60,
146
- };
147
- const COMMON_SETTINGS = {
148
- linkColorZoomFar: "#999",
149
- linkColorZoomNear: "#000000FF",
150
- linkWidthZoomFar: 1,
151
- linkWidthZoomNear: 0.1,
152
- linkWidthZoomBorder: 1,
153
- linkColorZoomBorder: 1,
154
- nodeTextScaleMin: 1.5,
155
- nodeTextScaleMax: 20,
156
- nodeTextSizeMin: 1.5,
157
- nodeTextSizeMax: 3.5,
158
- nodeTextShiftYMin: 2.5,
159
- nodeTextShiftYMax: 4,
160
- nodeTextChangeStepCount: 200,
161
- nodeRadius: 5,
162
- nodeSize: 5,
182
+ label: null,
183
+ labelAlpha: 1,
184
+ labelAlign: "center",
185
+ labelColor: "#333",
186
+ labelFont: "Arial",
187
+ labelGap: 0,
188
+ labelSize: 3.5,
189
+ labelStyle: "normal",
190
+ labelWeight: 500,
191
+ labelWidth: 20,
163
192
  };
164
193
 
165
194
  function forceSettingsGetter(settings, prevSettings) {
@@ -179,20 +208,20 @@ function graphSettingsGetter(settings, prevSettings) {
179
208
  function linkSettingsGetter(settings, prevSettings) {
180
209
  return { ...(prevSettings ?? LINK_SETTINGS), ...settings };
181
210
  }
182
- function linkOptionsGetter(_, __, ___, state) {
211
+ function linkOptionsGetter() {
183
212
  return {
184
213
  ...LINK_OPTIONS,
185
214
  drawExtraLink: null,
186
215
  drawLink: null,
187
- color: state?.areaTransform && state?.areaTransform.k > COMMON_SETTINGS.linkColorZoomBorder
188
- ? COMMON_SETTINGS.linkColorZoomNear
189
- : COMMON_SETTINGS.linkColorZoomFar,
190
- arrowColor: state?.areaTransform && state?.areaTransform.k > COMMON_SETTINGS.linkColorZoomBorder
191
- ? COMMON_SETTINGS.linkColorZoomNear
192
- : COMMON_SETTINGS.linkColorZoomFar,
193
- width: state?.areaTransform && state?.areaTransform.k > COMMON_SETTINGS.linkWidthZoomBorder
194
- ? COMMON_SETTINGS.linkWidthZoomNear
195
- : COMMON_SETTINGS.linkWidthZoomFar,
216
+ color: this.areaTransform && this.areaTransform.k > this.linkSettings.linkScaleSwitch
217
+ ? this.linkSettings.linkColorAfterScaleSwitch
218
+ : this.linkSettings.linkColorBeforeScaleSwitch,
219
+ arrowColor: this.areaTransform && this.areaTransform.k > this.linkSettings.linkScaleSwitch
220
+ ? this.linkSettings.linkColorAfterScaleSwitch
221
+ : this.linkSettings.linkColorBeforeScaleSwitch,
222
+ width: this.areaTransform && this.areaTransform.k > this.linkSettings.linkScaleSwitch
223
+ ? this.linkSettings.linkWidthAfterScaleSwitch
224
+ : this.linkSettings.linkWidthBeforeScaleSwitch,
196
225
  };
197
226
  }
198
227
 
@@ -278,917 +307,6 @@ function rgbAnimationByProgress(start, end, progress) {
278
307
  };
279
308
  }
280
309
 
281
- function getForceControls(keys) {
282
- const FORCE_CONTROLS = [
283
- {
284
- id: "forces",
285
- initialValue: FORCE_SETTINGS.forces,
286
- label: "Физика",
287
- type: "checkbox",
288
- },
289
- {
290
- id: "collideForce",
291
- type: "checkbox",
292
- label: "Сила отталкивания",
293
- initialValue: FORCE_SETTINGS.collideForce,
294
- },
295
- {
296
- id: "centerForce",
297
- type: "checkbox",
298
- label: "Сила центрирования",
299
- initialValue: FORCE_SETTINGS.centerForce,
300
- },
301
- {
302
- id: "chargeForce",
303
- type: "checkbox",
304
- label: "Сила дистанции",
305
- initialValue: FORCE_SETTINGS.chargeForce,
306
- },
307
- {
308
- id: "linkForce",
309
- type: "checkbox",
310
- label: "Сила связей",
311
- initialValue: FORCE_SETTINGS.linkForce,
312
- },
313
- {
314
- id: "xForce",
315
- type: "checkbox",
316
- label: "Сила X",
317
- initialValue: FORCE_SETTINGS.xForce,
318
- },
319
- {
320
- id: "yForce",
321
- type: "checkbox",
322
- label: "Сила Y",
323
- initialValue: FORCE_SETTINGS.yForce,
324
- },
325
- {
326
- id: "centerStrength",
327
- initialValue: FORCE_SETTINGS.centerStrength,
328
- label: "Граница центра",
329
- max: 1,
330
- min: 0,
331
- step: 0.01,
332
- type: "range",
333
- },
334
- {
335
- id: "collideStrength",
336
- initialValue: FORCE_SETTINGS.collideStrength,
337
- label: "Сила отталкивания",
338
- max: 1,
339
- min: 0,
340
- step: 0.01,
341
- type: "range",
342
- },
343
- {
344
- id: "collideAdditionalRadius",
345
- initialValue: FORCE_SETTINGS.collideAdditionalRadius,
346
- label: "Радиус отталкивания",
347
- max: 300,
348
- min: 0,
349
- step: 0.1,
350
- type: "range",
351
- },
352
- {
353
- id: "collideIterations",
354
- initialValue: FORCE_SETTINGS.collideIterations,
355
- label: "Итерации отталкивания",
356
- max: 10,
357
- min: 0,
358
- step: 1,
359
- type: "range",
360
- },
361
- {
362
- id: "chargeStrength",
363
- initialValue: FORCE_SETTINGS.chargeStrength ,
364
- label: "Дистанция",
365
- max: 0,
366
- min: -300,
367
- step: 0.1,
368
- type: "range",
369
- },
370
- {
371
- type: "range",
372
- id: "xPosition",
373
- min: 0,
374
- max: 2000,
375
- step: 1,
376
- label: "Координата притяжения X",
377
- initialValue: FORCE_SETTINGS.xPosition ,
378
- },
379
- {
380
- type: "range",
381
- id: "yPosition",
382
- min: 0,
383
- max: 2000,
384
- step: 1,
385
- label: "Координата притяжения Y",
386
- initialValue: FORCE_SETTINGS.yPosition ,
387
- },
388
- {
389
- type: "range",
390
- id: "xStrength",
391
- min: 0,
392
- max: 1,
393
- step: 0.01,
394
- label: "Гравитация X",
395
- initialValue: FORCE_SETTINGS.xStrength ,
396
- },
397
- {
398
- type: "range",
399
- id: "yStrength",
400
- min: 0,
401
- max: 1,
402
- step: 0.01,
403
- label: "Гравитация Y",
404
- initialValue: FORCE_SETTINGS.yStrength ,
405
- },
406
- {
407
- type: "range",
408
- id: "linkStrength",
409
- min: 0,
410
- max: 1,
411
- step: 0.01,
412
- label: "Натяжение связей",
413
- initialValue: FORCE_SETTINGS.linkStrength ,
414
- },
415
- {
416
- type: "range",
417
- id: "linkDistance",
418
- min: 0,
419
- max: 300,
420
- step: 0.1,
421
- label: "Расстояние связей",
422
- initialValue: FORCE_SETTINGS.linkDistance ,
423
- },
424
- ];
425
- return keys ? FORCE_CONTROLS.filter((control) => keys.includes(control.id)) : FORCE_CONTROLS;
426
- }
427
- function getGraphControls(keys) {
428
- const GRAPH_CONTROLS = [
429
- {
430
- id: "highlightDownFrames",
431
- initialValue: GRAPH_SETTINGS.highlightDownFrames,
432
- max: 60,
433
- min: 1,
434
- step: 1,
435
- type: "range",
436
- label: "Скорость отмены анимации в кадрах",
437
- },
438
- {
439
- id: "highlightUpFrames",
440
- initialValue: GRAPH_SETTINGS.highlightUpFrames,
441
- max: 60,
442
- min: 1,
443
- step: 1,
444
- type: "range",
445
- label: "Скорость применения анимации в кадрах",
446
- },
447
- ];
448
- return keys ? GRAPH_CONTROLS.filter((control) => keys.includes(control.id)) : GRAPH_CONTROLS;
449
- }
450
- function getNodeSettingControls(keys) {
451
- const NODE_SETTINGS_CONTROLS = [
452
- {
453
- id: "cache",
454
- type: "checkbox",
455
- initialValue: NODE_SETTINGS.cache,
456
- label: "Кеширование вычисляемых настроек",
457
- },
458
- {
459
- id: "highlightByNodeOnlyRoot",
460
- type: "checkbox",
461
- initialValue: NODE_SETTINGS.highlightByNodeOnlyRoot,
462
- label: "Дополнительная анимация только главное цели при анимации ноды",
463
- },
464
- {
465
- id: "highlightByHoverNode",
466
- type: "checkbox",
467
- initialValue: NODE_SETTINGS.highlightByHoverNode,
468
- label: "Анимации при наведении на ноду",
469
- },
470
- {
471
- id: "nodeRadiusFlexible",
472
- type: "checkbox",
473
- initialValue: NODE_SETTINGS.nodeRadiusFlexible,
474
- label: "Гибкий радиус ноды",
475
- },
476
- {
477
- id: "nodeSizeFlexible",
478
- type: "checkbox",
479
- initialValue: NODE_SETTINGS.nodeSizeFlexible,
480
- label: "Гибкий размер ноды",
481
- },
482
- {
483
- id: "textNodeDebug",
484
- type: "checkbox",
485
- initialValue: NODE_SETTINGS.textNodeDebug,
486
- label: "Отладка текстовой ноды",
487
- },
488
- {
489
- id: "highlightByNodeNodeFading",
490
- type: "checkbox",
491
- initialValue: NODE_SETTINGS.highlightByNodeNodeFading,
492
- label: "Затухание при анимации ноды",
493
- },
494
- {
495
- id: "highlightByNodeNodeColor",
496
- type: "checkbox",
497
- initialValue: NODE_SETTINGS.highlightByNodeNodeColor,
498
- label: "Затухание цвета при анимации ноды",
499
- },
500
- {
501
- id: "highlightByNodeNodeSizing",
502
- type: "checkbox",
503
- initialValue: NODE_SETTINGS.highlightByNodeNodeSizing,
504
- label: "Изменение размера при анимации ноды",
505
- },
506
- {
507
- id: "highlightByNodeTextFading",
508
- type: "checkbox",
509
- initialValue: NODE_SETTINGS.highlightByNodeTextFading,
510
- label: "Затухание текста при анимации ноды",
511
- },
512
- {
513
- id: "highlightByNodeTextSizing",
514
- type: "checkbox",
515
- initialValue: NODE_SETTINGS.highlightByNodeTextSizing,
516
- label: "Изменение размера текста при анимации ноды",
517
- },
518
- {
519
- id: "highlightByLinkNodeFading",
520
- type: "checkbox",
521
- initialValue: NODE_SETTINGS.highlightByLinkNodeFading,
522
- label: "Затухание при анимации связи",
523
- },
524
- {
525
- id: "highlightByLinkNodeColor",
526
- type: "checkbox",
527
- initialValue: NODE_SETTINGS.highlightByLinkNodeColor,
528
- label: "Затухание цвета при анимации связи",
529
- },
530
- {
531
- id: "highlightByLinkNodeSizing",
532
- type: "checkbox",
533
- initialValue: NODE_SETTINGS.highlightByLinkNodeSizing,
534
- label: "Изменение размера при анимации связи",
535
- },
536
- {
537
- id: "highlightByLinkTextFading",
538
- type: "checkbox",
539
- initialValue: NODE_SETTINGS.highlightByLinkTextFading,
540
- label: "Затухание текста при анимации связи",
541
- },
542
- {
543
- id: "highlightByLinkTextSizing",
544
- type: "checkbox",
545
- initialValue: NODE_SETTINGS.highlightByLinkTextSizing,
546
- label: "Изменение размера текста при анимации связи",
547
- },
548
- {
549
- id: "nodeRadiusCoefficient",
550
- initialValue: NODE_SETTINGS.nodeRadiusCoefficient,
551
- max: 100,
552
- min: 0.1,
553
- step: 0.1,
554
- type: "range",
555
- label: "Количество связей для увеличения радиуса",
556
- },
557
- {
558
- id: "nodeRadiusFactor",
559
- initialValue: NODE_SETTINGS.nodeRadiusFactor,
560
- max: 50,
561
- min: 0.1,
562
- step: 0.1,
563
- type: "range",
564
- label: "Коэффициент увеличения радиуса",
565
- },
566
- {
567
- id: "nodeSizeCoefficient",
568
- initialValue: NODE_SETTINGS.nodeSizeCoefficient,
569
- max: 50,
570
- min: 0.1,
571
- step: 0.1,
572
- type: "range",
573
- label: "Количество связей для увеличения размера",
574
- },
575
- {
576
- id: "nodeSizeFactor",
577
- initialValue: NODE_SETTINGS.nodeSizeFactor,
578
- max: 20,
579
- min: 0.01,
580
- step: 0.01,
581
- type: "range",
582
- label: "Коэффициент увеличения размера",
583
- },
584
- {
585
- id: "highlightByNodeNodeSizingAdditional",
586
- initialValue: NODE_SETTINGS.highlightByNodeNodeSizingAdditional,
587
- max: 10,
588
- min: 0.1,
589
- step: 0.01,
590
- type: "range",
591
- label: "Дополнительный размер при анимации ноды",
592
- },
593
- {
594
- id: "highlightByNodeNodeSizingAdditionalCoefficient",
595
- initialValue: NODE_SETTINGS.highlightByNodeNodeSizingAdditionalCoefficient,
596
- max: 10,
597
- min: 0.01,
598
- step: 0.01,
599
- type: "range",
600
- label: "Дополнительный размер квадрата при анимации ноды",
601
- },
602
- {
603
- id: "highlightByNodeNodeColorFadingMin",
604
- initialValue: NODE_SETTINGS.highlightByNodeNodeColorFadingMin,
605
- max: 1,
606
- min: 0.01,
607
- step: 0.01,
608
- type: "range",
609
- label: "Граница затухания цвета при анимации ноды",
610
- },
611
- {
612
- id: "highlightByNodeTextShiftXAdditional",
613
- initialValue: NODE_SETTINGS.highlightByNodeTextShiftXAdditional,
614
- max: 50,
615
- min: 0,
616
- step: 0.1,
617
- type: "range",
618
- label: "Смещение текста по X при анимации ноды",
619
- },
620
- {
621
- id: "highlightByNodeTextShiftYAdditional",
622
- initialValue: NODE_SETTINGS.highlightByNodeTextShiftYAdditional,
623
- max: 50,
624
- min: 0,
625
- step: 0.1,
626
- type: "range",
627
- label: "Смещение текста по Y при анимации ноды",
628
- },
629
- {
630
- id: "highlightByNodeTextSizingAdditional",
631
- initialValue: NODE_SETTINGS.highlightByNodeTextSizingAdditional,
632
- max: 10,
633
- min: 0.1,
634
- step: 0.1,
635
- type: "range",
636
- label: "Увеличение текста при анимации ноды",
637
- },
638
- {
639
- id: "highlightByNodeTextWeightAdditional",
640
- initialValue: NODE_SETTINGS.highlightByNodeTextWeightAdditional,
641
- max: 1000,
642
- min: 0,
643
- step: 100,
644
- type: "range",
645
- label: "Увеличение жирности текста при анимации ноды",
646
- },
647
- {
648
- id: "highlightByNodeTextWidthAdditional",
649
- initialValue: NODE_SETTINGS.highlightByNodeTextWidthAdditional,
650
- max: 100,
651
- min: 0,
652
- step: 0.1,
653
- type: "range",
654
- label: "Увеличение ширины текста при анимации ноды",
655
- },
656
- {
657
- id: "highlightByNodeNodeFadingMin",
658
- initialValue: NODE_SETTINGS.highlightByNodeNodeFadingMin,
659
- max: 1,
660
- min: 0,
661
- step: 0.01,
662
- type: "range",
663
- label: "Граница затухания ноды при анимации ноды",
664
- },
665
- {
666
- id: "highlightByNodeTextFadingMin",
667
- initialValue: NODE_SETTINGS.highlightByNodeTextFadingMin,
668
- max: 1,
669
- min: 0,
670
- step: 0.01,
671
- type: "range",
672
- label: "Граница затухания текста при анимации ноды",
673
- },
674
- {
675
- id: "highlightByLinkNodeSizingAdditional",
676
- initialValue: NODE_SETTINGS.highlightByLinkNodeSizingAdditional,
677
- max: 10,
678
- min: 0.1,
679
- step: 0.01,
680
- type: "range",
681
- label: "Дополнительный размер при анимации связи",
682
- },
683
- {
684
- id: "highlightByLinkNodeSizingAdditionalCoefficient",
685
- initialValue: NODE_SETTINGS.highlightByLinkNodeSizingAdditionalCoefficient,
686
- max: 10,
687
- min: 0.01,
688
- step: 0.01,
689
- type: "range",
690
- label: "Дополнительный размер квадрата при анимации связи",
691
- },
692
- {
693
- id: "highlightByLinkNodeColorFadingMin",
694
- initialValue: NODE_SETTINGS.highlightByLinkNodeColorFadingMin,
695
- max: 1,
696
- min: 0.01,
697
- step: 0.01,
698
- type: "range",
699
- label: "Граница затухания цвета при анимации связи",
700
- },
701
- {
702
- id: "highlightByLinkTextShiftXAdditional",
703
- initialValue: NODE_SETTINGS.highlightByLinkTextShiftXAdditional,
704
- max: 50,
705
- min: 0,
706
- step: 0.1,
707
- type: "range",
708
- label: "Смещение текста по X при анимации связи",
709
- },
710
- {
711
- id: "highlightByLinkTextShiftYAdditional",
712
- initialValue: NODE_SETTINGS.highlightByLinkTextShiftYAdditional,
713
- max: 50,
714
- min: 0,
715
- step: 0.1,
716
- type: "range",
717
- label: "Смещение текста по Y при анимации связи",
718
- },
719
- {
720
- id: "highlightByLinkTextSizingAdditional",
721
- initialValue: NODE_SETTINGS.highlightByLinkTextSizingAdditional,
722
- max: 10,
723
- min: 0.1,
724
- step: 0.1,
725
- type: "range",
726
- label: "Увеличение текста при анимации связи",
727
- },
728
- {
729
- id: "highlightByLinkTextWeightAdditional",
730
- initialValue: NODE_SETTINGS.highlightByLinkTextWeightAdditional,
731
- max: 1000,
732
- min: 0,
733
- step: 100,
734
- type: "range",
735
- label: "Увеличение жирности текста при анимации связи",
736
- },
737
- {
738
- id: "highlightByLinkTextWidthAdditional",
739
- initialValue: NODE_SETTINGS.highlightByLinkTextWidthAdditional,
740
- max: 100,
741
- min: 0,
742
- step: 0.1,
743
- type: "range",
744
- label: "Увеличение ширины текста при анимации связи",
745
- },
746
- {
747
- id: "highlightByLinkNodeFadingMin",
748
- initialValue: NODE_SETTINGS.highlightByLinkNodeFadingMin,
749
- max: 1,
750
- min: 0,
751
- step: 0.01,
752
- type: "range",
753
- label: "Граница затухания ноды при анимации связи",
754
- },
755
- {
756
- id: "highlightByLinkTextFadingMin",
757
- initialValue: NODE_SETTINGS.highlightByLinkTextFadingMin,
758
- max: 1,
759
- min: 0,
760
- step: 0.01,
761
- type: "range",
762
- label: "Граница затухания текста при анимации связи",
763
- },
764
- ];
765
- return keys
766
- ? NODE_SETTINGS_CONTROLS.filter((control) => keys.includes(control.id))
767
- : NODE_SETTINGS_CONTROLS;
768
- }
769
- function getNodeOptionsControls(keys) {
770
- const NODE_CONTROLS = [
771
- {
772
- id: "shape",
773
- type: "select",
774
- initialValue: NODE_OPTIONS.shape,
775
- label: "Форма",
776
- options: [
777
- { label: "Картинки", value: "icon" },
778
- { label: "Круг", value: "circle" },
779
- { label: "Прямоугольник", value: "square" },
780
- { label: "Текст", value: "text" },
781
- ],
782
- },
783
- {
784
- id: "radius",
785
- type: "range",
786
- max: 50,
787
- min: 1,
788
- step: 1,
789
- label: "Радиус",
790
- initialValue: NODE_OPTIONS.radius,
791
- },
792
- {
793
- id: "width",
794
- type: "range",
795
- max: 50,
796
- min: 1,
797
- step: 1,
798
- label: "Ширина",
799
- initialValue: NODE_OPTIONS.width,
800
- },
801
- {
802
- id: "height",
803
- type: "range",
804
- max: 50,
805
- min: 1,
806
- step: 1,
807
- label: "Высота",
808
- initialValue: NODE_OPTIONS.height,
809
- },
810
- {
811
- id: "borderRadius",
812
- type: "range",
813
- max: 50,
814
- min: 0,
815
- step: 1,
816
- label: "Радиус границы",
817
- initialValue: NODE_OPTIONS.borderRadius,
818
- },
819
- {
820
- id: "alpha",
821
- type: "range",
822
- max: 1,
823
- min: 0,
824
- step: 0.1,
825
- label: "Прозрачность",
826
- initialValue: NODE_OPTIONS.alpha,
827
- },
828
- {
829
- id: "borderWidth",
830
- type: "range",
831
- max: 5,
832
- min: 0,
833
- step: 0.1,
834
- label: "Толщина границы",
835
- initialValue: NODE_OPTIONS.borderWidth,
836
- },
837
- {
838
- id: "borderColor",
839
- type: "color",
840
- initialValue: "#000000FF",
841
- label: "Цвет границы",
842
- },
843
- {
844
- id: "color",
845
- type: "color",
846
- initialValue: "#000000FF",
847
- label: "Цвет",
848
- },
849
- {
850
- id: "textNodeXPadding",
851
- type: "range",
852
- max: 30,
853
- min: 0,
854
- step: 0.1,
855
- label: "Отступы по оси X у текстовой ноды внутри контейнера",
856
- initialValue: NODE_OPTIONS.textNodeXPadding,
857
- },
858
- {
859
- id: "textNodeYPadding",
860
- type: "range",
861
- max: 30,
862
- min: 0,
863
- step: 0.1,
864
- label: "Отступы по оси Y у текстовой ноды внутри контейнера",
865
- initialValue: NODE_OPTIONS.textNodeYPadding,
866
- },
867
- {
868
- id: "textSize",
869
- type: "range",
870
- max: 30,
871
- min: 0,
872
- step: 0.1,
873
- label: "Размер текста",
874
- initialValue: 0,
875
- },
876
- {
877
- id: "textAlpha",
878
- type: "range",
879
- max: 1,
880
- min: 0,
881
- step: 0.1,
882
- label: "Прозрачность текста",
883
- initialValue: NODE_OPTIONS.textAlpha,
884
- },
885
- {
886
- id: "textWidth",
887
- type: "range",
888
- max: 200,
889
- min: 5,
890
- step: 1,
891
- label: "Ширина текста",
892
- initialValue: NODE_OPTIONS.textWidth,
893
- },
894
- {
895
- id: "textShiftX",
896
- type: "range",
897
- max: 100,
898
- min: 0,
899
- step: 0.1,
900
- label: "Смещение X текста",
901
- initialValue: NODE_OPTIONS.textShiftX,
902
- },
903
- {
904
- id: "textShiftY",
905
- type: "range",
906
- max: 100,
907
- min: 0,
908
- step: 0.1,
909
- label: "Смещение Y текста",
910
- initialValue: 4,
911
- },
912
- {
913
- id: "textWeight",
914
- type: "range",
915
- max: 1000,
916
- min: 100,
917
- step: 100,
918
- label: "Жирность текста",
919
- initialValue: NODE_OPTIONS.textWeight,
920
- },
921
- {
922
- id: "textGap",
923
- type: "range",
924
- max: 30,
925
- min: 0,
926
- step: 0.1,
927
- label: "Расстояние между строками",
928
- initialValue: NODE_OPTIONS.textGap,
929
- },
930
- {
931
- id: "textColor",
932
- type: "color",
933
- initialValue: NODE_OPTIONS.textColor,
934
- label: "Цвет текста",
935
- },
936
- ];
937
- return keys ? NODE_CONTROLS.filter((control) => keys.includes(control.id)) : NODE_CONTROLS;
938
- }
939
- function getLinkSettingsControls(keys) {
940
- const LINK_SETTINGS_CONTROLS = [
941
- {
942
- id: "cache",
943
- type: "checkbox",
944
- label: "Кеширование вычисляемых настроек",
945
- initialValue: LINK_SETTINGS.cache,
946
- },
947
- {
948
- id: "particles",
949
- type: "checkbox",
950
- label: "Частицы",
951
- initialValue: LINK_SETTINGS.particles,
952
- },
953
- {
954
- id: "particleFlexSpeed",
955
- type: "checkbox",
956
- label: "Гибкий расчет скорости частицы",
957
- initialValue: LINK_SETTINGS.particleFlexSpeed,
958
- },
959
- {
960
- id: "pretty",
961
- type: "checkbox",
962
- label: "Обсчет красивого соединения",
963
- initialValue: LINK_SETTINGS.pretty,
964
- },
965
- {
966
- id: "arrow",
967
- type: "checkbox",
968
- label: "Стрелка",
969
- initialValue: LINK_SETTINGS.arrow,
970
- },
971
- {
972
- id: "arrowByHighlight",
973
- type: "checkbox",
974
- label: "Появление стрелки при анимации",
975
- initialValue: LINK_SETTINGS.arrowByHighlight,
976
- },
977
- {
978
- id: "highlightByHoverLink",
979
- type: "checkbox",
980
- label: "Анимация при наведении на связь",
981
- initialValue: LINK_SETTINGS.highlightByHoverLink,
982
- },
983
- {
984
- id: "highlightByNodeLinkFading",
985
- type: "checkbox",
986
- label: "Затухание при анимации ноды",
987
- initialValue: LINK_SETTINGS.highlightByNodeLinkFading,
988
- },
989
- {
990
- id: "highlightByNodeArrowFading",
991
- type: "checkbox",
992
- label: "Затухание стрелки при анимации ноды",
993
- initialValue: LINK_SETTINGS.highlightByNodeArrowFading,
994
- },
995
- {
996
- id: "highlightByLinkLinkFading",
997
- type: "checkbox",
998
- label: "Затухание при анимации связи",
999
- initialValue: LINK_SETTINGS.highlightByLinkLinkFading,
1000
- },
1001
- {
1002
- id: "highlightByLinkArrowFading",
1003
- type: "checkbox",
1004
- label: "Затухание стрелки при анимации связи",
1005
- initialValue: LINK_SETTINGS.highlightByLinkArrowFading,
1006
- },
1007
- {
1008
- id: "particleFlexSpeedCoefficient",
1009
- initialValue: LINK_SETTINGS.particleFlexSpeedCoefficient,
1010
- max: 10,
1011
- min: 0.1,
1012
- step: 0.1,
1013
- type: "range",
1014
- label: "Коэффициент скорости частицы относительно расстояния",
1015
- },
1016
- {
1017
- id: "hoverLinkThreshold",
1018
- initialValue: LINK_SETTINGS.hoverLinkThreshold,
1019
- max: 10,
1020
- min: 0,
1021
- step: 0.01,
1022
- type: "range",
1023
- label: "Расширение границы связи для курсора",
1024
- },
1025
- {
1026
- id: "highlightByNodeLinkFadingMin",
1027
- initialValue: LINK_SETTINGS.highlightByNodeLinkFadingMin,
1028
- max: 1,
1029
- min: 0,
1030
- step: 0.01,
1031
- type: "range",
1032
- label: "Граница затухания связи при анимации ноды",
1033
- },
1034
- {
1035
- id: "highlightByNodeArrowFadingMin",
1036
- initialValue: LINK_SETTINGS.highlightByNodeArrowFadingMin,
1037
- max: 1,
1038
- min: 0,
1039
- step: 0.01,
1040
- type: "range",
1041
- label: "Граница затухания стрелки при анимации ноды",
1042
- },
1043
- {
1044
- id: "highlightByLinkLinkFadingMin",
1045
- initialValue: LINK_SETTINGS.highlightByLinkLinkFadingMin,
1046
- max: 1,
1047
- min: 0,
1048
- step: 0.01,
1049
- type: "range",
1050
- label: "Граница затухания связи при анимации связи",
1051
- },
1052
- {
1053
- id: "highlightByLinkArrowFadingMin",
1054
- initialValue: LINK_SETTINGS.highlightByLinkArrowFadingMin,
1055
- max: 1,
1056
- min: 0,
1057
- step: 0.01,
1058
- type: "range",
1059
- label: "Граница затухания стрелки при анимации связи",
1060
- },
1061
- ];
1062
- return keys
1063
- ? LINK_SETTINGS_CONTROLS.filter((control) => keys.includes(control.id))
1064
- : LINK_SETTINGS_CONTROLS;
1065
- }
1066
- function getLinkOptionsControls(keys) {
1067
- const LINK_CONTROLS = [
1068
- {
1069
- id: "alpha",
1070
- type: "range",
1071
- max: 1,
1072
- min: 0,
1073
- step: 0.1,
1074
- label: "Прозрачность",
1075
- initialValue: LINK_OPTIONS.alpha,
1076
- },
1077
- {
1078
- id: "width",
1079
- type: "range",
1080
- max: 10,
1081
- min: 0.1,
1082
- step: 0.1,
1083
- label: "Толщина",
1084
- initialValue: 0.1,
1085
- },
1086
- {
1087
- id: "arrowAlpha",
1088
- type: "range",
1089
- max: 1,
1090
- min: 0,
1091
- step: 0.1,
1092
- label: "Прозрачность стрелки",
1093
- initialValue: LINK_OPTIONS.arrowAlpha,
1094
- },
1095
- {
1096
- id: "arrowSize",
1097
- type: "range",
1098
- max: 10,
1099
- min: 0.1,
1100
- step: 0.1,
1101
- label: "Размер стрелки",
1102
- initialValue: LINK_OPTIONS.arrowSize,
1103
- },
1104
- {
1105
- id: "arrowBorderWidth",
1106
- type: "range",
1107
- max: 10,
1108
- min: 0.1,
1109
- step: 0.1,
1110
- label: "Размер границы стрелки",
1111
- initialValue: LINK_OPTIONS.arrowBorderWidth,
1112
- },
1113
- {
1114
- id: "particleBorderWidth",
1115
- type: "range",
1116
- max: 10,
1117
- min: 0.1,
1118
- step: 0.1,
1119
- label: "Размер границы частиц",
1120
- initialValue: LINK_OPTIONS.particleBorderWidth,
1121
- },
1122
- {
1123
- id: "particleAlpha",
1124
- type: "range",
1125
- max: 1,
1126
- min: 0,
1127
- step: 0.1,
1128
- label: "Прозрачность частиц",
1129
- initialValue: LINK_OPTIONS.particleAlpha,
1130
- },
1131
- {
1132
- id: "particleRadius",
1133
- type: "range",
1134
- max: 10,
1135
- min: 0.1,
1136
- step: 0.1,
1137
- label: "Радиус частиц",
1138
- initialValue: LINK_OPTIONS.particleRadius,
1139
- },
1140
- {
1141
- id: "particleCount",
1142
- type: "range",
1143
- max: 20,
1144
- min: 1,
1145
- step: 1,
1146
- label: "Количество частиц",
1147
- initialValue: LINK_OPTIONS.particleCount,
1148
- },
1149
- {
1150
- id: "particleSteps",
1151
- type: "range",
1152
- max: 200,
1153
- min: 1,
1154
- step: 1,
1155
- label: "Количество кадров у частиц",
1156
- initialValue: LINK_OPTIONS.particleSteps,
1157
- },
1158
- {
1159
- id: "color",
1160
- type: "color",
1161
- initialValue: "#000000FF",
1162
- label: "Цвет",
1163
- },
1164
- {
1165
- id: "arrowColor",
1166
- type: "color",
1167
- initialValue: "#000000FF",
1168
- label: "Цвет стрелки",
1169
- },
1170
- {
1171
- id: "arrowBorderColor",
1172
- type: "color",
1173
- initialValue: LINK_OPTIONS.arrowBorderColor,
1174
- label: "Цвет границы стрелки",
1175
- },
1176
- {
1177
- id: "particleColor",
1178
- type: "color",
1179
- initialValue: LINK_OPTIONS.particleColor,
1180
- label: "Цвет частиц",
1181
- },
1182
- {
1183
- id: "particleBorderColor",
1184
- type: "color",
1185
- initialValue: LINK_OPTIONS.particleBorderColor,
1186
- label: "Цвет границы частиц",
1187
- },
1188
- ];
1189
- return keys ? LINK_CONTROLS.filter((control) => keys.includes(control.id)) : LINK_CONTROLS;
1190
- }
1191
-
1192
310
  let countTime = 0;
1193
311
  let countOperation = 0;
1194
312
  function setDrawTime(cb, showEveryTick) {
@@ -1224,8 +342,8 @@ function nodeSettingsGetter(settings, prevNodeSettings) {
1224
342
  };
1225
343
  }
1226
344
  const color = colorGetter();
1227
- function nodeOptionsGetter(node, _, __, state) {
1228
- const { textShiftY, textSize } = nodeTextSizeGetter(state?.areaTransform);
345
+ function nodeOptionsGetter(node) {
346
+ const { textShiftY, textSize } = nodeTextSizeGetter(this.areaTransform, this.nodeSettings);
1229
347
  return {
1230
348
  ...NODE_OPTIONS,
1231
349
  nodeDraw: null,
@@ -1233,30 +351,31 @@ function nodeOptionsGetter(node, _, __, state) {
1233
351
  textDraw: null,
1234
352
  textExtraDraw: null,
1235
353
  color: color(String(node.group ?? "_DEFAULT")),
1236
- textVisible: Boolean(state?.areaTransform && state.areaTransform.k > COMMON_SETTINGS.nodeTextScaleMin),
354
+ textVisible: Boolean(this.areaTransform.k > this.nodeSettings.textScaleMin),
1237
355
  text: node.name ?? node.id.toString(),
1238
356
  textShiftY,
1239
357
  textSize,
1240
358
  };
1241
359
  }
1242
- function nodeTextSizeGetter(transform) {
1243
- let textSize = COMMON_SETTINGS.nodeTextSizeMax;
1244
- let textShiftY = COMMON_SETTINGS.nodeTextShiftYMax;
360
+ function nodeTextSizeGetter(transform, nodeSettings) {
361
+ let textSize = nodeSettings.textSizeMin;
362
+ let textShiftY = nodeSettings.textShiftYMin;
1245
363
  if (transform) {
1246
- const scaleStepCoefficient = (COMMON_SETTINGS.nodeTextScaleMax - COMMON_SETTINGS.nodeTextScaleMin) /
1247
- COMMON_SETTINGS.nodeTextChangeStepCount;
1248
- const textStepCoefficient = (COMMON_SETTINGS.nodeTextSizeMax - COMMON_SETTINGS.nodeTextSizeMin) /
1249
- COMMON_SETTINGS.nodeTextChangeStepCount;
1250
- const shiftStepCoefficient = (COMMON_SETTINGS.nodeTextShiftYMax - COMMON_SETTINGS.nodeTextShiftYMin) /
1251
- COMMON_SETTINGS.nodeTextChangeStepCount;
1252
- if (transform.k >= COMMON_SETTINGS.nodeTextScaleMax) {
1253
- textSize = COMMON_SETTINGS.nodeTextSizeMin;
1254
- textShiftY = COMMON_SETTINGS.nodeTextShiftYMin;
1255
- }
1256
- else if (transform.k > COMMON_SETTINGS.nodeTextScaleMin) {
1257
- const transformSteps = (transform.k - COMMON_SETTINGS.nodeTextScaleMin) / scaleStepCoefficient;
1258
- textSize -= transformSteps * textStepCoefficient;
1259
- textShiftY -= transformSteps * shiftStepCoefficient;
364
+ if (transform.k >= nodeSettings.textScaleMax) {
365
+ textSize = nodeSettings.textSizeMax;
366
+ textShiftY = nodeSettings.textShiftYMax;
367
+ }
368
+ else if (transform.k > nodeSettings.textScaleMin) {
369
+ textSize =
370
+ nodeSettings.textSizeMin +
371
+ ((transform.k - nodeSettings.textScaleMin) *
372
+ (nodeSettings.textSizeMax - nodeSettings.textSizeMin)) /
373
+ (nodeSettings.textScaleMax - nodeSettings.textScaleMin);
374
+ textShiftY =
375
+ nodeSettings.textShiftYMin +
376
+ ((transform.k - nodeSettings.textScaleMin) *
377
+ (nodeSettings.textShiftYMax - nodeSettings.textShiftYMin)) /
378
+ (nodeSettings.textScaleMax - nodeSettings.textScaleMin);
1260
379
  }
1261
380
  }
1262
381
  return { textSize, textShiftY };
@@ -1279,6 +398,13 @@ function nodeIdGetter(node) {
1279
398
  return node.id;
1280
399
  }
1281
400
 
401
+ function highlightSettingsGetter(settings, prevSettings) {
402
+ return {
403
+ ...(prevSettings ?? HIGHLIGHT_SETTINGS),
404
+ ...settings,
405
+ };
406
+ }
407
+
1282
408
  function pointerGetter(mouseEvent, areaRect, areaTransform) {
1283
409
  const clientX = "clientX" in mouseEvent
1284
410
  ? mouseEvent.clientX
@@ -1359,7 +485,7 @@ function linkIterationExtractor(link, i, links, state, option, optionConstantGet
1359
485
  let customOptions;
1360
486
  let constantOptions;
1361
487
  if (typeof option === "function")
1362
- customOptions = option(link, i, links, state);
488
+ customOptions = option.call(state, link, i, links);
1363
489
  else
1364
490
  customOptions = option;
1365
491
  if (customOptions && typeof customOptions === "object" && !Array.isArray(customOptions)) {
@@ -1370,7 +496,7 @@ function linkIterationExtractor(link, i, links, state, option, optionConstantGet
1370
496
  }
1371
497
  if (optionConstantGetter) {
1372
498
  if (typeof optionConstantGetter === "function")
1373
- constantOptions = optionConstantGetter(link, i, links, state);
499
+ constantOptions = optionConstantGetter.call(state, link, i, links);
1374
500
  else
1375
501
  constantOptions = optionConstantGetter;
1376
502
  if (constantOptions &&
@@ -1401,7 +527,7 @@ function nodeIterationExtractor(node, i, nodes, state, option, optionConstantGet
1401
527
  let customOptions;
1402
528
  let constantOptions;
1403
529
  if (typeof option === "function")
1404
- customOptions = option(node, i, nodes, state);
530
+ customOptions = option.call(state, node, i, nodes);
1405
531
  else
1406
532
  customOptions = option;
1407
533
  if (customOptions && typeof customOptions === "object" && !Array.isArray(customOptions)) {
@@ -1412,7 +538,7 @@ function nodeIterationExtractor(node, i, nodes, state, option, optionConstantGet
1412
538
  }
1413
539
  if (optionConstantGetter) {
1414
540
  if (typeof optionConstantGetter === "function")
1415
- constantOptions = optionConstantGetter(node, i, nodes, state);
541
+ constantOptions = optionConstantGetter.call(state, node, i, nodes);
1416
542
  else
1417
543
  constantOptions = optionConstantGetter;
1418
544
  if (constantOptions &&
@@ -1429,6 +555,7 @@ function nodeIterationExtractor(node, i, nodes, state, option, optionConstantGet
1429
555
  return customOptions;
1430
556
  }
1431
557
 
558
+ /* eslint-disable id-length */
1432
559
  function calculateLinkPositionByNode(link, arrowSize = 0) {
1433
560
  const source = link.source;
1434
561
  const target = link.target;
@@ -1469,7 +596,8 @@ function getLinkPoint(opts) {
1469
596
  nodePoint = getCircleIntersection({
1470
597
  x: opts.node.x,
1471
598
  y: opts.node.y,
1472
- radius: opts.node._radius ?? COMMON_SETTINGS.nodeRadius,
599
+ radius: (opts.node._radius ?? COMMON_SETTINGS.nodeRadius) +
600
+ (opts.node._borderWidth ? opts.node._borderWidth / 2 : 0),
1473
601
  oppositeX: opts.oppositeNode.x,
1474
602
  oppositeY: opts.oppositeNode.y,
1475
603
  arrowSize: opts.arrowSize,
@@ -1482,8 +610,8 @@ function getLinkPoint(opts) {
1482
610
  arrowSize: opts.arrowSize,
1483
611
  x: opts.node.x,
1484
612
  y: opts.node.y,
1485
- height: opts.node._height ?? COMMON_SETTINGS.nodeSize,
1486
- width: opts.node._width ?? COMMON_SETTINGS.nodeSize,
613
+ height: (opts.node._height ?? COMMON_SETTINGS.nodeSize) + (opts.node._borderWidth ?? 0),
614
+ width: (opts.node._width ?? COMMON_SETTINGS.nodeSize) + (opts.node._borderWidth ?? 0),
1487
615
  oppositeX: opts.oppositeNode.x,
1488
616
  oppositeY: opts.oppositeNode.y,
1489
617
  borderRadius: opts.node._shape === "text" ? 0 : (opts.node._borderRadius ?? 0),
@@ -1778,12 +906,12 @@ function getParticlePosition(opts) {
1778
906
  }
1779
907
 
1780
908
  /* eslint-disable id-length */
1781
- function linkByPointerGetter({ areaRect, areaTransform, mouseEvent, links, linkSettings, }) {
909
+ function linkByPointerGetter({ areaRect, areaTransform, mouseEvent, links, linkHoverExtraZone, }) {
1782
910
  if (!areaRect)
1783
911
  return undefined;
1784
912
  const [pointerX, pointerY] = pointerGetter(mouseEvent, areaRect, areaTransform);
1785
913
  return d3Array.greatest(links, (link) => {
1786
- if (isNearLink(pointerX, pointerY, link, linkSettings.hoverLinkThreshold))
914
+ if (isNearLink(pointerX, pointerY, link, linkHoverExtraZone))
1787
915
  return link.index;
1788
916
  });
1789
917
  }
@@ -1826,6 +954,172 @@ function distanceToLine(x, y, x1, y1, x2, y2) {
1826
954
  return Math.sqrt(dx * dx + dy * dy);
1827
955
  }
1828
956
 
957
+ function nodeHighlight(opts) {
958
+ let color = opts.nodeOptions.color;
959
+ let borderColor = opts.nodeOptions.borderColor;
960
+ let borderWidth = opts.nodeOptions.borderWidth;
961
+ let radiusInitial = opts.nodeOptions.radius;
962
+ let widthInitial = opts.nodeOptions.width;
963
+ let heightInitial = opts.nodeOptions.height;
964
+ let textSize = opts.nodeOptions.textSize;
965
+ let textShiftX = opts.nodeOptions.textShiftX;
966
+ let textShiftY = opts.nodeOptions.textShiftY;
967
+ let textWeight = opts.nodeOptions.textWeight;
968
+ let labelSize = opts.nodeOptions.labelSize;
969
+ let labelWeight = opts.nodeOptions.labelWeight;
970
+ let sizeCoefficient = 1;
971
+ if (opts.highlightForNodeColor) {
972
+ /** Color */
973
+ const colorRgb = extractRgb(colorToRgb(color));
974
+ const colorRgbHighlight = extractRgb(colorToRgb(opts.highlightForNodeColor));
975
+ if (colorRgb && colorRgbHighlight) {
976
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbHighlight, opts.highlightProgress);
977
+ color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
978
+ }
979
+ }
980
+ if (opts.nodeOptions.shape === "circle") {
981
+ /** Radius */
982
+ radiusInitial = animationByProgress(radiusInitial, opts.highlightForNodeSizingAdditional, opts.highlightProgress);
983
+ }
984
+ if (opts.nodeOptions.shape === "square" || opts.nodeOptions.shape === "text") {
985
+ /** Size */
986
+ sizeCoefficient = animationByProgress(sizeCoefficient, opts.highlightForNodeSizingAdditionalCoefficient, opts.highlightProgress);
987
+ widthInitial *= sizeCoefficient;
988
+ heightInitial *= sizeCoefficient;
989
+ }
990
+ if (opts.highlightForNodeBorderColor) {
991
+ /** Border Color */
992
+ const colorRgb = extractRgb(colorToRgb(borderColor));
993
+ const colorRgbHighlight = extractRgb(colorToRgb(opts.highlightForNodeBorderColor));
994
+ if (colorRgb && colorRgbHighlight) {
995
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbHighlight, opts.highlightProgress);
996
+ borderColor = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
997
+ }
998
+ }
999
+ /** Border Width */
1000
+ borderWidth = animationByProgress(borderWidth, opts.highlightForNodeBorderSizingAdditional, opts.highlightProgress);
1001
+ /** Text Size */
1002
+ textSize = animationByProgress(textSize, opts.highlightForTextSizingAdditional, opts.highlightProgress);
1003
+ /** Text Shift X */
1004
+ textShiftX = animationByProgress(textShiftX, opts.highlightForTextShiftXAdditional, opts.highlightProgress);
1005
+ /** Text Shift Y */
1006
+ textShiftY = animationByProgress(textShiftY, opts.highlightForTextShiftYAdditional, opts.highlightProgress);
1007
+ /** Text Weight */
1008
+ textWeight = animationByProgress(textWeight, opts.highlightForTextWeightAdditional, opts.highlightProgress);
1009
+ if (opts.nodeOptions.label) {
1010
+ /** Label Size */
1011
+ labelSize = animationByProgress(labelSize, opts.highlightForLabelSizingAdditional, opts.highlightProgress);
1012
+ /** Label Weight */
1013
+ labelWeight = animationByProgress(labelWeight, opts.highlightForLabelWeightAdditional, opts.highlightProgress);
1014
+ }
1015
+ return {
1016
+ color,
1017
+ borderColor,
1018
+ borderWidth,
1019
+ radiusInitial,
1020
+ widthInitial,
1021
+ heightInitial,
1022
+ textSize,
1023
+ textShiftX,
1024
+ textShiftY,
1025
+ textWeight,
1026
+ labelSize,
1027
+ labelWeight,
1028
+ sizeCoefficient,
1029
+ };
1030
+ }
1031
+ function nodeFade(opts) {
1032
+ let alpha = opts.nodeOptions.alpha;
1033
+ let color = opts.nodeOptions.color;
1034
+ let textAlpha = opts.nodeOptions.textAlpha;
1035
+ let labelAlpha = opts.nodeOptions.labelAlpha;
1036
+ /** Alpha */
1037
+ const alphaMin = opts.highlightForNodeFadingMin < alpha ? opts.highlightForNodeFadingMin : alpha;
1038
+ alpha = animationByProgress(alphaMin, alpha - alphaMin, 1 - opts.highlightProgress);
1039
+ /** Text Alpha */
1040
+ const textAlphaMin = opts.highlightForTextFadingMin < textAlpha ? opts.highlightForTextFadingMin : textAlpha;
1041
+ textAlpha = animationByProgress(textAlphaMin, textAlpha - textAlphaMin, 1 - opts.highlightProgress);
1042
+ if (opts.nodeOptions.label) {
1043
+ /** Label Alpha */
1044
+ const labelAlphaMin = opts.highlightForLabelFadingMin < labelAlpha ? opts.highlightForLabelFadingMin : labelAlpha;
1045
+ labelAlpha = animationByProgress(labelAlphaMin, labelAlpha - labelAlphaMin, 1 - opts.highlightProgress);
1046
+ }
1047
+ if (opts.highlightForNodeColorFading) {
1048
+ /** Color Fading */
1049
+ const colorRgb = extractRgb(colorToRgb(color));
1050
+ if (colorRgb) {
1051
+ const colorRgbFade = fadeRgb(colorRgb, opts.highlightForNodeColorFadingMin);
1052
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbFade, opts.highlightProgress);
1053
+ color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
1054
+ }
1055
+ }
1056
+ return {
1057
+ alpha,
1058
+ color,
1059
+ textAlpha,
1060
+ labelAlpha,
1061
+ };
1062
+ }
1063
+
1064
+ function linkHighlight(opts) {
1065
+ const arrowVisible = opts.arrow && !opts.arrowByHighlight;
1066
+ let arrowAlpha = opts.arrowByHighlight ? 0 : opts.linkOptions.arrowAlpha;
1067
+ let color = opts.linkOptions.color;
1068
+ let width = opts.linkOptions.width;
1069
+ let arrowColor = opts.linkOptions.arrowColor;
1070
+ let arrowSize = opts.linkOptions.arrowSize;
1071
+ let arrowBorderWidth = opts.linkOptions.arrowBorderWidth;
1072
+ let arrowBorderColor = opts.linkOptions.arrowBorderColor;
1073
+ if (opts.arrow && opts.arrowByHighlight) {
1074
+ /** Highlighted */
1075
+ arrowAlpha = animationByProgress(0, opts.linkOptions.arrowAlpha, opts.highlightProgress);
1076
+ }
1077
+ if (opts.highlightForLinkColor) {
1078
+ /** Color */
1079
+ const colorRgb = extractRgb(colorToRgb(color));
1080
+ const colorRgbHighlight = extractRgb(colorToRgb(opts.highlightForLinkColor));
1081
+ if (colorRgb && colorRgbHighlight) {
1082
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbHighlight, opts.highlightProgress);
1083
+ color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
1084
+ }
1085
+ }
1086
+ if (opts.highlightForArrowColor && arrowVisible) {
1087
+ /** Arrow Color */
1088
+ const colorRgb = extractRgb(colorToRgb(arrowColor));
1089
+ const colorRgbHighlight = extractRgb(colorToRgb(opts.highlightForArrowColor));
1090
+ if (colorRgb && colorRgbHighlight) {
1091
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbHighlight, opts.highlightProgress);
1092
+ arrowColor = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
1093
+ }
1094
+ }
1095
+ if (opts.highlightForArrowBorderColor && arrowVisible) {
1096
+ /** Arrow Border Color */
1097
+ const colorRgb = extractRgb(colorToRgb(arrowBorderColor));
1098
+ const colorRgbHighlight = extractRgb(colorToRgb(opts.highlightForArrowBorderColor));
1099
+ if (colorRgb && colorRgbHighlight) {
1100
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbHighlight, opts.highlightProgress);
1101
+ arrowBorderColor = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
1102
+ }
1103
+ }
1104
+ width = animationByProgress(width, opts.highlightForLinkSizeAdditional, opts.highlightProgress);
1105
+ if (arrowVisible) {
1106
+ arrowSize = animationByProgress(arrowSize, opts.highlightForArrowSizeAdditional, opts.highlightProgress);
1107
+ arrowBorderWidth = animationByProgress(arrowBorderWidth, opts.highlightForArrowBorderSizingAdditional, opts.highlightProgress);
1108
+ }
1109
+ return { arrowAlpha, color, width, arrowColor, arrowSize, arrowBorderWidth, arrowBorderColor };
1110
+ }
1111
+ function linkFade(opts) {
1112
+ let alpha = opts.linkOptions.alpha;
1113
+ let arrowAlpha = opts.arrowByHighlight ? 0 : opts.linkOptions.arrowAlpha;
1114
+ const alphaMin = opts.highlightForLinkFadingMin < alpha ? opts.highlightForLinkFadingMin : alpha;
1115
+ alpha = animationByProgress(alphaMin, alpha - alphaMin, 1 - opts.highlightProgress);
1116
+ if (opts.arrow && !opts.arrowByHighlight) {
1117
+ const arrowAlphaMin = opts.highlightForArrowFadingMin < arrowAlpha ? opts.highlightForArrowFadingMin : arrowAlpha;
1118
+ arrowAlpha = animationByProgress(arrowAlphaMin, arrowAlpha - arrowAlphaMin, 1 - opts.highlightProgress);
1119
+ }
1120
+ return { alpha, arrowAlpha };
1121
+ }
1122
+
1829
1123
  function initArea() {
1830
1124
  if (!this.area || !this.context || !this.container) {
1831
1125
  this.container = d3Selection.create("div")
@@ -1859,7 +1153,7 @@ function initDnd() {
1859
1153
  const dragHandler = d3Drag.drag()
1860
1154
  .subject((event) => {
1861
1155
  if (this.listeners.onDragSubject) {
1862
- return this.listeners.onDragSubject(event, this.state);
1156
+ return this.listeners.onDragSubject.call(this, event);
1863
1157
  }
1864
1158
  if (!this.areaRect)
1865
1159
  return;
@@ -1872,7 +1166,7 @@ function initDnd() {
1872
1166
  });
1873
1167
  })
1874
1168
  .on("start", (event) => {
1875
- this.listeners.onStartDragFinished?.(event, this.state);
1169
+ this.listeners.onStartDragFinished?.call?.(this, event);
1876
1170
  })
1877
1171
  .on("drag", (event) => {
1878
1172
  if (!this.isDragging) {
@@ -1886,7 +1180,7 @@ function initDnd() {
1886
1180
  const [pointerX, pointerY] = pointerGetter(mouseEvent, this.areaRect, this.areaTransform);
1887
1181
  event.subject.fx = pointerX;
1888
1182
  event.subject.fy = pointerY;
1889
- this.listeners.onMoveDragFinished?.(event, this.state);
1183
+ this.listeners.onMoveDragFinished?.call?.(this, event);
1890
1184
  })
1891
1185
  .on("end", (event) => {
1892
1186
  this.isDragging = false;
@@ -1902,12 +1196,12 @@ function initDnd() {
1902
1196
  event.subject.fx = null;
1903
1197
  event.subject.fy = null;
1904
1198
  }
1905
- this.listeners.onEndDragFinished?.(event, this.state);
1199
+ this.listeners.onEndDragFinished?.call?.(this, event);
1906
1200
  });
1907
1201
  d3Selection.select(this.area).call(dragHandler);
1908
1202
  }
1909
1203
 
1910
- function getDrawLink(state) {
1204
+ function getDrawLink() {
1911
1205
  return function drawLink(link, index) {
1912
1206
  if (!this.context ||
1913
1207
  typeof link.source !== "object" ||
@@ -1921,88 +1215,114 @@ function getDrawLink(state) {
1921
1215
  return;
1922
1216
  const id = `${link.target.id}${link.source.id}`;
1923
1217
  let linkOptions;
1924
- if (this.linkSettings.cache && this.linkOptionsCache[id]) {
1218
+ if (this.linkSettings.cacheOptions && this.linkOptionsCache[id]) {
1925
1219
  linkOptions = this.linkOptionsCache[id];
1926
1220
  }
1927
1221
  else {
1928
- linkOptions = linkIterationExtractor(link, index, this.links, state, this.linkSettings.options ?? {}, linkOptionsGetter);
1929
- if (this.linkSettings.cache) {
1222
+ linkOptions = linkIterationExtractor(link, index, this.links, this, this.linkSettings.options ?? {}, linkOptionsGetter);
1223
+ if (this.linkSettings.cacheOptions) {
1930
1224
  this.linkOptionsCache[id] = linkOptions;
1931
1225
  }
1932
1226
  }
1933
1227
  if (linkOptions.drawLink) {
1934
- linkOptions.drawLink(link, linkOptions, state);
1228
+ linkOptions.drawLink.call(this, link, linkOptions);
1935
1229
  return;
1936
1230
  }
1937
1231
  let alpha = linkOptions.alpha;
1232
+ let color = linkOptions.color;
1233
+ let width = linkOptions.width;
1938
1234
  let arrowAlpha = this.linkSettings.arrowByHighlight ? 0 : linkOptions.arrowAlpha;
1939
- /** NODE HIGHLIGHT */
1235
+ let arrowColor = linkOptions.arrowColor;
1236
+ let arrowSize = linkOptions.arrowSize;
1237
+ let arrowBorderWidth = linkOptions.arrowBorderWidth;
1238
+ let arrowBorderColor = linkOptions.arrowBorderColor;
1239
+ /** Highlight */
1940
1240
  if (this.highlightedNeighbors && this.highlightedNode) {
1941
- /** Not highlighted */
1241
+ /** By Node Not Highlight */
1942
1242
  if (this.highlightedNode.id != link.source.id && this.highlightedNode.id != link.target.id) {
1943
- if (this.linkSettings.highlightByNodeLinkFading) {
1944
- const min = this.linkSettings.highlightByNodeLinkFadingMin < alpha
1945
- ? this.linkSettings.highlightByNodeLinkFadingMin
1946
- : alpha;
1947
- alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);
1948
- }
1949
- if (this.linkSettings.arrow &&
1950
- this.linkSettings.highlightByNodeArrowFading &&
1951
- !this.linkSettings.arrowByHighlight) {
1952
- const min = this.linkSettings.highlightByNodeArrowFadingMin < arrowAlpha
1953
- ? this.linkSettings.highlightByNodeArrowFadingMin
1954
- : arrowAlpha;
1955
- arrowAlpha = animationByProgress(min, arrowAlpha - min, 1 - this.highlightProgress);
1956
- }
1243
+ const fadeOptions = linkFade({
1244
+ arrow: this.linkSettings.arrow,
1245
+ arrowByHighlight: this.linkSettings.arrowByHighlight,
1246
+ linkOptions,
1247
+ highlightProgress: this.highlightProgress,
1248
+ highlightForArrowFadingMin: this.highlightSettings.highlightByNodeForArrowFadingMin,
1249
+ highlightForLinkFadingMin: this.highlightSettings.highlightByNodeForLinkFadingMin,
1250
+ });
1251
+ alpha = fadeOptions.alpha;
1252
+ arrowAlpha = fadeOptions.arrowAlpha;
1957
1253
  }
1958
1254
  else {
1959
- // eslint-disable-next-line no-lonely-if
1960
- if (this.linkSettings.arrow && this.linkSettings.arrowByHighlight) {
1961
- /** Highlighted */
1962
- arrowAlpha = animationByProgress(0, linkOptions.arrowAlpha, this.highlightProgress);
1963
- }
1255
+ const highlightOptions = linkHighlight({
1256
+ arrow: this.linkSettings.arrow,
1257
+ arrowByHighlight: this.linkSettings.arrowByHighlight,
1258
+ linkOptions,
1259
+ highlightProgress: this.highlightProgress,
1260
+ highlightForArrowBorderColor: this.highlightSettings.highlightByNodeForArrowBorderColor,
1261
+ highlightForArrowBorderSizingAdditional: this.highlightSettings.highlightByNodeForArrowBorderSizingAdditional,
1262
+ highlightForArrowColor: this.highlightSettings.highlightByNodeForArrowColor,
1263
+ highlightForArrowSizeAdditional: this.highlightSettings.highlightByNodeForArrowSizeAdditional,
1264
+ highlightForLinkColor: this.highlightSettings.highlightByNodeForLinkColor,
1265
+ highlightForLinkSizeAdditional: this.highlightSettings.highlightByNodeForLinkSizeAdditional,
1266
+ });
1267
+ arrowAlpha = highlightOptions.arrowAlpha;
1268
+ color = highlightOptions.color;
1269
+ width = highlightOptions.width;
1270
+ arrowColor = highlightOptions.arrowColor;
1271
+ arrowSize = highlightOptions.arrowSize;
1272
+ arrowBorderWidth = highlightOptions.arrowBorderWidth;
1273
+ arrowBorderColor = highlightOptions.arrowBorderColor;
1964
1274
  }
1965
1275
  }
1966
- /** LINK HIGHLIGHT */
1967
1276
  if (this.highlightedNeighbors && this.highlightedLink) {
1968
- /** Not highlighted */
1277
+ /** By Link Not Highlight */
1969
1278
  if (this.highlightedLink !== link) {
1970
- if (this.linkSettings.highlightByLinkLinkFading) {
1971
- const min = this.linkSettings.highlightByLinkLinkFadingMin < alpha
1972
- ? this.linkSettings.highlightByLinkLinkFadingMin
1973
- : alpha;
1974
- alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);
1975
- }
1976
- if (this.linkSettings.arrow &&
1977
- this.linkSettings.highlightByLinkArrowFading &&
1978
- !this.linkSettings.arrowByHighlight) {
1979
- const min = this.linkSettings.highlightByLinkArrowFadingMin < arrowAlpha
1980
- ? this.linkSettings.highlightByLinkArrowFadingMin
1981
- : arrowAlpha;
1982
- arrowAlpha = animationByProgress(min, arrowAlpha - min, 1 - this.highlightProgress);
1983
- }
1279
+ const fadeOptions = linkFade({
1280
+ arrow: this.linkSettings.arrow,
1281
+ arrowByHighlight: this.linkSettings.arrowByHighlight,
1282
+ linkOptions,
1283
+ highlightProgress: this.highlightProgress,
1284
+ highlightForArrowFadingMin: this.highlightSettings.highlightByLinkForArrowFadingMin,
1285
+ highlightForLinkFadingMin: this.highlightSettings.highlightByLinkForLinkFadingMin,
1286
+ });
1287
+ alpha = fadeOptions.alpha;
1288
+ arrowAlpha = fadeOptions.arrowAlpha;
1984
1289
  }
1985
1290
  else {
1986
- // eslint-disable-next-line no-lonely-if
1987
- if (this.linkSettings.arrow && this.linkSettings.arrowByHighlight) {
1988
- /** Highlighted */
1989
- arrowAlpha = animationByProgress(0, linkOptions.arrowAlpha, this.highlightProgress);
1990
- }
1291
+ /** By Link Highlight */
1292
+ const highlightOptions = linkHighlight({
1293
+ arrow: this.linkSettings.arrow,
1294
+ arrowByHighlight: this.linkSettings.arrowByHighlight,
1295
+ linkOptions,
1296
+ highlightProgress: this.highlightProgress,
1297
+ highlightForArrowBorderColor: this.highlightSettings.highlightByLinkForArrowBorderColor,
1298
+ highlightForArrowBorderSizingAdditional: this.highlightSettings.highlightByLinkForArrowBorderSizingAdditional,
1299
+ highlightForArrowColor: this.highlightSettings.highlightByLinkForArrowColor,
1300
+ highlightForArrowSizeAdditional: this.highlightSettings.highlightByLinkForArrowSizeAdditional,
1301
+ highlightForLinkColor: this.highlightSettings.highlightByLinkForLinkColor,
1302
+ highlightForLinkSizeAdditional: this.highlightSettings.highlightByLinkForLinkSizeAdditional,
1303
+ });
1304
+ arrowAlpha = highlightOptions.arrowAlpha;
1305
+ color = highlightOptions.color;
1306
+ width = highlightOptions.width;
1307
+ arrowColor = highlightOptions.arrowColor;
1308
+ arrowSize = highlightOptions.arrowSize;
1309
+ arrowBorderWidth = highlightOptions.arrowBorderWidth;
1310
+ arrowBorderColor = highlightOptions.arrowBorderColor;
1991
1311
  }
1992
1312
  }
1993
1313
  /** Link */
1994
1314
  this.context.beginPath();
1995
1315
  this.context.globalAlpha = alpha;
1996
- this.context.strokeStyle = linkOptions.color;
1997
- this.context.lineWidth = linkOptions.width;
1316
+ this.context.strokeStyle = color;
1317
+ this.context.lineWidth = width;
1998
1318
  let xStart = link.source.x;
1999
1319
  let yStart = link.source.y;
2000
1320
  let xEnd = link.target.x;
2001
1321
  let yEnd = link.target.y;
2002
1322
  let linkDistance = 0;
2003
- if (this.linkSettings.pretty || this.linkSettings.particleFlexSpeed) {
1323
+ if (this.linkSettings.prettyDraw || this.linkSettings.particleFlexSpeed) {
2004
1324
  const isHasArrow = this.linkSettings.arrow && arrowAlpha > 0;
2005
- const position = calculateLinkPositionByNode(link, isHasArrow ? linkOptions.arrowSize : 0);
1325
+ const position = calculateLinkPositionByNode(link, isHasArrow ? arrowSize : 0);
2006
1326
  if (position) {
2007
1327
  xStart = position.x1;
2008
1328
  xEnd = position.x2;
@@ -2072,7 +1392,9 @@ function getDrawLink(state) {
2072
1392
  this.context.arc(particle.x, particle.y, linkOptions.particleRadius, 0, Math.PI * 2);
2073
1393
  this.context.fillStyle = linkOptions.particleColor;
2074
1394
  this.context.fill();
2075
- this.context.stroke();
1395
+ if (linkOptions.particleBorderWidth > 0) {
1396
+ this.context.stroke();
1397
+ }
2076
1398
  }
2077
1399
  });
2078
1400
  }
@@ -2087,19 +1409,21 @@ function getDrawLink(state) {
2087
1409
  };
2088
1410
  this.context.beginPath();
2089
1411
  this.context.globalAlpha = arrowAlpha;
2090
- this.context.strokeStyle = linkOptions.arrowBorderColor;
2091
- this.context.lineWidth = linkOptions.arrowBorderWidth;
2092
- this.context.fillStyle = linkOptions.arrowColor;
1412
+ this.context.strokeStyle = arrowBorderColor;
1413
+ this.context.lineWidth = arrowBorderWidth;
1414
+ this.context.fillStyle = arrowColor;
2093
1415
  const angle = Math.atan2(yEnd - yStart, xEnd - xStart);
2094
1416
  this.context.moveTo(xEnd, yEnd);
2095
- this.context.lineTo(xEnd - linkOptions.arrowSize * Math.cos(angle - Math.PI / 6), yEnd - linkOptions.arrowSize * Math.sin(angle - Math.PI / 6));
2096
- this.context.lineTo(xEnd - linkOptions.arrowSize * Math.cos(angle + Math.PI / 6), yEnd - linkOptions.arrowSize * Math.sin(angle + Math.PI / 6));
1417
+ this.context.lineTo(xEnd - arrowSize * Math.cos(angle - Math.PI / 6), yEnd - arrowSize * Math.sin(angle - Math.PI / 6));
1418
+ this.context.lineTo(xEnd - arrowSize * Math.cos(angle + Math.PI / 6), yEnd - arrowSize * Math.sin(angle + Math.PI / 6));
2097
1419
  this.context.closePath();
2098
1420
  this.context.fill();
2099
- this.context.stroke();
1421
+ if (arrowBorderWidth > 0) {
1422
+ this.context.stroke();
1423
+ }
2100
1424
  }
2101
1425
  if (linkOptions.drawExtraLink) {
2102
- linkOptions.drawExtraLink(link, { ...linkOptions, alpha }, state);
1426
+ linkOptions.drawExtraLink.call(this, link, { ...linkOptions, alpha });
2103
1427
  }
2104
1428
  };
2105
1429
  }
@@ -2172,17 +1496,17 @@ function getTextLines({ context, textAlign, textColor, textFont, textStyle, text
2172
1496
  return { lines, currentMaxSize };
2173
1497
  }
2174
1498
 
2175
- function getDrawNode(nodeRenders, textRenders, state) {
1499
+ function getDrawNode(nodeRenders, textRenders) {
2176
1500
  return function drawNode(node, index) {
2177
1501
  if (!this.context || !node.x || !node.y)
2178
1502
  return;
2179
1503
  let nodeOptions;
2180
- if (this.nodeSettings.cache && this.nodeOptionsCache[node.id]) {
1504
+ if (this.nodeSettings.cacheOptions && this.nodeOptionsCache[node.id]) {
2181
1505
  nodeOptions = this.nodeOptionsCache[node.id];
2182
1506
  }
2183
1507
  else {
2184
- nodeOptions = nodeIterationExtractor(node, index, this.nodes, state, this.nodeSettings.options ?? {}, nodeOptionsGetter);
2185
- if (this.nodeSettings.cache) {
1508
+ nodeOptions = nodeIterationExtractor(node, index, this.nodes, this, this.nodeSettings.options ?? {}, nodeOptionsGetter);
1509
+ if (this.nodeSettings.cacheOptions) {
2186
1510
  this.nodeOptionsCache[node.id] = nodeOptions;
2187
1511
  }
2188
1512
  }
@@ -2201,6 +1525,8 @@ function getDrawNode(nodeRenders, textRenders, state) {
2201
1525
  }
2202
1526
  let alpha = nodeOptions.alpha;
2203
1527
  let color = nodeOptions.color;
1528
+ let borderColor = nodeOptions.borderColor;
1529
+ let borderWidth = nodeOptions.borderWidth;
2204
1530
  let radiusInitial = nodeOptions.radius;
2205
1531
  let widthInitial = nodeOptions.width;
2206
1532
  let heightInitial = nodeOptions.height;
@@ -2209,101 +1535,107 @@ function getDrawNode(nodeRenders, textRenders, state) {
2209
1535
  let textShiftX = nodeOptions.textShiftX;
2210
1536
  let textShiftY = nodeOptions.textShiftY;
2211
1537
  let textWeight = nodeOptions.textWeight;
2212
- let textWidth = nodeOptions.textWidth;
2213
- let sizeCoefficient = 1;
2214
- /** Node Highlight */
1538
+ let labelSize = nodeOptions.labelSize;
1539
+ let labelWeight = nodeOptions.labelWeight;
1540
+ let labelAlpha = nodeOptions.labelAlpha;
1541
+ /** Highlight */
2215
1542
  if (this.highlightedNeighbors && this.highlightedNode) {
2216
- /** Not highlighted */
1543
+ /** By Node Not Highlight */
2217
1544
  if (!this.highlightedNeighbors.has(node.id) && this.highlightedNode.id != node.id) {
2218
- if (this.nodeSettings.highlightByNodeNodeFading) {
2219
- const min = this.nodeSettings.highlightByNodeNodeFadingMin < alpha
2220
- ? this.nodeSettings.highlightByNodeNodeFadingMin
2221
- : alpha;
2222
- alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);
2223
- }
2224
- if (this.nodeSettings.highlightByNodeTextFading) {
2225
- const min = this.nodeSettings.highlightByNodeTextFadingMin < textAlpha
2226
- ? this.nodeSettings.highlightByNodeTextFadingMin
2227
- : textAlpha;
2228
- textAlpha = animationByProgress(min, textAlpha - min, 1 - this.highlightProgress);
2229
- }
2230
- if (this.nodeSettings.highlightByNodeNodeColor) {
2231
- const colorRgb = extractRgb(colorToRgb(color));
2232
- if (colorRgb) {
2233
- const colorRgbFade = fadeRgb(colorRgb, this.nodeSettings.highlightByNodeNodeColorFadingMin);
2234
- const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbFade, this.highlightProgress);
2235
- color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
2236
- }
2237
- }
1545
+ const fadingOptions = nodeFade({
1546
+ highlightProgress: this.highlightProgress,
1547
+ nodeOptions,
1548
+ highlightForLabelFadingMin: this.highlightSettings.highlightByNodeForLabelFadingMin,
1549
+ highlightForNodeColorFading: this.highlightSettings.highlightByNodeForNodeColorFading,
1550
+ highlightForNodeColorFadingMin: this.highlightSettings.highlightByNodeForNodeColorFadingMin,
1551
+ highlightForNodeFadingMin: this.highlightSettings.highlightByNodeForNodeFadingMin,
1552
+ highlightForTextFadingMin: this.highlightSettings.highlightByNodeForTextFadingMin,
1553
+ });
1554
+ alpha = fadingOptions.alpha;
1555
+ color = fadingOptions.color;
1556
+ textAlpha = fadingOptions.textAlpha;
1557
+ labelAlpha = fadingOptions.labelAlpha;
2238
1558
  }
2239
- else if (!this.nodeSettings.highlightByNodeOnlyRoot ||
2240
- (this.nodeSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)) {
2241
- /** Highlighted */
2242
- if (this.nodeSettings.highlightByNodeNodeSizing && nodeOptions.shape === "circle") {
2243
- radiusInitial = animationByProgress(radiusInitial, this.nodeSettings.highlightByNodeNodeSizingAdditional, this.highlightProgress);
2244
- }
2245
- if (this.nodeSettings.highlightByNodeNodeSizing &&
2246
- (nodeOptions.shape === "square" || nodeOptions.shape === "text")) {
2247
- sizeCoefficient = animationByProgress(sizeCoefficient, this.nodeSettings.highlightByNodeNodeSizingAdditionalCoefficient, this.highlightProgress);
2248
- widthInitial *= sizeCoefficient;
2249
- heightInitial *= sizeCoefficient;
2250
- }
2251
- if (this.nodeSettings.highlightByNodeTextSizing) {
2252
- textSize = animationByProgress(textSize, this.nodeSettings.highlightByNodeTextSizingAdditional, this.highlightProgress);
2253
- textShiftX = animationByProgress(textShiftX, this.nodeSettings.highlightByNodeTextShiftXAdditional, this.highlightProgress);
2254
- textShiftY = animationByProgress(textShiftY, this.nodeSettings.highlightByNodeTextShiftYAdditional, this.highlightProgress);
2255
- textWeight = animationByProgress(textWeight, this.nodeSettings.highlightByNodeTextWeightAdditional, this.highlightProgress);
2256
- textWidth = animationByProgress(textWidth, this.nodeSettings.highlightByNodeTextWidthAdditional, this.highlightProgress);
2257
- }
1559
+ else if (!this.highlightSettings.highlightByNodeOnlyRoot ||
1560
+ (this.highlightSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)) {
1561
+ /** By Node Highlight */
1562
+ const highlightOptions = nodeHighlight({
1563
+ highlightProgress: this.highlightProgress,
1564
+ nodeOptions,
1565
+ highlightForLabelSizingAdditional: this.highlightSettings.highlightByNodeForLabelSizingAdditional,
1566
+ highlightForLabelWeightAdditional: this.highlightSettings.highlightByNodeForLabelWeightAdditional,
1567
+ highlightForNodeBorderColor: this.highlightSettings.highlightByNodeForNodeBorderColor,
1568
+ highlightForNodeBorderSizingAdditional: this.highlightSettings.highlightByNodeForNodeBorderSizingAdditional,
1569
+ highlightForNodeColor: this.highlightSettings.highlightByNodeForNodeColor,
1570
+ highlightForNodeSizingAdditional: this.highlightSettings.highlightByNodeForNodeSizingAdditional,
1571
+ highlightForNodeSizingAdditionalCoefficient: this.highlightSettings.highlightByNodeForNodeSizingAdditionalCoefficient,
1572
+ highlightForTextShiftXAdditional: this.highlightSettings.highlightByNodeForTextShiftXAdditional,
1573
+ highlightForTextShiftYAdditional: this.highlightSettings.highlightByNodeForTextShiftYAdditional,
1574
+ highlightForTextSizingAdditional: this.highlightSettings.highlightByNodeForTextSizingAdditional,
1575
+ highlightForTextWeightAdditional: this.highlightSettings.highlightByNodeForTextWeightAdditional,
1576
+ });
1577
+ color = highlightOptions.color;
1578
+ borderColor = highlightOptions.borderColor;
1579
+ borderWidth = highlightOptions.borderWidth;
1580
+ radiusInitial = highlightOptions.radiusInitial;
1581
+ widthInitial = highlightOptions.widthInitial;
1582
+ heightInitial = highlightOptions.heightInitial;
1583
+ textSize = highlightOptions.textSize;
1584
+ textShiftX = highlightOptions.textShiftX;
1585
+ textShiftY = highlightOptions.textShiftY;
1586
+ textWeight = highlightOptions.textWeight;
1587
+ labelSize = highlightOptions.labelSize;
1588
+ labelWeight = highlightOptions.labelWeight;
2258
1589
  }
2259
1590
  }
2260
- /** LinkHighlight */
2261
1591
  if (this.highlightedNeighbors && this.highlightedLink) {
2262
- /** Not highlighted */
1592
+ /** By Link Not Highlight */
2263
1593
  if (!this.highlightedNeighbors.has(node.id) &&
2264
1594
  this.highlightedLink.source !== node &&
2265
1595
  this.highlightedLink.target !== node) {
2266
- if (this.nodeSettings.highlightByLinkNodeFading) {
2267
- const min = this.nodeSettings.highlightByLinkNodeFadingMin < alpha
2268
- ? this.nodeSettings.highlightByLinkNodeFadingMin
2269
- : alpha;
2270
- alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);
2271
- }
2272
- if (this.nodeSettings.highlightByLinkTextFading) {
2273
- const min = this.nodeSettings.highlightByLinkTextFadingMin < textAlpha
2274
- ? this.nodeSettings.highlightByLinkTextFadingMin
2275
- : textAlpha;
2276
- textAlpha = animationByProgress(min, textAlpha - min, 1 - this.highlightProgress);
2277
- }
2278
- if (this.nodeSettings.highlightByLinkNodeColor) {
2279
- const colorRgb = extractRgb(colorToRgb(color));
2280
- if (colorRgb) {
2281
- const colorRgbFade = fadeRgb(colorRgb, this.nodeSettings.highlightByLinkNodeColorFadingMin);
2282
- const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbFade, this.highlightProgress);
2283
- color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
2284
- }
2285
- }
1596
+ const fadingOptions = nodeFade({
1597
+ highlightProgress: this.highlightProgress,
1598
+ nodeOptions,
1599
+ highlightForLabelFadingMin: this.highlightSettings.highlightByLinkForLabelFadingMin,
1600
+ highlightForNodeColorFading: this.highlightSettings.highlightByLinkForNodeColorFading,
1601
+ highlightForNodeColorFadingMin: this.highlightSettings.highlightByLinkForNodeColorFadingMin,
1602
+ highlightForNodeFadingMin: this.highlightSettings.highlightByLinkForNodeFadingMin,
1603
+ highlightForTextFadingMin: this.highlightSettings.highlightByLinkForTextFadingMin,
1604
+ });
1605
+ alpha = fadingOptions.alpha;
1606
+ color = fadingOptions.color;
1607
+ textAlpha = fadingOptions.textAlpha;
1608
+ labelAlpha = fadingOptions.labelAlpha;
2286
1609
  }
2287
1610
  else {
2288
- /** Highlighted */
2289
- if (this.nodeSettings.highlightByLinkNodeSizing && nodeOptions.shape === "circle") {
2290
- radiusInitial = animationByProgress(radiusInitial, this.nodeSettings.highlightByLinkNodeSizingAdditional, this.highlightProgress);
2291
- }
2292
- if (this.nodeSettings.highlightByLinkNodeSizing &&
2293
- (nodeOptions.shape === "square" ||
2294
- nodeOptions.shape === "text" ||
2295
- nodeOptions.shape === "icon")) {
2296
- sizeCoefficient = animationByProgress(sizeCoefficient, this.nodeSettings.highlightByNodeNodeSizingAdditionalCoefficient, this.highlightProgress);
2297
- widthInitial *= sizeCoefficient;
2298
- heightInitial *= sizeCoefficient;
2299
- }
2300
- if (this.nodeSettings.highlightByLinkTextSizing) {
2301
- textSize = animationByProgress(textSize, this.nodeSettings.highlightByLinkTextSizingAdditional, this.highlightProgress);
2302
- textShiftX = animationByProgress(textShiftX, this.nodeSettings.highlightByLinkTextShiftXAdditional, this.highlightProgress);
2303
- textShiftY = animationByProgress(textShiftY, this.nodeSettings.highlightByLinkTextShiftYAdditional, this.highlightProgress);
2304
- textWeight = animationByProgress(textWeight, this.nodeSettings.highlightByLinkTextWeightAdditional, this.highlightProgress);
2305
- textWidth = animationByProgress(textWidth, this.nodeSettings.highlightByLinkTextWidthAdditional, this.highlightProgress);
2306
- }
1611
+ /** By Link Highlight */
1612
+ const highlightOptions = nodeHighlight({
1613
+ highlightProgress: this.highlightProgress,
1614
+ nodeOptions,
1615
+ highlightForLabelSizingAdditional: this.highlightSettings.highlightByLinkForLabelSizingAdditional,
1616
+ highlightForLabelWeightAdditional: this.highlightSettings.highlightByLinkForLabelWeightAdditional,
1617
+ highlightForNodeBorderColor: this.highlightSettings.highlightByLinkForNodeBorderColor,
1618
+ highlightForNodeBorderSizingAdditional: this.highlightSettings.highlightByLinkForNodeBorderSizingAdditional,
1619
+ highlightForNodeColor: this.highlightSettings.highlightByLinkForNodeColor,
1620
+ highlightForNodeSizingAdditional: this.highlightSettings.highlightByLinkForNodeSizingAdditional,
1621
+ highlightForNodeSizingAdditionalCoefficient: this.highlightSettings.highlightByLinkForNodeSizingAdditionalCoefficient,
1622
+ highlightForTextShiftXAdditional: this.highlightSettings.highlightByLinkForTextShiftXAdditional,
1623
+ highlightForTextShiftYAdditional: this.highlightSettings.highlightByLinkForTextShiftYAdditional,
1624
+ highlightForTextSizingAdditional: this.highlightSettings.highlightByLinkForTextSizingAdditional,
1625
+ highlightForTextWeightAdditional: this.highlightSettings.highlightByLinkForTextWeightAdditional,
1626
+ });
1627
+ color = highlightOptions.color;
1628
+ borderColor = highlightOptions.borderColor;
1629
+ borderWidth = highlightOptions.borderWidth;
1630
+ radiusInitial = highlightOptions.radiusInitial;
1631
+ widthInitial = highlightOptions.widthInitial;
1632
+ heightInitial = highlightOptions.heightInitial;
1633
+ textSize = highlightOptions.textSize;
1634
+ textShiftX = highlightOptions.textShiftX;
1635
+ textShiftY = highlightOptions.textShiftY;
1636
+ textWeight = highlightOptions.textWeight;
1637
+ labelSize = highlightOptions.labelSize;
1638
+ labelWeight = highlightOptions.labelWeight;
2307
1639
  }
2308
1640
  }
2309
1641
  /** Flex radius */
@@ -2341,14 +1673,13 @@ function getDrawNode(nodeRenders, textRenders, state) {
2341
1673
  sizeFactor: this.nodeSettings.nodeSizeFactor,
2342
1674
  sizeFlexible: this.nodeSettings.nodeSizeFlexible,
2343
1675
  });
2344
- textSize *= size.additionalSizeCoefficient;
1676
+ labelSize *= size.additionalSizeCoefficient;
2345
1677
  }
2346
1678
  /** Size by text in textNode */
2347
- if (nodeOptions.shape === "text" && nodeOptions.text) {
2348
- textWidth = width;
1679
+ if (nodeOptions.shape === "text" && nodeOptions.label) {
2349
1680
  let lines;
2350
1681
  let textNodeParameters;
2351
- const cachedLines = this.cachedNodeText[node.id];
1682
+ const cachedLines = this.cachedNodeLabel[node.id];
2352
1683
  const cachedTextNodeParameters = this.cachedTextNodeParameters[node.id];
2353
1684
  if (cachedLines != undefined && cachedTextNodeParameters != undefined) {
2354
1685
  lines = cachedLines;
@@ -2357,30 +1688,31 @@ function getDrawNode(nodeRenders, textRenders, state) {
2357
1688
  else {
2358
1689
  const textInfo = getTextLines({
2359
1690
  context: this.context,
2360
- text: nodeOptions.text,
2361
- textAlign: nodeOptions.textAlign,
2362
- textColor: nodeOptions.textColor,
2363
- textFont: nodeOptions.textFont,
2364
- textSize,
2365
- maxWidth: textWidth,
2366
- textStyle: nodeOptions.textStyle,
1691
+ text: nodeOptions.label,
1692
+ textAlign: nodeOptions.labelAlign,
1693
+ textColor: nodeOptions.labelColor,
1694
+ textFont: nodeOptions.labelFont,
1695
+ textSize: labelSize,
1696
+ maxWidth: nodeOptions.labelWidth,
1697
+ textStyle: nodeOptions.labelStyle,
2367
1698
  textWeight,
2368
1699
  });
2369
- textNodeParameters = [textInfo.currentMaxSize, textSize];
1700
+ textNodeParameters = [textInfo.currentMaxSize, labelSize];
2370
1701
  lines = textInfo.lines;
2371
- this.cachedNodeText[node.id] = lines;
1702
+ this.cachedNodeLabel[node.id] = lines;
2372
1703
  this.cachedTextNodeParameters[node.id] = textNodeParameters;
2373
1704
  }
2374
- const textSizeCoefficient = textSize / textNodeParameters[1];
1705
+ const textSizeCoefficient = labelSize / textNodeParameters[1];
2375
1706
  const maxSize = textNodeParameters[0] * textSizeCoefficient;
2376
1707
  height =
2377
- lines.length * textSize +
2378
- (lines.length - 1) * nodeOptions.textGap +
2379
- nodeOptions.textNodeYPadding;
2380
- width = maxSize + nodeOptions.textNodeXPadding;
1708
+ lines.length * labelSize +
1709
+ (lines.length - 1) * nodeOptions.labelGap +
1710
+ nodeOptions.labelYPadding;
1711
+ width = maxSize + nodeOptions.labelXPadding;
2381
1712
  }
2382
1713
  /** Node parameters */
2383
1714
  node._radius = radius;
1715
+ node._borderWidth = borderWidth;
2384
1716
  node._width = width;
2385
1717
  node._height = height;
2386
1718
  node._borderRadius =
@@ -2405,49 +1737,127 @@ function getDrawNode(nodeRenders, textRenders, state) {
2405
1737
  return;
2406
1738
  this.context.beginPath();
2407
1739
  this.context.globalAlpha = alpha;
2408
- this.context.lineWidth = nodeOptions.borderWidth;
2409
- this.context.strokeStyle = nodeOptions.borderColor;
1740
+ this.context.lineWidth = borderWidth;
1741
+ this.context.strokeStyle = borderColor;
2410
1742
  this.context.fillStyle = color;
2411
1743
  switch (nodeOptions.shape) {
2412
1744
  case "circle": {
2413
- this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
1745
+ if (!node.image) {
1746
+ this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
1747
+ this.context.fill();
1748
+ if (borderWidth > 0) {
1749
+ this.context.stroke();
1750
+ }
1751
+ }
1752
+ else {
1753
+ this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
1754
+ this.context.closePath();
1755
+ this.context.save();
1756
+ this.context.clip();
1757
+ this.context.drawImage(node.image, node.x - radius, node.y - radius, radius * 2, radius * 2);
1758
+ this.context.restore();
1759
+ if (borderWidth > 0) {
1760
+ this.context.stroke();
1761
+ }
1762
+ }
1763
+ if (node.label) {
1764
+ this.context.globalAlpha = labelAlpha;
1765
+ drawText({
1766
+ context: this.context,
1767
+ cachedNodeText: this.cachedNodeLabel,
1768
+ id: node.id,
1769
+ text: node.label,
1770
+ textAlign: nodeOptions.labelAlign,
1771
+ textColor: nodeOptions.labelColor,
1772
+ textFont: nodeOptions.labelFont,
1773
+ textGap: nodeOptions.labelGap,
1774
+ textSize: labelSize,
1775
+ textStyle: nodeOptions.labelStyle,
1776
+ textWeight: labelWeight,
1777
+ maxWidth: nodeOptions.labelWidth,
1778
+ x: node.x,
1779
+ y: node.y + labelSize / 3,
1780
+ });
1781
+ }
2414
1782
  break;
2415
1783
  }
2416
1784
  case "square": {
2417
- this.context.roundRect(node.x - width / 2, node.y - height / 2, width, height, node._borderRadius);
1785
+ if (!node.image) {
1786
+ this.context.roundRect(node.x - width / 2, node.y - height / 2, width, height, node._borderRadius);
1787
+ this.context.fill();
1788
+ if (borderWidth > 0) {
1789
+ this.context.stroke();
1790
+ }
1791
+ }
1792
+ else {
1793
+ this.context.roundRect(node.x - width / 2, node.y - height / 2, width, height, node._borderRadius);
1794
+ this.context.closePath();
1795
+ this.context.save();
1796
+ this.context.clip();
1797
+ this.context.drawImage(node.image, node.x - width / 2, node.y - height / 2, width, height);
1798
+ this.context.restore();
1799
+ if (borderWidth > 0) {
1800
+ this.context.stroke();
1801
+ }
1802
+ }
1803
+ if (node.label) {
1804
+ this.context.globalAlpha = labelAlpha;
1805
+ drawText({
1806
+ context: this.context,
1807
+ cachedNodeText: this.cachedNodeLabel,
1808
+ id: node.id,
1809
+ text: node.label,
1810
+ textAlign: nodeOptions.labelAlign,
1811
+ textColor: nodeOptions.labelColor,
1812
+ textFont: nodeOptions.labelFont,
1813
+ textGap: nodeOptions.labelGap,
1814
+ textSize: labelSize,
1815
+ textStyle: nodeOptions.labelStyle,
1816
+ textWeight: labelWeight,
1817
+ maxWidth: nodeOptions.labelWidth,
1818
+ x: node.x,
1819
+ y: node.y + labelSize / 3,
1820
+ });
1821
+ }
2418
1822
  break;
2419
1823
  }
2420
1824
  case "text": {
2421
1825
  if (this.nodeSettings.textNodeDebug) {
2422
1826
  this.context.strokeRect(node.x - width / 2, node.y - height / 2, width, height);
2423
1827
  }
2424
- const lines = this.cachedNodeText[node.id];
2425
- if (nodeOptions.text && lines)
1828
+ const lines = this.cachedNodeLabel[node.id];
1829
+ if (nodeOptions.label && lines)
2426
1830
  drawText({
2427
1831
  id: node.id,
2428
- cachedNodeText: this.cachedNodeText,
1832
+ cachedNodeText: this.cachedNodeLabel,
2429
1833
  context: this.context,
2430
- text: nodeOptions.text,
2431
- textAlign: nodeOptions.textAlign,
2432
- textColor: nodeOptions.textColor,
2433
- textFont: nodeOptions.textFont,
2434
- textSize,
1834
+ text: nodeOptions.label,
1835
+ textAlign: nodeOptions.labelAlign,
1836
+ textColor: nodeOptions.labelColor,
1837
+ textFont: nodeOptions.labelFont,
1838
+ textSize: labelSize,
2435
1839
  x: node.x,
2436
1840
  y: node.y + textSize / 4 - (lines.length - 1) * (textSize / 2),
2437
- maxWidth: textWidth,
2438
- textStyle: nodeOptions.textStyle,
1841
+ maxWidth: nodeOptions.labelWidth,
1842
+ textStyle: nodeOptions.labelStyle,
2439
1843
  textWeight,
2440
- textGap: nodeOptions.textGap,
1844
+ textGap: nodeOptions.labelGap,
2441
1845
  });
1846
+ this.context.fill();
1847
+ if (borderWidth > 0) {
1848
+ this.context.stroke();
1849
+ }
2442
1850
  break;
2443
1851
  }
2444
1852
  default: {
2445
1853
  this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
1854
+ this.context.fill();
1855
+ if (borderWidth > 0) {
1856
+ this.context.stroke();
1857
+ }
2446
1858
  break;
2447
1859
  }
2448
1860
  }
2449
- this.context.fill();
2450
- this.context.stroke();
2451
1861
  });
2452
1862
  if (nodeOptions.nodeExtraDraw) {
2453
1863
  nodeRenders.push(() => {
@@ -2461,12 +1871,11 @@ function getDrawNode(nodeRenders, textRenders, state) {
2461
1871
  textShiftX,
2462
1872
  textShiftY,
2463
1873
  textWeight,
2464
- textWidth,
2465
1874
  });
2466
1875
  });
2467
1876
  }
2468
1877
  /** Text draw */
2469
- if (nodeOptions.textVisible && nodeOptions.text && nodeOptions.shape !== "text") {
1878
+ if (nodeOptions.textVisible && nodeOptions.text) {
2470
1879
  textRenders.push(() => {
2471
1880
  if (nodeOptions.textDraw) {
2472
1881
  nodeOptions.textDraw.bind(this)(node, {
@@ -2479,7 +1888,6 @@ function getDrawNode(nodeRenders, textRenders, state) {
2479
1888
  textShiftX,
2480
1889
  textShiftY,
2481
1890
  textWeight,
2482
- textWidth,
2483
1891
  });
2484
1892
  return;
2485
1893
  }
@@ -2491,7 +1899,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
2491
1899
  if (nodeOptions.shape === "circle") {
2492
1900
  y += radius;
2493
1901
  }
2494
- if (nodeOptions.shape === "square") {
1902
+ if (nodeOptions.shape === "square" || nodeOptions.shape === "text") {
2495
1903
  y += height / 2;
2496
1904
  }
2497
1905
  drawText({
@@ -2505,7 +1913,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
2505
1913
  textSize,
2506
1914
  x: node.x + textShiftX,
2507
1915
  y,
2508
- maxWidth: textWidth,
1916
+ maxWidth: nodeOptions.textWidth,
2509
1917
  textStyle: nodeOptions.textStyle,
2510
1918
  textWeight,
2511
1919
  textGap: nodeOptions.textGap,
@@ -2521,7 +1929,6 @@ function getDrawNode(nodeRenders, textRenders, state) {
2521
1929
  textShiftX,
2522
1930
  textShiftY,
2523
1931
  textWeight,
2524
- textWidth,
2525
1932
  });
2526
1933
  }
2527
1934
  });
@@ -2569,18 +1976,8 @@ function initDraw() {
2569
1976
  function draw() {
2570
1977
  if (!this.context)
2571
1978
  return;
2572
- const state = this.state;
2573
1979
  if (this.listeners.onDraw) {
2574
- this.listeners.onDraw(state, (status) => {
2575
- this.highlightDrawing = status;
2576
- }, () => {
2577
- if (this.highlightedNeighbors)
2578
- this.highlightedNeighbors = null;
2579
- if (this.highlightedNode)
2580
- this.highlightedNode = null;
2581
- if (this.highlightedLink)
2582
- this.highlightedLink = null;
2583
- });
1980
+ this.listeners.onDraw.call(this);
2584
1981
  return;
2585
1982
  }
2586
1983
  this.context.save();
@@ -2589,14 +1986,14 @@ function initDraw() {
2589
1986
  this.context.scale(this.areaTransform.k, this.areaTransform.k);
2590
1987
  const textRenders = [];
2591
1988
  const nodeRenders = [];
2592
- this.nodes.forEach(getDrawNode(nodeRenders, textRenders, state).bind(this));
1989
+ this.nodes.forEach(getDrawNode(nodeRenders, textRenders).bind(this));
2593
1990
  /** links */
2594
- this.links.forEach(getDrawLink(state).bind(this));
1991
+ this.links.forEach(getDrawLink().bind(this));
2595
1992
  /** nodes */
2596
1993
  nodeRenders.forEach((render) => render());
2597
1994
  textRenders.forEach((render) => render());
2598
1995
  this.context.restore();
2599
- this.listeners.onDrawFinished?.(state);
1996
+ this.listeners.onDrawFinished?.call?.(this);
2600
1997
  calculateHighlight.bind(this)();
2601
1998
  }
2602
1999
  if (this.graphSettings.showDrawTime) {
@@ -2613,8 +2010,8 @@ function initPointer() {
2613
2010
  return;
2614
2011
  let currentNode;
2615
2012
  let currentLink;
2616
- const checkHighlightNode = this.nodeSettings.highlightByHoverNode && !this.isDragging;
2617
- const checkHighlightLink = this.linkSettings.highlightByHoverLink && !this.isDragging;
2013
+ const checkHighlightNode = this.highlightSettings.highlightByHoverNode && !this.isDragging;
2014
+ const checkHighlightLink = this.highlightSettings.highlightByHoverLink && !this.isDragging;
2618
2015
  let highlightNode = true;
2619
2016
  let highlightLink = true;
2620
2017
  if (checkHighlightNode) {
@@ -2632,7 +2029,7 @@ function initPointer() {
2632
2029
  }
2633
2030
  else if (checkHighlightLink) {
2634
2031
  currentLink = linkByPointerGetter({
2635
- linkSettings: this.linkSettings,
2032
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2636
2033
  areaRect: this.areaRect,
2637
2034
  areaTransform: this.areaTransform,
2638
2035
  mouseEvent: event,
@@ -2693,7 +2090,7 @@ function initPointer() {
2693
2090
  });
2694
2091
  if (!currentNode && (!checkHighlightNode || (!checkHighlightLink && !currentLink))) {
2695
2092
  currentLink = linkByPointerGetter({
2696
- linkSettings: this.linkSettings,
2093
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2697
2094
  areaRect: this.areaRect,
2698
2095
  areaTransform: this.areaTransform,
2699
2096
  mouseEvent: event,
@@ -2701,7 +2098,7 @@ function initPointer() {
2701
2098
  });
2702
2099
  }
2703
2100
  if (!currentNode)
2704
- return void this.listeners.onMove(event, currentNode, currentLink);
2101
+ return void this.listeners.onMove.call(this, event, currentNode, currentLink);
2705
2102
  }
2706
2103
  function onWheelClick(event) {
2707
2104
  if (this.isDragging ||
@@ -2717,15 +2114,15 @@ function initPointer() {
2717
2114
  });
2718
2115
  if (!currentNode) {
2719
2116
  const currentLink = linkByPointerGetter({
2720
- linkSettings: this.linkSettings,
2117
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2721
2118
  areaRect: this.areaRect,
2722
2119
  areaTransform: this.areaTransform,
2723
2120
  mouseEvent: event,
2724
2121
  links: this.links,
2725
2122
  });
2726
- return void this.listeners.onWheelClick(event, undefined, currentLink);
2123
+ return void this.listeners.onWheelClick.call(this, event, undefined, currentLink);
2727
2124
  }
2728
- return void this.listeners.onWheelClick(event, currentNode, undefined);
2125
+ return void this.listeners.onWheelClick.call(this, event, currentNode, undefined);
2729
2126
  }
2730
2127
  function onRightClick(event) {
2731
2128
  if (!this.listeners.onContextMenu)
@@ -2738,15 +2135,15 @@ function initPointer() {
2738
2135
  });
2739
2136
  if (!currentNode) {
2740
2137
  const currentLink = linkByPointerGetter({
2741
- linkSettings: this.linkSettings,
2138
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2742
2139
  areaRect: this.areaRect,
2743
2140
  areaTransform: this.areaTransform,
2744
2141
  mouseEvent: event,
2745
2142
  links: this.links,
2746
2143
  });
2747
- return void this.listeners.onContextMenu(event, undefined, currentLink);
2144
+ return void this.listeners.onContextMenu.call(this, event, undefined, currentLink);
2748
2145
  }
2749
- return void this.listeners.onContextMenu(event, currentNode, undefined);
2146
+ return void this.listeners.onContextMenu.call(this, event, currentNode, undefined);
2750
2147
  }
2751
2148
  function onDoubleClick(event) {
2752
2149
  if (!this.listeners.onDoubleClick)
@@ -2759,15 +2156,15 @@ function initPointer() {
2759
2156
  });
2760
2157
  if (!currentNode) {
2761
2158
  const currentLink = linkByPointerGetter({
2762
- linkSettings: this.linkSettings,
2159
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2763
2160
  areaRect: this.areaRect,
2764
2161
  areaTransform: this.areaTransform,
2765
2162
  mouseEvent: event,
2766
2163
  links: this.links,
2767
2164
  });
2768
- return void this.listeners.onDoubleClick(event, undefined, currentLink);
2165
+ return void this.listeners.onDoubleClick.call(this, event, undefined, currentLink);
2769
2166
  }
2770
- return void this.listeners.onDoubleClick(event, currentNode, undefined);
2167
+ return void this.listeners.onDoubleClick.call(this, event, currentNode, undefined);
2771
2168
  }
2772
2169
  function onClick(event) {
2773
2170
  if (this.isDragging || !this.listeners.onClick || ("button" in event && event.button !== 0))
@@ -2780,15 +2177,15 @@ function initPointer() {
2780
2177
  });
2781
2178
  if (!currentNode) {
2782
2179
  const currentLink = linkByPointerGetter({
2783
- linkSettings: this.linkSettings,
2180
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2784
2181
  areaRect: this.areaRect,
2785
2182
  areaTransform: this.areaTransform,
2786
2183
  mouseEvent: event,
2787
2184
  links: this.links,
2788
2185
  });
2789
- return void this.listeners.onClick(event, undefined, currentLink);
2186
+ return void this.listeners.onClick.call(this, event, undefined, currentLink);
2790
2187
  }
2791
- return void this.listeners.onClick(event, currentNode, undefined);
2188
+ return void this.listeners.onClick.call(this, event, currentNode, undefined);
2792
2189
  }
2793
2190
  /** hover */
2794
2191
  this.area.addEventListener("mousemove", onHover.bind(this), {
@@ -2845,12 +2242,12 @@ function initSimulation() {
2845
2242
  if (!this.simulation) {
2846
2243
  this.simulation = d3Force.forceSimulation()
2847
2244
  .nodes(this.nodes)
2848
- .force("link", d3Force.forceLink(this.links).id(this.nodeSettings.idGetter))
2245
+ .force("link", d3Force.forceLink(this.links).id(this.nodeSettings.idGetter.bind(this)))
2849
2246
  .on("tick", () => {
2850
2247
  this.draw();
2851
2248
  })
2852
2249
  .on("end", () => {
2853
- this.listeners.onSimulationEnd?.(this.state);
2250
+ this.listeners.onSimulationEnd?.call?.(this);
2854
2251
  if (this.graphSettings.showDrawTime) {
2855
2252
  getDrawTime();
2856
2253
  // eslint-disable-next-line no-console
@@ -2899,7 +2296,7 @@ function initSimulationForces() {
2899
2296
  if (this.forceSettings.forces && this.forceSettings.chargeForce) {
2900
2297
  this.simulation.force("charge", d3Force.forceManyBody()
2901
2298
  .strength(this.forceSettings.chargeStrength)
2902
- .distanceMax(this.forceSettings.chargeDistanceMax)
2299
+ .distanceMax(Infinity)
2903
2300
  .distanceMin(this.forceSettings.chargeDistanceMin));
2904
2301
  }
2905
2302
  if (this.forceSettings.forces && this.forceSettings.centerForce) {
@@ -2924,11 +2321,11 @@ function initCollideForce(forceUpdate) {
2924
2321
  else if (!this.simulation.force("collide") || forceUpdate) {
2925
2322
  this.simulation.force("collide", d3Force.forceCollide()
2926
2323
  .radius((node, index) => {
2927
- const nodeOptions = nodeIterationExtractor(node, index, this.nodes, this.state, this.nodeSettings.options ?? {}, nodeOptionsGetter);
2324
+ const nodeOptions = nodeIterationExtractor(node, index, this.nodes, this, this.nodeSettings.options ?? {}, nodeOptionsGetter);
2928
2325
  switch (nodeOptions.shape) {
2929
2326
  case "circle": {
2930
2327
  if (this.forceSettings.collideRadius) {
2931
- return nodeIterationExtractor(node, index, this.nodes, this.state, this.forceSettings.collideRadius, undefined);
2328
+ return nodeIterationExtractor(node, index, this.nodes, this, this.forceSettings.collideRadius, undefined);
2932
2329
  }
2933
2330
  const radius = nodeRadiusGetter({
2934
2331
  radiusFlexible: this.nodeSettings.nodeRadiusFlexible,
@@ -2961,30 +2358,29 @@ function initCollideForce(forceUpdate) {
2961
2358
  sizeFlexible: this.nodeSettings.nodeSizeFlexible,
2962
2359
  });
2963
2360
  if (this.context && nodeOptions.text) {
2964
- const lines = this.cachedNodeText[node.id] ??
2965
- getTextLines({
2966
- context: this.context,
2967
- text: nodeOptions.text,
2968
- textAlign: nodeOptions.textAlign,
2969
- textColor: nodeOptions.textColor,
2970
- textFont: nodeOptions.textFont,
2971
- textSize: nodeOptions.textSize,
2972
- maxWidth: width,
2973
- textStyle: nodeOptions.textStyle,
2974
- textWeight: nodeOptions.textWeight,
2975
- }).lines;
2361
+ const textInfo = getTextLines({
2362
+ context: this.context,
2363
+ text: nodeOptions.text,
2364
+ textAlign: nodeOptions.textAlign,
2365
+ textColor: nodeOptions.textColor,
2366
+ textFont: nodeOptions.textFont,
2367
+ textSize: nodeOptions.textSize,
2368
+ maxWidth: width,
2369
+ textStyle: nodeOptions.textStyle,
2370
+ textWeight: nodeOptions.textWeight,
2371
+ });
2976
2372
  height =
2977
- lines.length * nodeOptions.textSize +
2978
- (lines.length - 1) * nodeOptions.textGap +
2979
- nodeOptions.textNodeYPadding;
2980
- width += nodeOptions.textNodeXPadding;
2373
+ textInfo.lines.length * nodeOptions.textSize +
2374
+ (textInfo.lines.length - 1) * nodeOptions.textGap +
2375
+ nodeOptions.labelYPadding;
2376
+ width = textInfo.currentMaxSize + nodeOptions.labelXPadding;
2981
2377
  }
2982
2378
  return (Math.sqrt(width ** 2 + height ** 2) / 2 +
2983
2379
  this.forceSettings.collideAdditionalRadius);
2984
2380
  }
2985
2381
  default: {
2986
2382
  if (this.forceSettings.collideRadius) {
2987
- return nodeIterationExtractor(node, index, this.nodes, this.state, this.forceSettings.collideRadius, undefined);
2383
+ return nodeIterationExtractor(node, index, this.nodes, this, this.forceSettings.collideRadius, undefined);
2988
2384
  }
2989
2385
  const radius = nodeRadiusGetter({
2990
2386
  radiusFlexible: this.nodeSettings.nodeRadiusFlexible,
@@ -3009,7 +2405,7 @@ function initZoom(currentZoom) {
3009
2405
  const zoomInstance = d3Zoom.zoom()
3010
2406
  .scaleExtent(this.graphSettings.zoomExtent)
3011
2407
  .on("zoom", (event) => {
3012
- this.listeners.onZoom?.(event);
2408
+ this.listeners.onZoom?.call?.(this, event);
3013
2409
  this.areaTransform = event.transform;
3014
2410
  this.linkOptionsCache = {};
3015
2411
  this.nodeOptionsCache = {};
@@ -3046,6 +2442,7 @@ class GraphCanvas {
3046
2442
  /** settings */
3047
2443
  graphSettings;
3048
2444
  forceSettings;
2445
+ highlightSettings;
3049
2446
  nodeSettings;
3050
2447
  linkSettings;
3051
2448
  listeners;
@@ -3057,6 +2454,7 @@ class GraphCanvas {
3057
2454
  draw;
3058
2455
  eventAbortController;
3059
2456
  cachedNodeText = {};
2457
+ cachedNodeLabel = {};
3060
2458
  cachedTextNodeParameters = {};
3061
2459
  linkOptionsCache = {};
3062
2460
  nodeOptionsCache = {};
@@ -3074,32 +2472,7 @@ class GraphCanvas {
3074
2472
  const force = (simulationAlpha - simulationAlphaMin) / simulationAlphaDecay;
3075
2473
  return force > 0;
3076
2474
  }
3077
- get state() {
3078
- return {
3079
- areaTransform: this.areaTransform,
3080
- cachedNodeText: this.cachedNodeText,
3081
- context: this.context,
3082
- eventAbortController: this.eventAbortController,
3083
- highlightProgress: this.highlightProgress,
3084
- highlightDrawing: this.highlightDrawing,
3085
- highlightedNeighbors: this.highlightedNeighbors,
3086
- highlightedNode: this.highlightedNode,
3087
- highlightedLink: this.highlightedLink,
3088
- highlightWorking: this.highlightWorking,
3089
- isDragging: this.isDragging,
3090
- simulation: this.simulation,
3091
- simulationWorking: this.simulationWorking,
3092
- height: this.height,
3093
- links: this.links,
3094
- nodes: this.nodes,
3095
- width: this.width,
3096
- forceSettings: this.forceSettings,
3097
- graphSettings: this.graphSettings,
3098
- linkSettings: this.linkSettings,
3099
- nodeSettings: this.nodeSettings,
3100
- };
3101
- }
3102
- constructor({ links, nodes, root, forceSettings, linkSettings, listeners, nodeSettings, graphSettings, }) {
2475
+ constructor({ links, nodes, root, forceSettings, linkSettings, listeners, nodeSettings, graphSettings, highlightSettings, }) {
3103
2476
  // root.style.position = "relative";
3104
2477
  root.style.overflow = "hidden";
3105
2478
  this.root = root;
@@ -3108,6 +2481,7 @@ class GraphCanvas {
3108
2481
  this.nodeSettings = nodeSettingsGetter(nodeSettings);
3109
2482
  this.listeners = listenersGetter(listeners);
3110
2483
  this.graphSettings = graphSettingsGetter(graphSettings);
2484
+ this.highlightSettings = highlightSettingsGetter(highlightSettings);
3111
2485
  this.eventAbortController = new AbortController();
3112
2486
  this.nodes = nodes;
3113
2487
  this.links = links;
@@ -3142,6 +2516,14 @@ class GraphCanvas {
3142
2516
  if (options.forceSettings) {
3143
2517
  this.forceSettings = forceSettingsGetter(options.forceSettings, this.forceSettings);
3144
2518
  }
2519
+ if (options.highlightSettings) {
2520
+ this.highlightSettings = highlightSettingsGetter(options.highlightSettings, this.highlightSettings);
2521
+ this.linkOptionsCache = {};
2522
+ this.cachedNodeText = {};
2523
+ this.cachedNodeLabel = {};
2524
+ this.cachedTextNodeParameters = {};
2525
+ this.nodeOptionsCache = {};
2526
+ }
3145
2527
  if (options.linkSettings) {
3146
2528
  this.linkSettings = linkSettingsGetter(options.linkSettings, this.linkSettings);
3147
2529
  this.linkOptionsCache = {};
@@ -3149,6 +2531,7 @@ class GraphCanvas {
3149
2531
  if (options.nodeSettings) {
3150
2532
  this.nodeSettings = nodeSettingsGetter(options.nodeSettings, this.nodeSettings);
3151
2533
  this.cachedNodeText = {};
2534
+ this.cachedNodeLabel = {};
3152
2535
  this.cachedTextNodeParameters = {};
3153
2536
  this.nodeOptionsCache = {};
3154
2537
  initCollideForce.call(this, true);
@@ -3167,6 +2550,7 @@ class GraphCanvas {
3167
2550
  this.nodeOptionsCache = {};
3168
2551
  this.linkOptionsCache = {};
3169
2552
  this.cachedNodeText = {};
2553
+ this.cachedNodeLabel = {};
3170
2554
  this.cachedTextNodeParameters = {};
3171
2555
  }
3172
2556
  else {
@@ -3239,7 +2623,7 @@ class GraphCanvas {
3239
2623
  this.simulation
3240
2624
  .nodes(this.nodes)
3241
2625
  .force("link", d3Force.forceLink(this.links)
3242
- .id(this.nodeSettings.idGetter)
2626
+ .id(this.nodeSettings.idGetter.bind(this))
3243
2627
  .distance(this.forceSettings.forces && this.forceSettings.linkForce
3244
2628
  ? this.forceSettings.linkDistance
3245
2629
  : 0)
@@ -3273,28 +2657,1223 @@ class GraphCanvas {
3273
2657
  }
3274
2658
  }
3275
2659
 
2660
+ const FORCE_CONTROLS = [
2661
+ {
2662
+ id: "forces",
2663
+ initialValue: FORCE_SETTINGS.forces,
2664
+ label: "Физика",
2665
+ type: "checkbox",
2666
+ },
2667
+ {
2668
+ id: "collideForce",
2669
+ type: "checkbox",
2670
+ label: "Сила отталкивания",
2671
+ initialValue: FORCE_SETTINGS.collideForce,
2672
+ },
2673
+ {
2674
+ id: "centerForce",
2675
+ type: "checkbox",
2676
+ label: "Сила центрирования",
2677
+ initialValue: FORCE_SETTINGS.centerForce,
2678
+ },
2679
+ {
2680
+ id: "chargeForce",
2681
+ type: "checkbox",
2682
+ label: "Сила дистанции",
2683
+ initialValue: FORCE_SETTINGS.chargeForce,
2684
+ },
2685
+ {
2686
+ id: "linkForce",
2687
+ type: "checkbox",
2688
+ label: "Сила связей",
2689
+ initialValue: FORCE_SETTINGS.linkForce,
2690
+ },
2691
+ {
2692
+ id: "xForce",
2693
+ type: "checkbox",
2694
+ label: "Сила притяжения по оси X",
2695
+ initialValue: FORCE_SETTINGS.xForce,
2696
+ },
2697
+ {
2698
+ id: "yForce",
2699
+ type: "checkbox",
2700
+ label: "Сила притяжения по оси Y",
2701
+ initialValue: FORCE_SETTINGS.yForce,
2702
+ },
2703
+ {
2704
+ id: "collideStrength",
2705
+ initialValue: FORCE_SETTINGS.collideStrength,
2706
+ label: "Сила отталкивания",
2707
+ max: 1,
2708
+ min: 0,
2709
+ step: 0.01,
2710
+ type: "range",
2711
+ },
2712
+ {
2713
+ id: "collideAdditionalRadius",
2714
+ initialValue: FORCE_SETTINGS.collideAdditionalRadius,
2715
+ label: "Радиус отталкивания",
2716
+ max: 300,
2717
+ min: 0,
2718
+ step: 0.1,
2719
+ type: "range",
2720
+ },
2721
+ {
2722
+ id: "collideIterations",
2723
+ initialValue: FORCE_SETTINGS.collideIterations,
2724
+ label: "Итерации отталкивания",
2725
+ max: 10,
2726
+ min: 0,
2727
+ step: 1,
2728
+ type: "range",
2729
+ },
2730
+ {
2731
+ id: "chargeStrength",
2732
+ initialValue: typeof FORCE_SETTINGS.chargeStrength === "number" ? FORCE_SETTINGS.chargeStrength : 0,
2733
+ label: "Дистанция",
2734
+ max: 0,
2735
+ min: -300,
2736
+ step: 0.1,
2737
+ type: "range",
2738
+ },
2739
+ {
2740
+ type: "range",
2741
+ id: "xPosition",
2742
+ min: 0,
2743
+ max: 2000,
2744
+ step: 1,
2745
+ label: "Координата притяжения по оси X",
2746
+ initialValue: typeof FORCE_SETTINGS.xPosition === "number" ? FORCE_SETTINGS.xPosition : 0,
2747
+ },
2748
+ {
2749
+ type: "range",
2750
+ id: "yPosition",
2751
+ min: 0,
2752
+ max: 2000,
2753
+ step: 1,
2754
+ label: "Координата притяжения по оси Y",
2755
+ initialValue: typeof FORCE_SETTINGS.yPosition === "number" ? FORCE_SETTINGS.yPosition : 0,
2756
+ },
2757
+ {
2758
+ type: "range",
2759
+ id: "xStrength",
2760
+ min: 0,
2761
+ max: 1,
2762
+ step: 0.01,
2763
+ label: "Сила притяжения по оси X",
2764
+ initialValue: typeof FORCE_SETTINGS.xStrength === "number" ? FORCE_SETTINGS.xStrength : 0,
2765
+ },
2766
+ {
2767
+ type: "range",
2768
+ id: "yStrength",
2769
+ min: 0,
2770
+ max: 1,
2771
+ step: 0.01,
2772
+ label: "Сила притяжения по оси Y",
2773
+ initialValue: typeof FORCE_SETTINGS.yStrength === "number" ? FORCE_SETTINGS.yStrength : 0,
2774
+ },
2775
+ {
2776
+ type: "range",
2777
+ id: "linkStrength",
2778
+ min: 0,
2779
+ max: 1,
2780
+ step: 0.01,
2781
+ label: "Сила связей",
2782
+ initialValue: typeof FORCE_SETTINGS.linkStrength === "number" ? FORCE_SETTINGS.linkStrength : 0,
2783
+ },
2784
+ {
2785
+ type: "range",
2786
+ id: "linkDistance",
2787
+ min: 0,
2788
+ max: 300,
2789
+ step: 0.1,
2790
+ label: "Расстояние связей",
2791
+ initialValue: typeof FORCE_SETTINGS.linkDistance === "number" ? FORCE_SETTINGS.linkDistance : 30,
2792
+ },
2793
+ ];
2794
+
2795
+ const GRAPH_CONTROLS = [
2796
+ {
2797
+ id: "highlightDownFrames",
2798
+ initialValue: GRAPH_SETTINGS.highlightDownFrames,
2799
+ max: 60,
2800
+ min: 1,
2801
+ step: 1,
2802
+ type: "range",
2803
+ label: "Скорость отмены анимации в кадрах",
2804
+ },
2805
+ {
2806
+ id: "highlightUpFrames",
2807
+ initialValue: GRAPH_SETTINGS.highlightUpFrames,
2808
+ max: 60,
2809
+ min: 1,
2810
+ step: 1,
2811
+ type: "range",
2812
+ label: "Скорость применения анимации в кадрах",
2813
+ },
2814
+ ];
2815
+
2816
+ const HIGHLIGHT_COMMON_CONTROLS = [
2817
+ {
2818
+ id: "highlightByHoverNode",
2819
+ type: "checkbox",
2820
+ initialValue: HIGHLIGHT_SETTINGS.highlightByHoverNode,
2821
+ label: "Анимация при наведении на вершину",
2822
+ },
2823
+ {
2824
+ id: "highlightByHoverLink",
2825
+ type: "checkbox",
2826
+ label: "Анимация при наведении на связь",
2827
+ initialValue: HIGHLIGHT_SETTINGS.highlightByHoverLink,
2828
+ },
2829
+ {
2830
+ id: "linkHoverExtraZone",
2831
+ initialValue: HIGHLIGHT_SETTINGS.linkHoverExtraZone,
2832
+ max: 10,
2833
+ min: 0,
2834
+ step: 0.01,
2835
+ type: "range",
2836
+ label: "Расширение границы связи для курсора",
2837
+ },
2838
+ ];
2839
+ const HIGHLIGHT_BY_NODE_FOR_NODE_CONTROLS = [
2840
+ {
2841
+ id: "highlightByNodeOnlyRoot",
2842
+ type: "checkbox",
2843
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeOnlyRoot,
2844
+ label: "Основная анимация только на инициаторе",
2845
+ },
2846
+ {
2847
+ id: "highlightByNodeForNodeColorFading",
2848
+ type: "checkbox",
2849
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeColorFading,
2850
+ label: "Прозрачность без альфа канала",
2851
+ },
2852
+ {
2853
+ id: "highlightByNodeForNodeColor",
2854
+ type: "color",
2855
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeColor ?? "#000000",
2856
+ label: "Цвет",
2857
+ },
2858
+ {
2859
+ id: "highlightByNodeForNodeFadingMin",
2860
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeFadingMin,
2861
+ max: 1,
2862
+ min: 0,
2863
+ step: 0.01,
2864
+ type: "range",
2865
+ label: "Граница прозрачности",
2866
+ },
2867
+ {
2868
+ id: "highlightByNodeForNodeColorFadingMin",
2869
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeColorFadingMin,
2870
+ max: 1,
2871
+ min: 0.01,
2872
+ step: 0.01,
2873
+ type: "range",
2874
+ label: "Граница прозрачности без альфа канала",
2875
+ },
2876
+ {
2877
+ id: "highlightByNodeForNodeSizingAdditional",
2878
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeSizingAdditional,
2879
+ max: 10,
2880
+ min: -10,
2881
+ step: 0.01,
2882
+ type: "range",
2883
+ label: "Изменение радиуса (только для круга)",
2884
+ },
2885
+ {
2886
+ id: "highlightByNodeForNodeSizingAdditionalCoefficient",
2887
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeSizingAdditionalCoefficient,
2888
+ max: 10,
2889
+ min: 0.01,
2890
+ step: 0.01,
2891
+ type: "range",
2892
+ label: "Коэффициент изменения размера (только не для круга)",
2893
+ },
2894
+ {
2895
+ id: "highlightByNodeForNodeBorderColor",
2896
+ type: "color",
2897
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeBorderColor ?? "#000000",
2898
+ label: "Цвет границы",
2899
+ },
2900
+ {
2901
+ id: "highlightByNodeForNodeBorderSizingAdditional",
2902
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeBorderSizingAdditional,
2903
+ max: 10,
2904
+ min: 0.01,
2905
+ step: 0.01,
2906
+ type: "range",
2907
+ label: "Изменение размера границы",
2908
+ },
2909
+ ];
2910
+ const HIGHLIGHT_BY_NODE_FOR_TEXT_CONTROLS = [
2911
+ {
2912
+ id: "highlightByNodeForTextFadingMin",
2913
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForTextFadingMin,
2914
+ max: 1,
2915
+ min: 0,
2916
+ step: 0.01,
2917
+ type: "range",
2918
+ label: "Граница прозрачности",
2919
+ },
2920
+ {
2921
+ id: "highlightByNodeForTextSizingAdditional",
2922
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForTextSizingAdditional,
2923
+ max: 10,
2924
+ min: -10,
2925
+ step: 0.1,
2926
+ type: "range",
2927
+ label: "Изменение размера",
2928
+ },
2929
+ {
2930
+ id: "highlightByNodeForTextWeightAdditional",
2931
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForTextWeightAdditional,
2932
+ max: 1000,
2933
+ min: -1e3,
2934
+ step: 100,
2935
+ type: "range",
2936
+ label: "Изменение жирности",
2937
+ },
2938
+ {
2939
+ id: "highlightByNodeForTextShiftXAdditional",
2940
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForTextShiftXAdditional,
2941
+ max: 50,
2942
+ min: -50,
2943
+ step: 0.1,
2944
+ type: "range",
2945
+ label: "Смещение по оси X",
2946
+ },
2947
+ {
2948
+ id: "highlightByNodeForTextShiftYAdditional",
2949
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForTextShiftYAdditional,
2950
+ max: 50,
2951
+ min: -50,
2952
+ step: 0.1,
2953
+ type: "range",
2954
+ label: "Смещение по оси Y",
2955
+ },
2956
+ ];
2957
+ const HIGHLIGHT_BY_NODE_FOR_LABEL_CONTROLS = [
2958
+ {
2959
+ id: "highlightByNodeForLabelFadingMin",
2960
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLabelFadingMin,
2961
+ max: 1,
2962
+ min: 0,
2963
+ step: 0.01,
2964
+ type: "range",
2965
+ label: "Граница прозрачности",
2966
+ },
2967
+ {
2968
+ id: "highlightByNodeForLabelSizingAdditional",
2969
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLabelSizingAdditional,
2970
+ max: 10,
2971
+ min: -10,
2972
+ step: 0.1,
2973
+ type: "range",
2974
+ label: "Изменение размера",
2975
+ },
2976
+ {
2977
+ id: "highlightByNodeForLabelWeightAdditional",
2978
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLabelWeightAdditional,
2979
+ max: 1000,
2980
+ min: -1e3,
2981
+ step: 100,
2982
+ type: "range",
2983
+ label: "Изменение жирности",
2984
+ },
2985
+ ];
2986
+ const HIGHLIGHT_BY_NODE_FOR_LINK_CONTROLS = [
2987
+ {
2988
+ id: "highlightByNodeForLinkColor",
2989
+ type: "color",
2990
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLinkColor ?? "#000000",
2991
+ label: "Цвет",
2992
+ },
2993
+ {
2994
+ id: "highlightByNodeForLinkFadingMin",
2995
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLinkFadingMin,
2996
+ max: 1,
2997
+ min: 0,
2998
+ step: 0.01,
2999
+ type: "range",
3000
+ label: "Граница прозрачности",
3001
+ },
3002
+ {
3003
+ id: "highlightByNodeForLinkSizeAdditional",
3004
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLinkSizeAdditional,
3005
+ max: 10,
3006
+ min: -10,
3007
+ step: 0.1,
3008
+ type: "range",
3009
+ label: "Изменение размера",
3010
+ },
3011
+ ];
3012
+ const HIGHLIGHT_BY_NODE_FOR_ARROW_CONTROLS = [
3013
+ {
3014
+ id: "highlightByNodeForArrowColor",
3015
+ type: "color",
3016
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForArrowColor ?? "#000000",
3017
+ label: "Цвет",
3018
+ },
3019
+ {
3020
+ id: "highlightByNodeForArrowFadingMin",
3021
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForArrowFadingMin,
3022
+ max: 1,
3023
+ min: 0,
3024
+ step: 0.01,
3025
+ type: "range",
3026
+ label: "Граница прозрачности",
3027
+ },
3028
+ {
3029
+ id: "highlightByNodeForArrowSizeAdditional",
3030
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForArrowSizeAdditional,
3031
+ max: 10,
3032
+ min: -10,
3033
+ step: 0.1,
3034
+ type: "range",
3035
+ label: "Изменение размера",
3036
+ },
3037
+ {
3038
+ id: "highlightByNodeForArrowBorderColor",
3039
+ type: "color",
3040
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForArrowBorderColor ?? "#000000",
3041
+ label: "Цвет границы",
3042
+ },
3043
+ {
3044
+ id: "highlightByNodeForArrowBorderSizingAdditional",
3045
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForArrowBorderSizingAdditional,
3046
+ max: 10,
3047
+ min: 0.01,
3048
+ step: 0.01,
3049
+ type: "range",
3050
+ label: "Изменение размера границы",
3051
+ },
3052
+ ];
3053
+ const HIGHLIGHT_BY_LINK_FOR_NODE_CONTROLS = [
3054
+ {
3055
+ id: "highlightByLinkForNodeColorFading",
3056
+ type: "checkbox",
3057
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeColorFading,
3058
+ label: "Прозрачность без альфа канала",
3059
+ },
3060
+ {
3061
+ id: "highlightByLinkForNodeColor",
3062
+ type: "color",
3063
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeColor ?? "#000000",
3064
+ label: "Цвет",
3065
+ },
3066
+ {
3067
+ id: "highlightByLinkForNodeFadingMin",
3068
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeFadingMin,
3069
+ max: 1,
3070
+ min: 0,
3071
+ step: 0.01,
3072
+ type: "range",
3073
+ label: "Граница прозрачности",
3074
+ },
3075
+ {
3076
+ id: "highlightByLinkForNodeColorFadingMin",
3077
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeColorFadingMin,
3078
+ max: 1,
3079
+ min: 0.01,
3080
+ step: 0.01,
3081
+ type: "range",
3082
+ label: "Граница прозрачности без альфа канала",
3083
+ },
3084
+ {
3085
+ id: "highlightByLinkForNodeSizingAdditional",
3086
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeSizingAdditional,
3087
+ max: 10,
3088
+ min: -10,
3089
+ step: 0.01,
3090
+ type: "range",
3091
+ label: "Изменение радиуса (только для круга)",
3092
+ },
3093
+ {
3094
+ id: "highlightByLinkForNodeSizingAdditionalCoefficient",
3095
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeSizingAdditionalCoefficient,
3096
+ max: 10,
3097
+ min: 0.01,
3098
+ step: 0.01,
3099
+ type: "range",
3100
+ label: "Коэффициент изменения размера (только не для круга)",
3101
+ },
3102
+ {
3103
+ id: "highlightByLinkForNodeBorderColor",
3104
+ type: "color",
3105
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeBorderColor ?? "#000000",
3106
+ label: "Цвет границы",
3107
+ },
3108
+ {
3109
+ id: "highlightByLinkForNodeBorderSizingAdditional",
3110
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeBorderSizingAdditional,
3111
+ max: 10,
3112
+ min: 0.01,
3113
+ step: 0.01,
3114
+ type: "range",
3115
+ label: "Изменение размера границы",
3116
+ },
3117
+ ];
3118
+ const HIGHLIGHT_BY_LINK_FOR_TEXT_CONTROLS = [
3119
+ {
3120
+ id: "highlightByLinkForTextFadingMin",
3121
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForTextFadingMin,
3122
+ max: 1,
3123
+ min: 0,
3124
+ step: 0.01,
3125
+ type: "range",
3126
+ label: "Граница прозрачности",
3127
+ },
3128
+ {
3129
+ id: "highlightByLinkForTextSizingAdditional",
3130
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForTextSizingAdditional,
3131
+ max: 10,
3132
+ min: -10,
3133
+ step: 0.1,
3134
+ type: "range",
3135
+ label: "Изменение размера",
3136
+ },
3137
+ {
3138
+ id: "highlightByLinkForTextWeightAdditional",
3139
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForTextWeightAdditional,
3140
+ max: 1000,
3141
+ min: -1e3,
3142
+ step: 100,
3143
+ type: "range",
3144
+ label: "Изменение жирности",
3145
+ },
3146
+ {
3147
+ id: "highlightByLinkForTextShiftXAdditional",
3148
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForTextShiftXAdditional,
3149
+ max: 50,
3150
+ min: -50,
3151
+ step: 0.1,
3152
+ type: "range",
3153
+ label: "Смещение по оси X",
3154
+ },
3155
+ {
3156
+ id: "highlightByLinkForTextShiftYAdditional",
3157
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForTextShiftYAdditional,
3158
+ max: 50,
3159
+ min: -50,
3160
+ step: 0.1,
3161
+ type: "range",
3162
+ label: "Смещение по оси Y",
3163
+ },
3164
+ ];
3165
+ const HIGHLIGHT_BY_LINK_FOR_LABEL_CONTROLS = [
3166
+ {
3167
+ id: "highlightByLinkForLabelFadingMin",
3168
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLabelFadingMin,
3169
+ max: 1,
3170
+ min: 0,
3171
+ step: 0.01,
3172
+ type: "range",
3173
+ label: "Граница прозрачности",
3174
+ },
3175
+ {
3176
+ id: "highlightByLinkForLabelSizingAdditional",
3177
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLabelSizingAdditional,
3178
+ max: 10,
3179
+ min: -10,
3180
+ step: 0.1,
3181
+ type: "range",
3182
+ label: "Изменение размера",
3183
+ },
3184
+ {
3185
+ id: "highlightByLinkForLabelWeightAdditional",
3186
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLabelWeightAdditional,
3187
+ max: 1000,
3188
+ min: -1e3,
3189
+ step: 100,
3190
+ type: "range",
3191
+ label: "Изменение жирности",
3192
+ },
3193
+ ];
3194
+ const HIGHLIGHT_BY_LINK_FOR_LINK_CONTROLS = [
3195
+ {
3196
+ id: "highlightByLinkForLinkColor",
3197
+ type: "color",
3198
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLinkColor ?? "#000000",
3199
+ label: "Цвет",
3200
+ },
3201
+ {
3202
+ id: "highlightByLinkForLinkFadingMin",
3203
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLinkFadingMin,
3204
+ max: 1,
3205
+ min: 0,
3206
+ step: 0.01,
3207
+ type: "range",
3208
+ label: "Граница прозрачности",
3209
+ },
3210
+ {
3211
+ id: "highlightByLinkForLinkSizeAdditional",
3212
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLinkSizeAdditional,
3213
+ max: 10,
3214
+ min: -10,
3215
+ step: 0.1,
3216
+ type: "range",
3217
+ label: "Изменение размера",
3218
+ },
3219
+ ];
3220
+ const HIGHLIGHT_BY_LINK_FOR_ARROW_CONTROLS = [
3221
+ {
3222
+ id: "highlightByLinkForArrowColor",
3223
+ type: "color",
3224
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForArrowColor ?? "#000000",
3225
+ label: "Цвет",
3226
+ },
3227
+ {
3228
+ id: "highlightByLinkForArrowFadingMin",
3229
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForArrowFadingMin,
3230
+ max: 1,
3231
+ min: 0,
3232
+ step: 0.01,
3233
+ type: "range",
3234
+ label: "Граница прозрачности",
3235
+ },
3236
+ {
3237
+ id: "highlightByLinkForArrowSizeAdditional",
3238
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForArrowSizeAdditional,
3239
+ max: 10,
3240
+ min: -10,
3241
+ step: 0.1,
3242
+ type: "range",
3243
+ label: "Изменение размера",
3244
+ },
3245
+ {
3246
+ id: "highlightByLinkForArrowBorderColor",
3247
+ type: "color",
3248
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForArrowBorderColor ?? "#000000",
3249
+ label: "Цвет границы",
3250
+ },
3251
+ {
3252
+ id: "highlightByLinkForArrowBorderSizingAdditional",
3253
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForArrowBorderSizingAdditional,
3254
+ max: 10,
3255
+ min: 0.01,
3256
+ step: 0.01,
3257
+ type: "range",
3258
+ label: "Изменение размера границы",
3259
+ },
3260
+ ];
3261
+
3262
+ const LINK_SETTINGS_CONTROLS = [
3263
+ {
3264
+ id: "cacheOptions",
3265
+ type: "checkbox",
3266
+ label: "Кеширование вычисляемых настроек",
3267
+ initialValue: LINK_SETTINGS.cacheOptions,
3268
+ },
3269
+ {
3270
+ id: "prettyDraw",
3271
+ type: "checkbox",
3272
+ label: "Обсчет корректного соединения",
3273
+ initialValue: LINK_SETTINGS.prettyDraw,
3274
+ },
3275
+ {
3276
+ id: "linkScaleSwitch",
3277
+ initialValue: LINK_SETTINGS.linkScaleSwitch,
3278
+ max: 20,
3279
+ min: 0,
3280
+ step: 0.01,
3281
+ type: "range",
3282
+ label: "Граница зума для связи",
3283
+ },
3284
+ {
3285
+ id: "linkWidthAfterScaleSwitch",
3286
+ initialValue: LINK_SETTINGS.linkWidthAfterScaleSwitch,
3287
+ max: 20,
3288
+ min: 0,
3289
+ step: 0.01,
3290
+ type: "range",
3291
+ label: "Размер связи после границы зума",
3292
+ },
3293
+ {
3294
+ id: "linkWidthBeforeScaleSwitch",
3295
+ initialValue: LINK_SETTINGS.linkWidthBeforeScaleSwitch,
3296
+ max: 20,
3297
+ min: 0,
3298
+ step: 0.01,
3299
+ type: "range",
3300
+ label: "Размер связи до границы зума",
3301
+ },
3302
+ {
3303
+ id: "linkColorAfterScaleSwitch",
3304
+ type: "color",
3305
+ initialValue: LINK_SETTINGS.linkColorAfterScaleSwitch,
3306
+ label: "Цвет связи после границы зума",
3307
+ },
3308
+ {
3309
+ id: "linkColorBeforeScaleSwitch",
3310
+ type: "color",
3311
+ initialValue: LINK_SETTINGS.linkColorBeforeScaleSwitch,
3312
+ label: "Цвет связи до границы зума",
3313
+ },
3314
+ {
3315
+ id: "arrow",
3316
+ type: "checkbox",
3317
+ label: "Стрелка",
3318
+ initialValue: LINK_SETTINGS.arrow,
3319
+ },
3320
+ {
3321
+ id: "arrowByHighlight",
3322
+ type: "checkbox",
3323
+ label: "Появление стрелки при анимации",
3324
+ initialValue: LINK_SETTINGS.arrowByHighlight,
3325
+ },
3326
+ {
3327
+ id: "particles",
3328
+ type: "checkbox",
3329
+ label: "Частицы",
3330
+ initialValue: LINK_SETTINGS.particles,
3331
+ },
3332
+ {
3333
+ id: "particleFlexSpeed",
3334
+ type: "checkbox",
3335
+ label: "Гибкий расчет скорости частицы",
3336
+ initialValue: LINK_SETTINGS.particleFlexSpeed,
3337
+ },
3338
+ {
3339
+ id: "particleFlexSpeedCoefficient",
3340
+ initialValue: LINK_SETTINGS.particleFlexSpeedCoefficient,
3341
+ max: 10,
3342
+ min: 0.1,
3343
+ step: 0.1,
3344
+ type: "range",
3345
+ label: "Коэффициент скорости частицы относительно расстояния",
3346
+ },
3347
+ ];
3348
+ const LINK_OPTIONS_LINK_CONTROLS = [
3349
+ {
3350
+ id: "alpha",
3351
+ type: "range",
3352
+ max: 1,
3353
+ min: 0,
3354
+ step: 0.1,
3355
+ label: "Прозрачность",
3356
+ initialValue: LINK_OPTIONS.alpha,
3357
+ },
3358
+ {
3359
+ id: "width",
3360
+ type: "range",
3361
+ max: 10,
3362
+ min: 0.1,
3363
+ step: 0.1,
3364
+ label: "Толщина",
3365
+ initialValue: 0.1,
3366
+ },
3367
+ {
3368
+ id: "color",
3369
+ type: "color",
3370
+ initialValue: "#000000FF",
3371
+ label: "Цвет",
3372
+ },
3373
+ ];
3374
+ const LINK_OPTIONS_ARROW_CONTROLS = [
3375
+ {
3376
+ id: "arrowColor",
3377
+ type: "color",
3378
+ initialValue: "#000000FF",
3379
+ label: "Цвет стрелки",
3380
+ },
3381
+ {
3382
+ id: "arrowAlpha",
3383
+ type: "range",
3384
+ max: 1,
3385
+ min: 0,
3386
+ step: 0.1,
3387
+ label: "Прозрачность",
3388
+ initialValue: LINK_OPTIONS.arrowAlpha,
3389
+ },
3390
+ {
3391
+ id: "arrowSize",
3392
+ type: "range",
3393
+ max: 10,
3394
+ min: 0.1,
3395
+ step: 0.1,
3396
+ label: "Размер",
3397
+ initialValue: LINK_OPTIONS.arrowSize,
3398
+ },
3399
+ {
3400
+ id: "arrowBorderColor",
3401
+ type: "color",
3402
+ initialValue: LINK_OPTIONS.arrowBorderColor,
3403
+ label: "Цвет границы",
3404
+ },
3405
+ {
3406
+ id: "arrowBorderWidth",
3407
+ type: "range",
3408
+ max: 10,
3409
+ min: 0,
3410
+ step: 0.1,
3411
+ label: "Размер границы",
3412
+ initialValue: LINK_OPTIONS.arrowBorderWidth,
3413
+ },
3414
+ ];
3415
+ const LINK_OPTIONS_PARTICLE_CONTROLS = [
3416
+ {
3417
+ id: "particleColor",
3418
+ type: "color",
3419
+ initialValue: LINK_OPTIONS.particleColor,
3420
+ label: "Цвет",
3421
+ },
3422
+ {
3423
+ id: "particleAlpha",
3424
+ type: "range",
3425
+ max: 1,
3426
+ min: 0,
3427
+ step: 0.1,
3428
+ label: "Прозрачность",
3429
+ initialValue: LINK_OPTIONS.particleAlpha,
3430
+ },
3431
+ {
3432
+ id: "particleRadius",
3433
+ type: "range",
3434
+ max: 10,
3435
+ min: 0.1,
3436
+ step: 0.1,
3437
+ label: "Радиус",
3438
+ initialValue: LINK_OPTIONS.particleRadius,
3439
+ },
3440
+ {
3441
+ id: "particleCount",
3442
+ type: "range",
3443
+ max: 20,
3444
+ min: 1,
3445
+ step: 1,
3446
+ label: "Количество",
3447
+ initialValue: LINK_OPTIONS.particleCount,
3448
+ },
3449
+ {
3450
+ id: "particleSteps",
3451
+ type: "range",
3452
+ max: 200,
3453
+ min: 1,
3454
+ step: 1,
3455
+ label: "Количество кадров",
3456
+ initialValue: LINK_OPTIONS.particleSteps,
3457
+ },
3458
+ {
3459
+ id: "particleBorderColor",
3460
+ type: "color",
3461
+ initialValue: LINK_OPTIONS.particleBorderColor,
3462
+ label: "Цвет границы",
3463
+ },
3464
+ {
3465
+ id: "particleBorderWidth",
3466
+ type: "range",
3467
+ max: 10,
3468
+ min: 0,
3469
+ step: 0.1,
3470
+ label: "Размер границы",
3471
+ initialValue: LINK_OPTIONS.particleBorderWidth,
3472
+ },
3473
+ ];
3474
+
3475
+ const NODE_SETTINGS_CONTROLS = [
3476
+ {
3477
+ id: "cacheOptions",
3478
+ type: "checkbox",
3479
+ initialValue: NODE_SETTINGS.cacheOptions,
3480
+ label: "Кеширование вычисляемых настроек",
3481
+ },
3482
+ {
3483
+ id: "textNodeDebug",
3484
+ type: "checkbox",
3485
+ initialValue: NODE_SETTINGS.textNodeDebug,
3486
+ label: "Отладка текстовой вершины",
3487
+ },
3488
+ {
3489
+ id: "nodeRadiusFlexible",
3490
+ type: "checkbox",
3491
+ initialValue: NODE_SETTINGS.nodeRadiusFlexible,
3492
+ label: "Гибкий радиус (только для круга)",
3493
+ },
3494
+ {
3495
+ id: "nodeRadiusCoefficient",
3496
+ initialValue: NODE_SETTINGS.nodeRadiusCoefficient,
3497
+ max: 100,
3498
+ min: 0.1,
3499
+ step: 0.1,
3500
+ type: "range",
3501
+ label: "Количество связей для увеличения радиуса (только для круга)",
3502
+ },
3503
+ {
3504
+ id: "nodeRadiusFactor",
3505
+ initialValue: NODE_SETTINGS.nodeRadiusFactor,
3506
+ max: 50,
3507
+ min: 0.1,
3508
+ step: 0.1,
3509
+ type: "range",
3510
+ label: "Коэффициент увеличения радиуса (только для круга)",
3511
+ },
3512
+ {
3513
+ id: "nodeSizeFlexible",
3514
+ type: "checkbox",
3515
+ initialValue: NODE_SETTINGS.nodeSizeFlexible,
3516
+ label: "Гибкий размер (только не для круга)",
3517
+ },
3518
+ {
3519
+ id: "nodeSizeCoefficient",
3520
+ initialValue: NODE_SETTINGS.nodeSizeCoefficient,
3521
+ max: 50,
3522
+ min: 0.1,
3523
+ step: 0.1,
3524
+ type: "range",
3525
+ label: "Количество связей для увеличения размера (только не для круга)",
3526
+ },
3527
+ {
3528
+ id: "nodeSizeFactor",
3529
+ initialValue: NODE_SETTINGS.nodeSizeFactor,
3530
+ max: 20,
3531
+ min: 0.01,
3532
+ step: 0.01,
3533
+ type: "range",
3534
+ label: "Коэффициент увеличения размера (только не для круга)",
3535
+ },
3536
+ {
3537
+ id: "textScaleMin",
3538
+ initialValue: NODE_SETTINGS.textScaleMin,
3539
+ max: 20,
3540
+ min: 0,
3541
+ step: 0.01,
3542
+ type: "range",
3543
+ label: "Минимальная граница зума для текста",
3544
+ },
3545
+ {
3546
+ id: "textScaleMax",
3547
+ initialValue: NODE_SETTINGS.textScaleMax,
3548
+ max: 20,
3549
+ min: 0,
3550
+ step: 0.01,
3551
+ type: "range",
3552
+ label: "Максимальная граница зума для текста",
3553
+ },
3554
+ {
3555
+ id: "textSizeMin",
3556
+ initialValue: NODE_SETTINGS.textSizeMin,
3557
+ max: 20,
3558
+ min: 0,
3559
+ step: 0.01,
3560
+ type: "range",
3561
+ label: "Размер текста на минимальной границе зума",
3562
+ },
3563
+ {
3564
+ id: "textSizeMax",
3565
+ initialValue: NODE_SETTINGS.textSizeMax,
3566
+ max: 20,
3567
+ min: 0,
3568
+ step: 0.01,
3569
+ type: "range",
3570
+ label: "Размер текста на максимальной границе зума",
3571
+ },
3572
+ {
3573
+ id: "textShiftYMin",
3574
+ initialValue: NODE_SETTINGS.textShiftYMin,
3575
+ max: 20,
3576
+ min: 0,
3577
+ step: 0.01,
3578
+ type: "range",
3579
+ label: "Смещение текста по оси Y на минимальной границе зума",
3580
+ },
3581
+ {
3582
+ id: "textShiftYMax",
3583
+ initialValue: NODE_SETTINGS.textShiftYMax,
3584
+ max: 20,
3585
+ min: 0,
3586
+ step: 0.01,
3587
+ type: "range",
3588
+ label: "Смещение текста по оси Y на максимальной границе зума",
3589
+ },
3590
+ ];
3591
+ const NODE_OPTIONS_NODE_CONTROLS = [
3592
+ {
3593
+ id: "shape",
3594
+ type: "select",
3595
+ initialValue: NODE_OPTIONS.shape,
3596
+ label: "Форма",
3597
+ options: [
3598
+ { label: "Картинки", value: "icon" },
3599
+ { label: "Круг", value: "circle" },
3600
+ { label: "Прямоугольник", value: "square" },
3601
+ { label: "Текст", value: "text" },
3602
+ ],
3603
+ },
3604
+ {
3605
+ id: "color",
3606
+ type: "color",
3607
+ initialValue: "#000000FF",
3608
+ label: "Цвет",
3609
+ },
3610
+ {
3611
+ id: "alpha",
3612
+ type: "range",
3613
+ max: 1,
3614
+ min: 0,
3615
+ step: 0.1,
3616
+ label: "Прозрачность",
3617
+ initialValue: NODE_OPTIONS.alpha,
3618
+ },
3619
+ {
3620
+ id: "radius",
3621
+ type: "range",
3622
+ max: 50,
3623
+ min: 1,
3624
+ step: 0.1,
3625
+ label: "Радиус (только для круга)",
3626
+ initialValue: NODE_OPTIONS.radius,
3627
+ },
3628
+ {
3629
+ id: "width",
3630
+ type: "range",
3631
+ max: 50,
3632
+ min: 1,
3633
+ step: 1,
3634
+ label: "Ширина (только не для круга)",
3635
+ initialValue: NODE_OPTIONS.width,
3636
+ },
3637
+ {
3638
+ id: "height",
3639
+ type: "range",
3640
+ max: 50,
3641
+ min: 1,
3642
+ step: 1,
3643
+ label: "Высота (только не для круга)",
3644
+ initialValue: NODE_OPTIONS.height,
3645
+ },
3646
+ {
3647
+ id: "borderColor",
3648
+ type: "color",
3649
+ initialValue: "#000000FF",
3650
+ label: "Цвет границы",
3651
+ },
3652
+ {
3653
+ id: "borderWidth",
3654
+ type: "range",
3655
+ max: 5,
3656
+ min: 0,
3657
+ step: 0.1,
3658
+ label: "Толщина границы",
3659
+ initialValue: NODE_OPTIONS.borderWidth,
3660
+ },
3661
+ {
3662
+ id: "borderRadius",
3663
+ type: "range",
3664
+ max: 50,
3665
+ min: 0,
3666
+ step: 1,
3667
+ label: "Радиус границы (только не для круга)",
3668
+ initialValue: NODE_OPTIONS.borderRadius,
3669
+ },
3670
+ ];
3671
+ const NODE_OPTIONS_TEXT_CONTROLS = [
3672
+ {
3673
+ id: "textColor",
3674
+ type: "color",
3675
+ initialValue: NODE_OPTIONS.textColor,
3676
+ label: "Цвет",
3677
+ },
3678
+ {
3679
+ id: "textSize",
3680
+ type: "range",
3681
+ max: 30,
3682
+ min: 0,
3683
+ step: 0.1,
3684
+ label: "Размер",
3685
+ initialValue: 0,
3686
+ },
3687
+ {
3688
+ id: "textAlpha",
3689
+ type: "range",
3690
+ max: 1,
3691
+ min: 0,
3692
+ step: 0.1,
3693
+ label: "Прозрачность",
3694
+ initialValue: NODE_OPTIONS.textAlpha,
3695
+ },
3696
+ {
3697
+ id: "textWidth",
3698
+ type: "range",
3699
+ max: 200,
3700
+ min: 5,
3701
+ step: 1,
3702
+ label: "Ширина",
3703
+ initialValue: NODE_OPTIONS.textWidth,
3704
+ },
3705
+ {
3706
+ id: "textShiftX",
3707
+ type: "range",
3708
+ max: 100,
3709
+ min: 0,
3710
+ step: 0.1,
3711
+ label: "Смещение по оси X",
3712
+ initialValue: NODE_OPTIONS.textShiftX,
3713
+ },
3714
+ {
3715
+ id: "textShiftY",
3716
+ type: "range",
3717
+ max: 100,
3718
+ min: 0,
3719
+ step: 0.1,
3720
+ label: "Смещение по оси Y",
3721
+ initialValue: 4,
3722
+ },
3723
+ {
3724
+ id: "textWeight",
3725
+ type: "range",
3726
+ max: 1000,
3727
+ min: 100,
3728
+ step: 100,
3729
+ label: "Жирность",
3730
+ initialValue: NODE_OPTIONS.textWeight,
3731
+ },
3732
+ {
3733
+ id: "textGap",
3734
+ type: "range",
3735
+ max: 30,
3736
+ min: 0,
3737
+ step: 0.1,
3738
+ label: "Расстояние между строками",
3739
+ initialValue: NODE_OPTIONS.textGap,
3740
+ },
3741
+ ];
3742
+ const NODE_OPTIONS_LABEL_CONTROLS = [
3743
+ {
3744
+ id: "labelColor",
3745
+ type: "color",
3746
+ initialValue: NODE_OPTIONS.labelColor,
3747
+ label: "Цвет",
3748
+ },
3749
+ {
3750
+ id: "labelSize",
3751
+ type: "range",
3752
+ max: 30,
3753
+ min: 0,
3754
+ step: 0.1,
3755
+ label: "Размер",
3756
+ initialValue: NODE_OPTIONS.labelSize,
3757
+ },
3758
+ {
3759
+ id: "labelAlpha",
3760
+ type: "range",
3761
+ max: 1,
3762
+ min: 0,
3763
+ step: 0.1,
3764
+ label: "Прозрачность",
3765
+ initialValue: NODE_OPTIONS.labelAlpha,
3766
+ },
3767
+ {
3768
+ id: "labelWidth",
3769
+ type: "range",
3770
+ max: 200,
3771
+ min: 5,
3772
+ step: 1,
3773
+ label: "Ширина",
3774
+ initialValue: NODE_OPTIONS.labelWidth,
3775
+ },
3776
+ {
3777
+ id: "labelWeight",
3778
+ type: "range",
3779
+ max: 1000,
3780
+ min: 100,
3781
+ step: 100,
3782
+ label: "Жирность",
3783
+ initialValue: NODE_OPTIONS.labelWeight,
3784
+ },
3785
+ {
3786
+ id: "labelGap",
3787
+ type: "range",
3788
+ max: 30,
3789
+ min: 0,
3790
+ step: 0.1,
3791
+ label: "Расстояние между строками",
3792
+ initialValue: NODE_OPTIONS.labelGap,
3793
+ },
3794
+ {
3795
+ id: "labelXPadding",
3796
+ type: "range",
3797
+ max: 30,
3798
+ min: 0,
3799
+ step: 0.1,
3800
+ label: "Отступы по оси X",
3801
+ initialValue: NODE_OPTIONS.labelXPadding,
3802
+ },
3803
+ {
3804
+ id: "labelYPadding",
3805
+ type: "range",
3806
+ max: 30,
3807
+ min: 0,
3808
+ step: 0.1,
3809
+ label: "Отступы по оси Y",
3810
+ initialValue: NODE_OPTIONS.labelYPadding,
3811
+ },
3812
+ ];
3813
+
3814
+ exports.COMMON_SETTINGS = COMMON_SETTINGS;
3815
+ exports.FORCE_CONTROLS = FORCE_CONTROLS;
3816
+ exports.FORCE_SETTINGS = FORCE_SETTINGS;
3817
+ exports.GRAPH_CONTROLS = GRAPH_CONTROLS;
3818
+ exports.GRAPH_SETTINGS = GRAPH_SETTINGS;
3276
3819
  exports.GraphCanvas = GraphCanvas;
3820
+ exports.HIGHLIGHT_BY_LINK_FOR_ARROW_CONTROLS = HIGHLIGHT_BY_LINK_FOR_ARROW_CONTROLS;
3821
+ exports.HIGHLIGHT_BY_LINK_FOR_LABEL_CONTROLS = HIGHLIGHT_BY_LINK_FOR_LABEL_CONTROLS;
3822
+ exports.HIGHLIGHT_BY_LINK_FOR_LINK_CONTROLS = HIGHLIGHT_BY_LINK_FOR_LINK_CONTROLS;
3823
+ exports.HIGHLIGHT_BY_LINK_FOR_NODE_CONTROLS = HIGHLIGHT_BY_LINK_FOR_NODE_CONTROLS;
3824
+ exports.HIGHLIGHT_BY_LINK_FOR_TEXT_CONTROLS = HIGHLIGHT_BY_LINK_FOR_TEXT_CONTROLS;
3825
+ exports.HIGHLIGHT_BY_NODE_FOR_ARROW_CONTROLS = HIGHLIGHT_BY_NODE_FOR_ARROW_CONTROLS;
3826
+ exports.HIGHLIGHT_BY_NODE_FOR_LABEL_CONTROLS = HIGHLIGHT_BY_NODE_FOR_LABEL_CONTROLS;
3827
+ exports.HIGHLIGHT_BY_NODE_FOR_LINK_CONTROLS = HIGHLIGHT_BY_NODE_FOR_LINK_CONTROLS;
3828
+ exports.HIGHLIGHT_BY_NODE_FOR_NODE_CONTROLS = HIGHLIGHT_BY_NODE_FOR_NODE_CONTROLS;
3829
+ exports.HIGHLIGHT_BY_NODE_FOR_TEXT_CONTROLS = HIGHLIGHT_BY_NODE_FOR_TEXT_CONTROLS;
3830
+ exports.HIGHLIGHT_COMMON_CONTROLS = HIGHLIGHT_COMMON_CONTROLS;
3831
+ exports.HIGHLIGHT_SETTINGS = HIGHLIGHT_SETTINGS;
3832
+ exports.LINK_OPTIONS = LINK_OPTIONS;
3833
+ exports.LINK_OPTIONS_ARROW_CONTROLS = LINK_OPTIONS_ARROW_CONTROLS;
3834
+ exports.LINK_OPTIONS_LINK_CONTROLS = LINK_OPTIONS_LINK_CONTROLS;
3835
+ exports.LINK_OPTIONS_PARTICLE_CONTROLS = LINK_OPTIONS_PARTICLE_CONTROLS;
3836
+ exports.LINK_SETTINGS = LINK_SETTINGS;
3837
+ exports.LINK_SETTINGS_CONTROLS = LINK_SETTINGS_CONTROLS;
3838
+ exports.NODE_OPTIONS = NODE_OPTIONS;
3839
+ exports.NODE_OPTIONS_LABEL_CONTROLS = NODE_OPTIONS_LABEL_CONTROLS;
3840
+ exports.NODE_OPTIONS_NODE_CONTROLS = NODE_OPTIONS_NODE_CONTROLS;
3841
+ exports.NODE_OPTIONS_TEXT_CONTROLS = NODE_OPTIONS_TEXT_CONTROLS;
3842
+ exports.NODE_SETTINGS = NODE_SETTINGS;
3843
+ exports.NODE_SETTINGS_CONTROLS = NODE_SETTINGS_CONTROLS;
3277
3844
  exports.animationByProgress = animationByProgress;
3278
3845
  exports.calculateLinkPositionByNode = calculateLinkPositionByNode;
3846
+ exports.colorGetter = colorGetter;
3279
3847
  exports.colorToRgb = colorToRgb;
3848
+ exports.dragPlaceCoefficientGetter = dragPlaceCoefficientGetter;
3280
3849
  exports.drawText = drawText;
3281
3850
  exports.extractRgb = extractRgb;
3282
3851
  exports.fadeRgb = fadeRgb;
3852
+ exports.forceSettingsGetter = forceSettingsGetter;
3283
3853
  exports.getDrawLink = getDrawLink;
3284
3854
  exports.getDrawNode = getDrawNode;
3285
- exports.getForceControls = getForceControls;
3286
- exports.getGraphControls = getGraphControls;
3287
- exports.getLinkOptionsControls = getLinkOptionsControls;
3288
- exports.getLinkSettingsControls = getLinkSettingsControls;
3289
- exports.getNodeOptionsControls = getNodeOptionsControls;
3290
- exports.getNodeSettingControls = getNodeSettingControls;
3291
3855
  exports.getParticlePosition = getParticlePosition;
3856
+ exports.graphSettingsGetter = graphSettingsGetter;
3857
+ exports.highlightSettingsGetter = highlightSettingsGetter;
3858
+ exports.isNodeVisible = isNodeVisible;
3859
+ exports.isOverlapsNode = isOverlapsNode;
3292
3860
  exports.linkByPointerGetter = linkByPointerGetter;
3861
+ exports.linkFade = linkFade;
3862
+ exports.linkHighlight = linkHighlight;
3293
3863
  exports.linkIterationExtractor = linkIterationExtractor;
3294
3864
  exports.linkOptionsGetter = linkOptionsGetter;
3865
+ exports.linkSettingsGetter = linkSettingsGetter;
3866
+ exports.listenersGetter = listenersGetter;
3295
3867
  exports.nodeByPointerGetter = nodeByPointerGetter;
3868
+ exports.nodeFade = nodeFade;
3869
+ exports.nodeHighlight = nodeHighlight;
3870
+ exports.nodeIdGetter = nodeIdGetter;
3296
3871
  exports.nodeIterationExtractor = nodeIterationExtractor;
3297
3872
  exports.nodeOptionsGetter = nodeOptionsGetter;
3298
3873
  exports.nodeRadiusGetter = nodeRadiusGetter;
3874
+ exports.nodeSettingsGetter = nodeSettingsGetter;
3875
+ exports.nodeSizeGetter = nodeSizeGetter;
3876
+ exports.nodeTextSizeGetter = nodeTextSizeGetter;
3877
+ exports.pointerGetter = pointerGetter;
3299
3878
  exports.rgbAnimationByProgress = rgbAnimationByProgress;
3300
3879
  //# sourceMappingURL=index.cjs.map