@krainovsd/graph 0.10.0-rc4 → 0.10.0-rc6

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 +1909 -1321
  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 +29 -32
  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 +29 -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 +21 -22
  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 -220
  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,
@@ -36,6 +41,7 @@ const FORCE_SETTINGS = {
36
41
  linkStrength: 1,
37
42
  collideRadius: null,
38
43
  };
44
+
39
45
  const GRAPH_SETTINGS = {
40
46
  zoomExtent: [0.3, 10],
41
47
  translateExtent: [[], []],
@@ -48,57 +54,121 @@ const GRAPH_SETTINGS = {
48
54
  showDrawTime: true,
49
55
  showDrawTimeEveryTick: false,
50
56
  };
51
- const NODE_SETTINGS = {
52
- cache: true,
53
- highlightByNodeOnlyRoot: true,
57
+
58
+ const HIGHLIGHT_SETTINGS = {
54
59
  highlightByHoverNode: true,
60
+ highlightByHoverLink: true,
61
+ linkHoverExtraZone: 2,
62
+ /** Node */
63
+ highlightByNodeOnlyRoot: true,
64
+ highlightByNodeForNodeColorFading: false,
65
+ highlightByNodeForNodeColor: null,
66
+ highlightByNodeForNodeSizingAdditional: 0.5,
67
+ highlightByNodeForNodeSizingAdditionalCoefficient: 0.35,
68
+ highlightByNodeForNodeColorFadingMin: 0.15,
69
+ highlightByNodeForNodeFadingMin: 0.21,
70
+ highlightByNodeForNodeBorderColor: null,
71
+ highlightByNodeForNodeBorderSizingAdditional: 0,
72
+ highlightByLinkForNodeColorFading: false,
73
+ highlightByLinkForNodeColor: null,
74
+ highlightByLinkForNodeSizingAdditional: 0.5,
75
+ highlightByLinkForNodeSizingAdditionalCoefficient: 0.35,
76
+ highlightByLinkForNodeColorFadingMin: 0.15,
77
+ highlightByLinkForNodeFadingMin: 0.21,
78
+ highlightByLinkForNodeBorderColor: null,
79
+ highlightByLinkForNodeBorderSizingAdditional: 0,
80
+ /** Text */
81
+ highlightByNodeForTextShiftXAdditional: 0,
82
+ highlightByNodeForTextShiftYAdditional: 2,
83
+ highlightByNodeForTextSizingAdditional: 1,
84
+ highlightByNodeForTextWeightAdditional: 0,
85
+ highlightByNodeForTextFadingMin: 0.21,
86
+ highlightByLinkForTextShiftXAdditional: 0,
87
+ highlightByLinkForTextShiftYAdditional: 2,
88
+ highlightByLinkForTextSizingAdditional: 1,
89
+ highlightByLinkForTextWeightAdditional: 0,
90
+ highlightByLinkForTextFadingMin: 0.21,
91
+ /** Label */
92
+ highlightByNodeForLabelFadingMin: 0.21,
93
+ highlightByNodeForLabelSizingAdditional: 1,
94
+ highlightByNodeForLabelWeightAdditional: 0,
95
+ highlightByLinkForLabelFadingMin: 0.21,
96
+ highlightByLinkForLabelSizingAdditional: 1,
97
+ highlightByLinkForLabelWeightAdditional: 0,
98
+ /** Link */
99
+ highlightByNodeForLinkFadingMin: 0.21,
100
+ highlightByNodeForLinkSizeAdditional: 0,
101
+ highlightByNodeForLinkColor: null,
102
+ highlightByLinkForLinkFadingMin: 0.21,
103
+ highlightByLinkForLinkSizeAdditional: 0,
104
+ highlightByLinkForLinkColor: null,
105
+ /** Arrow */
106
+ highlightByNodeForArrowFadingMin: 0.21,
107
+ highlightByNodeForArrowSizeAdditional: 0,
108
+ highlightByNodeForArrowColor: null,
109
+ highlightByNodeForArrowBorderColor: null,
110
+ highlightByNodeForArrowBorderSizingAdditional: 0,
111
+ highlightByLinkForArrowFadingMin: 0.21,
112
+ highlightByLinkForArrowSizeAdditional: 0,
113
+ highlightByLinkForArrowColor: null,
114
+ highlightByLinkForArrowBorderColor: null,
115
+ highlightByLinkForArrowBorderSizingAdditional: 0,
116
+ };
117
+
118
+ const LINK_SETTINGS = {
119
+ cacheOptions: true,
120
+ prettyDraw: true,
121
+ linkScaleSwitch: 1,
122
+ linkColorAfterScaleSwitch: "#000000FF",
123
+ linkColorBeforeScaleSwitch: "#999",
124
+ linkWidthAfterScaleSwitch: 0.1,
125
+ linkWidthBeforeScaleSwitch: 1,
126
+ arrow: true,
127
+ arrowByHighlight: true,
128
+ particles: true,
129
+ particleFlexSpeed: true,
130
+ particleFlexSpeedCoefficient: 4,
131
+ };
132
+ const LINK_OPTIONS = {
133
+ alpha: 1,
134
+ arrowAlpha: 1,
135
+ arrowSize: 2,
136
+ arrowBorderColor: "#000000FF",
137
+ arrowBorderWidth: 0.1,
138
+ particleAlpha: 1,
139
+ particleColor: "#000000FF",
140
+ particleBorderColor: "#000000FF",
141
+ particleBorderWidth: 0.1,
142
+ particleCount: 2,
143
+ particleRadius: 0.5,
144
+ particleSteps: 60,
145
+ };
146
+
147
+ const NODE_SETTINGS = {
148
+ cacheOptions: true,
55
149
  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
150
  nodeRadiusCoefficient: 5,
69
151
  nodeRadiusFactor: 1,
152
+ nodeSizeFlexible: true,
70
153
  nodeSizeCoefficient: 5,
71
154
  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,
155
+ textScaleMin: 1.5,
156
+ textScaleMax: 18,
157
+ textSizeMin: 3.5,
158
+ textSizeMax: 1.5,
159
+ textShiftYMin: 4,
160
+ textShiftYMax: 2.5,
161
+ textNodeDebug: false,
92
162
  };
93
163
  const NODE_OPTIONS = {
94
- shape: "text",
164
+ shape: "circle",
95
165
  height: 10,
96
166
  width: 15,
97
167
  borderRadius: 0,
98
168
  radius: 4,
99
169
  alpha: 1,
100
- textNodeXPadding: 1,
101
- textNodeYPadding: 1,
170
+ labelXPadding: 1,
171
+ labelYPadding: 1,
102
172
  borderWidth: 0.1,
103
173
  borderColor: "#000000FF",
104
174
  textAlpha: 1,
@@ -110,56 +180,16 @@ const NODE_OPTIONS = {
110
180
  textStyle: "normal",
111
181
  textWeight: 500,
112
182
  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,
183
+ label: null,
184
+ labelAlpha: 1,
185
+ labelAlign: "center",
186
+ labelColor: "#333",
187
+ labelFont: "Arial",
188
+ labelGap: 0,
189
+ labelSize: 3.5,
190
+ labelStyle: "normal",
191
+ labelWeight: 500,
192
+ labelWidth: 20,
163
193
  };
164
194
 
165
195
  function forceSettingsGetter(settings, prevSettings) {
@@ -179,20 +209,20 @@ function graphSettingsGetter(settings, prevSettings) {
179
209
  function linkSettingsGetter(settings, prevSettings) {
180
210
  return { ...(prevSettings ?? LINK_SETTINGS), ...settings };
181
211
  }
182
- function linkOptionsGetter(_, __, ___, state) {
212
+ function linkOptionsGetter() {
183
213
  return {
184
214
  ...LINK_OPTIONS,
185
215
  drawExtraLink: null,
186
216
  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,
217
+ color: this.areaTransform && this.areaTransform.k > this.linkSettings.linkScaleSwitch
218
+ ? this.linkSettings.linkColorAfterScaleSwitch
219
+ : this.linkSettings.linkColorBeforeScaleSwitch,
220
+ arrowColor: this.areaTransform && this.areaTransform.k > this.linkSettings.linkScaleSwitch
221
+ ? this.linkSettings.linkColorAfterScaleSwitch
222
+ : this.linkSettings.linkColorBeforeScaleSwitch,
223
+ width: this.areaTransform && this.areaTransform.k > this.linkSettings.linkScaleSwitch
224
+ ? this.linkSettings.linkWidthAfterScaleSwitch
225
+ : this.linkSettings.linkWidthBeforeScaleSwitch,
196
226
  };
197
227
  }
198
228
 
@@ -278,917 +308,6 @@ function rgbAnimationByProgress(start, end, progress) {
278
308
  };
279
309
  }
280
310
 
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
311
  let countTime = 0;
1193
312
  let countOperation = 0;
1194
313
  function setDrawTime(cb, showEveryTick) {
@@ -1224,8 +343,8 @@ function nodeSettingsGetter(settings, prevNodeSettings) {
1224
343
  };
1225
344
  }
1226
345
  const color = colorGetter();
1227
- function nodeOptionsGetter(node, _, __, state) {
1228
- const { textShiftY, textSize } = nodeTextSizeGetter(state?.areaTransform);
346
+ function nodeOptionsGetter(node) {
347
+ const { textShiftY, textSize } = nodeTextSizeGetter(this.areaTransform, this.nodeSettings);
1229
348
  return {
1230
349
  ...NODE_OPTIONS,
1231
350
  nodeDraw: null,
@@ -1233,30 +352,31 @@ function nodeOptionsGetter(node, _, __, state) {
1233
352
  textDraw: null,
1234
353
  textExtraDraw: null,
1235
354
  color: color(String(node.group ?? "_DEFAULT")),
1236
- textVisible: Boolean(state?.areaTransform && state.areaTransform.k > COMMON_SETTINGS.nodeTextScaleMin),
355
+ textVisible: Boolean(this.areaTransform.k > this.nodeSettings.textScaleMin),
1237
356
  text: node.name ?? node.id.toString(),
1238
357
  textShiftY,
1239
358
  textSize,
1240
359
  };
1241
360
  }
1242
- function nodeTextSizeGetter(transform) {
1243
- let textSize = COMMON_SETTINGS.nodeTextSizeMax;
1244
- let textShiftY = COMMON_SETTINGS.nodeTextShiftYMax;
361
+ function nodeTextSizeGetter(transform, nodeSettings) {
362
+ let textSize = nodeSettings.textSizeMin;
363
+ let textShiftY = nodeSettings.textShiftYMin;
1245
364
  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;
365
+ if (transform.k >= nodeSettings.textScaleMax) {
366
+ textSize = nodeSettings.textSizeMax;
367
+ textShiftY = nodeSettings.textShiftYMax;
368
+ }
369
+ else if (transform.k > nodeSettings.textScaleMin) {
370
+ textSize =
371
+ nodeSettings.textSizeMin +
372
+ ((transform.k - nodeSettings.textScaleMin) *
373
+ (nodeSettings.textSizeMax - nodeSettings.textSizeMin)) /
374
+ (nodeSettings.textScaleMax - nodeSettings.textScaleMin);
375
+ textShiftY =
376
+ nodeSettings.textShiftYMin +
377
+ ((transform.k - nodeSettings.textScaleMin) *
378
+ (nodeSettings.textShiftYMax - nodeSettings.textShiftYMin)) /
379
+ (nodeSettings.textScaleMax - nodeSettings.textScaleMin);
1260
380
  }
1261
381
  }
1262
382
  return { textSize, textShiftY };
@@ -1279,6 +399,13 @@ function nodeIdGetter(node) {
1279
399
  return node.id;
1280
400
  }
1281
401
 
402
+ function highlightSettingsGetter(settings, prevSettings) {
403
+ return {
404
+ ...(prevSettings ?? HIGHLIGHT_SETTINGS),
405
+ ...settings,
406
+ };
407
+ }
408
+
1282
409
  function pointerGetter(mouseEvent, areaRect, areaTransform) {
1283
410
  const clientX = "clientX" in mouseEvent
1284
411
  ? mouseEvent.clientX
@@ -1359,7 +486,7 @@ function linkIterationExtractor(link, i, links, state, option, optionConstantGet
1359
486
  let customOptions;
1360
487
  let constantOptions;
1361
488
  if (typeof option === "function")
1362
- customOptions = option(link, i, links, state);
489
+ customOptions = option.call(state, link, i, links);
1363
490
  else
1364
491
  customOptions = option;
1365
492
  if (customOptions && typeof customOptions === "object" && !Array.isArray(customOptions)) {
@@ -1370,7 +497,7 @@ function linkIterationExtractor(link, i, links, state, option, optionConstantGet
1370
497
  }
1371
498
  if (optionConstantGetter) {
1372
499
  if (typeof optionConstantGetter === "function")
1373
- constantOptions = optionConstantGetter(link, i, links, state);
500
+ constantOptions = optionConstantGetter.call(state, link, i, links);
1374
501
  else
1375
502
  constantOptions = optionConstantGetter;
1376
503
  if (constantOptions &&
@@ -1401,7 +528,7 @@ function nodeIterationExtractor(node, i, nodes, state, option, optionConstantGet
1401
528
  let customOptions;
1402
529
  let constantOptions;
1403
530
  if (typeof option === "function")
1404
- customOptions = option(node, i, nodes, state);
531
+ customOptions = option.call(state, node, i, nodes);
1405
532
  else
1406
533
  customOptions = option;
1407
534
  if (customOptions && typeof customOptions === "object" && !Array.isArray(customOptions)) {
@@ -1412,7 +539,7 @@ function nodeIterationExtractor(node, i, nodes, state, option, optionConstantGet
1412
539
  }
1413
540
  if (optionConstantGetter) {
1414
541
  if (typeof optionConstantGetter === "function")
1415
- constantOptions = optionConstantGetter(node, i, nodes, state);
542
+ constantOptions = optionConstantGetter.call(state, node, i, nodes);
1416
543
  else
1417
544
  constantOptions = optionConstantGetter;
1418
545
  if (constantOptions &&
@@ -1429,6 +556,7 @@ function nodeIterationExtractor(node, i, nodes, state, option, optionConstantGet
1429
556
  return customOptions;
1430
557
  }
1431
558
 
559
+ /* eslint-disable id-length */
1432
560
  function calculateLinkPositionByNode(link, arrowSize = 0) {
1433
561
  const source = link.source;
1434
562
  const target = link.target;
@@ -1469,7 +597,8 @@ function getLinkPoint(opts) {
1469
597
  nodePoint = getCircleIntersection({
1470
598
  x: opts.node.x,
1471
599
  y: opts.node.y,
1472
- radius: opts.node._radius ?? COMMON_SETTINGS.nodeRadius,
600
+ radius: (opts.node._radius ?? COMMON_SETTINGS.nodeRadius) +
601
+ (opts.node._borderWidth ? opts.node._borderWidth / 2 : 0),
1473
602
  oppositeX: opts.oppositeNode.x,
1474
603
  oppositeY: opts.oppositeNode.y,
1475
604
  arrowSize: opts.arrowSize,
@@ -1482,8 +611,8 @@ function getLinkPoint(opts) {
1482
611
  arrowSize: opts.arrowSize,
1483
612
  x: opts.node.x,
1484
613
  y: opts.node.y,
1485
- height: opts.node._height ?? COMMON_SETTINGS.nodeSize,
1486
- width: opts.node._width ?? COMMON_SETTINGS.nodeSize,
614
+ height: (opts.node._height ?? COMMON_SETTINGS.nodeSize) + (opts.node._borderWidth ?? 0),
615
+ width: (opts.node._width ?? COMMON_SETTINGS.nodeSize) + (opts.node._borderWidth ?? 0),
1487
616
  oppositeX: opts.oppositeNode.x,
1488
617
  oppositeY: opts.oppositeNode.y,
1489
618
  borderRadius: opts.node._shape === "text" ? 0 : (opts.node._borderRadius ?? 0),
@@ -1778,12 +907,12 @@ function getParticlePosition(opts) {
1778
907
  }
1779
908
 
1780
909
  /* eslint-disable id-length */
1781
- function linkByPointerGetter({ areaRect, areaTransform, mouseEvent, links, linkSettings, }) {
910
+ function linkByPointerGetter({ areaRect, areaTransform, mouseEvent, links, linkHoverExtraZone, }) {
1782
911
  if (!areaRect)
1783
912
  return undefined;
1784
913
  const [pointerX, pointerY] = pointerGetter(mouseEvent, areaRect, areaTransform);
1785
914
  return d3Array.greatest(links, (link) => {
1786
- if (isNearLink(pointerX, pointerY, link, linkSettings.hoverLinkThreshold))
915
+ if (isNearLink(pointerX, pointerY, link, linkHoverExtraZone))
1787
916
  return link.index;
1788
917
  });
1789
918
  }
@@ -1826,6 +955,172 @@ function distanceToLine(x, y, x1, y1, x2, y2) {
1826
955
  return Math.sqrt(dx * dx + dy * dy);
1827
956
  }
1828
957
 
958
+ function nodeHighlight(opts) {
959
+ let color = opts.nodeOptions.color;
960
+ let borderColor = opts.nodeOptions.borderColor;
961
+ let borderWidth = opts.nodeOptions.borderWidth;
962
+ let radiusInitial = opts.nodeOptions.radius;
963
+ let widthInitial = opts.nodeOptions.width;
964
+ let heightInitial = opts.nodeOptions.height;
965
+ let textSize = opts.nodeOptions.textSize;
966
+ let textShiftX = opts.nodeOptions.textShiftX;
967
+ let textShiftY = opts.nodeOptions.textShiftY;
968
+ let textWeight = opts.nodeOptions.textWeight;
969
+ let labelSize = opts.nodeOptions.labelSize;
970
+ let labelWeight = opts.nodeOptions.labelWeight;
971
+ let sizeCoefficient = 1;
972
+ if (opts.highlightForNodeColor) {
973
+ /** Color */
974
+ const colorRgb = extractRgb(colorToRgb(color));
975
+ const colorRgbHighlight = extractRgb(colorToRgb(opts.highlightForNodeColor));
976
+ if (colorRgb && colorRgbHighlight) {
977
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbHighlight, opts.highlightProgress);
978
+ color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
979
+ }
980
+ }
981
+ if (opts.nodeOptions.shape === "circle") {
982
+ /** Radius */
983
+ radiusInitial = animationByProgress(radiusInitial, opts.highlightForNodeSizingAdditional, opts.highlightProgress);
984
+ }
985
+ if (opts.nodeOptions.shape === "square" || opts.nodeOptions.shape === "text") {
986
+ /** Size */
987
+ sizeCoefficient = animationByProgress(sizeCoefficient, opts.highlightForNodeSizingAdditionalCoefficient, opts.highlightProgress);
988
+ widthInitial *= sizeCoefficient;
989
+ heightInitial *= sizeCoefficient;
990
+ }
991
+ if (opts.highlightForNodeBorderColor) {
992
+ /** Border Color */
993
+ const colorRgb = extractRgb(colorToRgb(borderColor));
994
+ const colorRgbHighlight = extractRgb(colorToRgb(opts.highlightForNodeBorderColor));
995
+ if (colorRgb && colorRgbHighlight) {
996
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbHighlight, opts.highlightProgress);
997
+ borderColor = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
998
+ }
999
+ }
1000
+ /** Border Width */
1001
+ borderWidth = animationByProgress(borderWidth, opts.highlightForNodeBorderSizingAdditional, opts.highlightProgress);
1002
+ /** Text Size */
1003
+ textSize = animationByProgress(textSize, opts.highlightForTextSizingAdditional, opts.highlightProgress);
1004
+ /** Text Shift X */
1005
+ textShiftX = animationByProgress(textShiftX, opts.highlightForTextShiftXAdditional, opts.highlightProgress);
1006
+ /** Text Shift Y */
1007
+ textShiftY = animationByProgress(textShiftY, opts.highlightForTextShiftYAdditional, opts.highlightProgress);
1008
+ /** Text Weight */
1009
+ textWeight = animationByProgress(textWeight, opts.highlightForTextWeightAdditional, opts.highlightProgress);
1010
+ if (opts.nodeOptions.label) {
1011
+ /** Label Size */
1012
+ labelSize = animationByProgress(labelSize, opts.highlightForLabelSizingAdditional, opts.highlightProgress);
1013
+ /** Label Weight */
1014
+ labelWeight = animationByProgress(labelWeight, opts.highlightForLabelWeightAdditional, opts.highlightProgress);
1015
+ }
1016
+ return {
1017
+ color,
1018
+ borderColor,
1019
+ borderWidth,
1020
+ radiusInitial,
1021
+ widthInitial,
1022
+ heightInitial,
1023
+ textSize,
1024
+ textShiftX,
1025
+ textShiftY,
1026
+ textWeight,
1027
+ labelSize,
1028
+ labelWeight,
1029
+ sizeCoefficient,
1030
+ };
1031
+ }
1032
+ function nodeFade(opts) {
1033
+ let alpha = opts.nodeOptions.alpha;
1034
+ let color = opts.nodeOptions.color;
1035
+ let textAlpha = opts.nodeOptions.textAlpha;
1036
+ let labelAlpha = opts.nodeOptions.labelAlpha;
1037
+ /** Alpha */
1038
+ const alphaMin = opts.highlightForNodeFadingMin < alpha ? opts.highlightForNodeFadingMin : alpha;
1039
+ alpha = animationByProgress(alphaMin, alpha - alphaMin, 1 - opts.highlightProgress);
1040
+ /** Text Alpha */
1041
+ const textAlphaMin = opts.highlightForTextFadingMin < textAlpha ? opts.highlightForTextFadingMin : textAlpha;
1042
+ textAlpha = animationByProgress(textAlphaMin, textAlpha - textAlphaMin, 1 - opts.highlightProgress);
1043
+ if (opts.nodeOptions.label) {
1044
+ /** Label Alpha */
1045
+ const labelAlphaMin = opts.highlightForLabelFadingMin < labelAlpha ? opts.highlightForLabelFadingMin : labelAlpha;
1046
+ labelAlpha = animationByProgress(labelAlphaMin, labelAlpha - labelAlphaMin, 1 - opts.highlightProgress);
1047
+ }
1048
+ if (opts.highlightForNodeColorFading) {
1049
+ /** Color Fading */
1050
+ const colorRgb = extractRgb(colorToRgb(color));
1051
+ if (colorRgb) {
1052
+ const colorRgbFade = fadeRgb(colorRgb, opts.highlightForNodeColorFadingMin);
1053
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbFade, opts.highlightProgress);
1054
+ color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
1055
+ }
1056
+ }
1057
+ return {
1058
+ alpha,
1059
+ color,
1060
+ textAlpha,
1061
+ labelAlpha,
1062
+ };
1063
+ }
1064
+
1065
+ function linkHighlight(opts) {
1066
+ const arrowVisible = opts.arrow && !opts.arrowByHighlight;
1067
+ let arrowAlpha = opts.arrowByHighlight ? 0 : opts.linkOptions.arrowAlpha;
1068
+ let color = opts.linkOptions.color;
1069
+ let width = opts.linkOptions.width;
1070
+ let arrowColor = opts.linkOptions.arrowColor;
1071
+ let arrowSize = opts.linkOptions.arrowSize;
1072
+ let arrowBorderWidth = opts.linkOptions.arrowBorderWidth;
1073
+ let arrowBorderColor = opts.linkOptions.arrowBorderColor;
1074
+ if (opts.arrow && opts.arrowByHighlight) {
1075
+ /** Highlighted */
1076
+ arrowAlpha = animationByProgress(0, opts.linkOptions.arrowAlpha, opts.highlightProgress);
1077
+ }
1078
+ if (opts.highlightForLinkColor) {
1079
+ /** Color */
1080
+ const colorRgb = extractRgb(colorToRgb(color));
1081
+ const colorRgbHighlight = extractRgb(colorToRgb(opts.highlightForLinkColor));
1082
+ if (colorRgb && colorRgbHighlight) {
1083
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbHighlight, opts.highlightProgress);
1084
+ color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
1085
+ }
1086
+ }
1087
+ if (opts.highlightForArrowColor && arrowVisible) {
1088
+ /** Arrow Color */
1089
+ const colorRgb = extractRgb(colorToRgb(arrowColor));
1090
+ const colorRgbHighlight = extractRgb(colorToRgb(opts.highlightForArrowColor));
1091
+ if (colorRgb && colorRgbHighlight) {
1092
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbHighlight, opts.highlightProgress);
1093
+ arrowColor = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
1094
+ }
1095
+ }
1096
+ if (opts.highlightForArrowBorderColor && arrowVisible) {
1097
+ /** Arrow Border Color */
1098
+ const colorRgb = extractRgb(colorToRgb(arrowBorderColor));
1099
+ const colorRgbHighlight = extractRgb(colorToRgb(opts.highlightForArrowBorderColor));
1100
+ if (colorRgb && colorRgbHighlight) {
1101
+ const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbHighlight, opts.highlightProgress);
1102
+ arrowBorderColor = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
1103
+ }
1104
+ }
1105
+ width = animationByProgress(width, opts.highlightForLinkSizeAdditional, opts.highlightProgress);
1106
+ if (arrowVisible) {
1107
+ arrowSize = animationByProgress(arrowSize, opts.highlightForArrowSizeAdditional, opts.highlightProgress);
1108
+ arrowBorderWidth = animationByProgress(arrowBorderWidth, opts.highlightForArrowBorderSizingAdditional, opts.highlightProgress);
1109
+ }
1110
+ return { arrowAlpha, color, width, arrowColor, arrowSize, arrowBorderWidth, arrowBorderColor };
1111
+ }
1112
+ function linkFade(opts) {
1113
+ let alpha = opts.linkOptions.alpha;
1114
+ let arrowAlpha = opts.arrowByHighlight ? 0 : opts.linkOptions.arrowAlpha;
1115
+ const alphaMin = opts.highlightForLinkFadingMin < alpha ? opts.highlightForLinkFadingMin : alpha;
1116
+ alpha = animationByProgress(alphaMin, alpha - alphaMin, 1 - opts.highlightProgress);
1117
+ if (opts.arrow && !opts.arrowByHighlight) {
1118
+ const arrowAlphaMin = opts.highlightForArrowFadingMin < arrowAlpha ? opts.highlightForArrowFadingMin : arrowAlpha;
1119
+ arrowAlpha = animationByProgress(arrowAlphaMin, arrowAlpha - arrowAlphaMin, 1 - opts.highlightProgress);
1120
+ }
1121
+ return { alpha, arrowAlpha };
1122
+ }
1123
+
1829
1124
  function initArea() {
1830
1125
  if (!this.area || !this.context || !this.container) {
1831
1126
  this.container = d3Selection.create("div")
@@ -1859,7 +1154,7 @@ function initDnd() {
1859
1154
  const dragHandler = d3Drag.drag()
1860
1155
  .subject((event) => {
1861
1156
  if (this.listeners.onDragSubject) {
1862
- return this.listeners.onDragSubject(event, this.state);
1157
+ return this.listeners.onDragSubject.call(this, event);
1863
1158
  }
1864
1159
  if (!this.areaRect)
1865
1160
  return;
@@ -1872,7 +1167,7 @@ function initDnd() {
1872
1167
  });
1873
1168
  })
1874
1169
  .on("start", (event) => {
1875
- this.listeners.onStartDragFinished?.(event, this.state);
1170
+ this.listeners.onStartDragFinished?.call?.(this, event);
1876
1171
  })
1877
1172
  .on("drag", (event) => {
1878
1173
  if (!this.isDragging) {
@@ -1886,7 +1181,7 @@ function initDnd() {
1886
1181
  const [pointerX, pointerY] = pointerGetter(mouseEvent, this.areaRect, this.areaTransform);
1887
1182
  event.subject.fx = pointerX;
1888
1183
  event.subject.fy = pointerY;
1889
- this.listeners.onMoveDragFinished?.(event, this.state);
1184
+ this.listeners.onMoveDragFinished?.call?.(this, event);
1890
1185
  })
1891
1186
  .on("end", (event) => {
1892
1187
  this.isDragging = false;
@@ -1902,12 +1197,12 @@ function initDnd() {
1902
1197
  event.subject.fx = null;
1903
1198
  event.subject.fy = null;
1904
1199
  }
1905
- this.listeners.onEndDragFinished?.(event, this.state);
1200
+ this.listeners.onEndDragFinished?.call?.(this, event);
1906
1201
  });
1907
1202
  d3Selection.select(this.area).call(dragHandler);
1908
1203
  }
1909
1204
 
1910
- function getDrawLink(state) {
1205
+ function getDrawLink() {
1911
1206
  return function drawLink(link, index) {
1912
1207
  if (!this.context ||
1913
1208
  typeof link.source !== "object" ||
@@ -1921,88 +1216,114 @@ function getDrawLink(state) {
1921
1216
  return;
1922
1217
  const id = `${link.target.id}${link.source.id}`;
1923
1218
  let linkOptions;
1924
- if (this.linkSettings.cache && this.linkOptionsCache[id]) {
1219
+ if (this.linkSettings.cacheOptions && this.linkOptionsCache[id]) {
1925
1220
  linkOptions = this.linkOptionsCache[id];
1926
1221
  }
1927
1222
  else {
1928
- linkOptions = linkIterationExtractor(link, index, this.links, state, this.linkSettings.options ?? {}, linkOptionsGetter);
1929
- if (this.linkSettings.cache) {
1223
+ linkOptions = linkIterationExtractor(link, index, this.links, this, this.linkSettings.options ?? {}, linkOptionsGetter);
1224
+ if (this.linkSettings.cacheOptions) {
1930
1225
  this.linkOptionsCache[id] = linkOptions;
1931
1226
  }
1932
1227
  }
1933
1228
  if (linkOptions.drawLink) {
1934
- linkOptions.drawLink(link, linkOptions, state);
1229
+ linkOptions.drawLink.call(this, link, linkOptions);
1935
1230
  return;
1936
1231
  }
1937
1232
  let alpha = linkOptions.alpha;
1233
+ let color = linkOptions.color;
1234
+ let width = linkOptions.width;
1938
1235
  let arrowAlpha = this.linkSettings.arrowByHighlight ? 0 : linkOptions.arrowAlpha;
1939
- /** NODE HIGHLIGHT */
1236
+ let arrowColor = linkOptions.arrowColor;
1237
+ let arrowSize = linkOptions.arrowSize;
1238
+ let arrowBorderWidth = linkOptions.arrowBorderWidth;
1239
+ let arrowBorderColor = linkOptions.arrowBorderColor;
1240
+ /** Highlight */
1940
1241
  if (this.highlightedNeighbors && this.highlightedNode) {
1941
- /** Not highlighted */
1242
+ /** By Node Not Highlight */
1942
1243
  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
- }
1244
+ const fadeOptions = linkFade({
1245
+ arrow: this.linkSettings.arrow,
1246
+ arrowByHighlight: this.linkSettings.arrowByHighlight,
1247
+ linkOptions,
1248
+ highlightProgress: this.highlightProgress,
1249
+ highlightForArrowFadingMin: this.highlightSettings.highlightByNodeForArrowFadingMin,
1250
+ highlightForLinkFadingMin: this.highlightSettings.highlightByNodeForLinkFadingMin,
1251
+ });
1252
+ alpha = fadeOptions.alpha;
1253
+ arrowAlpha = fadeOptions.arrowAlpha;
1957
1254
  }
1958
1255
  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
- }
1256
+ const highlightOptions = linkHighlight({
1257
+ arrow: this.linkSettings.arrow,
1258
+ arrowByHighlight: this.linkSettings.arrowByHighlight,
1259
+ linkOptions,
1260
+ highlightProgress: this.highlightProgress,
1261
+ highlightForArrowBorderColor: this.highlightSettings.highlightByNodeForArrowBorderColor,
1262
+ highlightForArrowBorderSizingAdditional: this.highlightSettings.highlightByNodeForArrowBorderSizingAdditional,
1263
+ highlightForArrowColor: this.highlightSettings.highlightByNodeForArrowColor,
1264
+ highlightForArrowSizeAdditional: this.highlightSettings.highlightByNodeForArrowSizeAdditional,
1265
+ highlightForLinkColor: this.highlightSettings.highlightByNodeForLinkColor,
1266
+ highlightForLinkSizeAdditional: this.highlightSettings.highlightByNodeForLinkSizeAdditional,
1267
+ });
1268
+ arrowAlpha = highlightOptions.arrowAlpha;
1269
+ color = highlightOptions.color;
1270
+ width = highlightOptions.width;
1271
+ arrowColor = highlightOptions.arrowColor;
1272
+ arrowSize = highlightOptions.arrowSize;
1273
+ arrowBorderWidth = highlightOptions.arrowBorderWidth;
1274
+ arrowBorderColor = highlightOptions.arrowBorderColor;
1964
1275
  }
1965
1276
  }
1966
- /** LINK HIGHLIGHT */
1967
1277
  if (this.highlightedNeighbors && this.highlightedLink) {
1968
- /** Not highlighted */
1278
+ /** By Link Not Highlight */
1969
1279
  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
- }
1280
+ const fadeOptions = linkFade({
1281
+ arrow: this.linkSettings.arrow,
1282
+ arrowByHighlight: this.linkSettings.arrowByHighlight,
1283
+ linkOptions,
1284
+ highlightProgress: this.highlightProgress,
1285
+ highlightForArrowFadingMin: this.highlightSettings.highlightByLinkForArrowFadingMin,
1286
+ highlightForLinkFadingMin: this.highlightSettings.highlightByLinkForLinkFadingMin,
1287
+ });
1288
+ alpha = fadeOptions.alpha;
1289
+ arrowAlpha = fadeOptions.arrowAlpha;
1984
1290
  }
1985
1291
  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
- }
1292
+ /** By Link Highlight */
1293
+ const highlightOptions = linkHighlight({
1294
+ arrow: this.linkSettings.arrow,
1295
+ arrowByHighlight: this.linkSettings.arrowByHighlight,
1296
+ linkOptions,
1297
+ highlightProgress: this.highlightProgress,
1298
+ highlightForArrowBorderColor: this.highlightSettings.highlightByLinkForArrowBorderColor,
1299
+ highlightForArrowBorderSizingAdditional: this.highlightSettings.highlightByLinkForArrowBorderSizingAdditional,
1300
+ highlightForArrowColor: this.highlightSettings.highlightByLinkForArrowColor,
1301
+ highlightForArrowSizeAdditional: this.highlightSettings.highlightByLinkForArrowSizeAdditional,
1302
+ highlightForLinkColor: this.highlightSettings.highlightByLinkForLinkColor,
1303
+ highlightForLinkSizeAdditional: this.highlightSettings.highlightByLinkForLinkSizeAdditional,
1304
+ });
1305
+ arrowAlpha = highlightOptions.arrowAlpha;
1306
+ color = highlightOptions.color;
1307
+ width = highlightOptions.width;
1308
+ arrowColor = highlightOptions.arrowColor;
1309
+ arrowSize = highlightOptions.arrowSize;
1310
+ arrowBorderWidth = highlightOptions.arrowBorderWidth;
1311
+ arrowBorderColor = highlightOptions.arrowBorderColor;
1991
1312
  }
1992
1313
  }
1993
1314
  /** Link */
1994
1315
  this.context.beginPath();
1995
1316
  this.context.globalAlpha = alpha;
1996
- this.context.strokeStyle = linkOptions.color;
1997
- this.context.lineWidth = linkOptions.width;
1317
+ this.context.strokeStyle = color;
1318
+ this.context.lineWidth = width;
1998
1319
  let xStart = link.source.x;
1999
1320
  let yStart = link.source.y;
2000
1321
  let xEnd = link.target.x;
2001
1322
  let yEnd = link.target.y;
2002
1323
  let linkDistance = 0;
2003
- if (this.linkSettings.pretty || this.linkSettings.particleFlexSpeed) {
1324
+ if (this.linkSettings.prettyDraw || this.linkSettings.particleFlexSpeed) {
2004
1325
  const isHasArrow = this.linkSettings.arrow && arrowAlpha > 0;
2005
- const position = calculateLinkPositionByNode(link, isHasArrow ? linkOptions.arrowSize : 0);
1326
+ const position = calculateLinkPositionByNode(link, isHasArrow ? arrowSize : 0);
2006
1327
  if (position) {
2007
1328
  xStart = position.x1;
2008
1329
  xEnd = position.x2;
@@ -2072,7 +1393,9 @@ function getDrawLink(state) {
2072
1393
  this.context.arc(particle.x, particle.y, linkOptions.particleRadius, 0, Math.PI * 2);
2073
1394
  this.context.fillStyle = linkOptions.particleColor;
2074
1395
  this.context.fill();
2075
- this.context.stroke();
1396
+ if (linkOptions.particleBorderWidth > 0) {
1397
+ this.context.stroke();
1398
+ }
2076
1399
  }
2077
1400
  });
2078
1401
  }
@@ -2087,19 +1410,21 @@ function getDrawLink(state) {
2087
1410
  };
2088
1411
  this.context.beginPath();
2089
1412
  this.context.globalAlpha = arrowAlpha;
2090
- this.context.strokeStyle = linkOptions.arrowBorderColor;
2091
- this.context.lineWidth = linkOptions.arrowBorderWidth;
2092
- this.context.fillStyle = linkOptions.arrowColor;
1413
+ this.context.strokeStyle = arrowBorderColor;
1414
+ this.context.lineWidth = arrowBorderWidth;
1415
+ this.context.fillStyle = arrowColor;
2093
1416
  const angle = Math.atan2(yEnd - yStart, xEnd - xStart);
2094
1417
  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));
1418
+ this.context.lineTo(xEnd - arrowSize * Math.cos(angle - Math.PI / 6), yEnd - arrowSize * Math.sin(angle - Math.PI / 6));
1419
+ this.context.lineTo(xEnd - arrowSize * Math.cos(angle + Math.PI / 6), yEnd - arrowSize * Math.sin(angle + Math.PI / 6));
2097
1420
  this.context.closePath();
2098
1421
  this.context.fill();
2099
- this.context.stroke();
1422
+ if (arrowBorderWidth > 0) {
1423
+ this.context.stroke();
1424
+ }
2100
1425
  }
2101
1426
  if (linkOptions.drawExtraLink) {
2102
- linkOptions.drawExtraLink(link, { ...linkOptions, alpha }, state);
1427
+ linkOptions.drawExtraLink.call(this, link, { ...linkOptions, alpha });
2103
1428
  }
2104
1429
  };
2105
1430
  }
@@ -2172,17 +1497,17 @@ function getTextLines({ context, textAlign, textColor, textFont, textStyle, text
2172
1497
  return { lines, currentMaxSize };
2173
1498
  }
2174
1499
 
2175
- function getDrawNode(nodeRenders, textRenders, state) {
1500
+ function getDrawNode(nodeRenders, textRenders) {
2176
1501
  return function drawNode(node, index) {
2177
1502
  if (!this.context || !node.x || !node.y)
2178
1503
  return;
2179
1504
  let nodeOptions;
2180
- if (this.nodeSettings.cache && this.nodeOptionsCache[node.id]) {
1505
+ if (this.nodeSettings.cacheOptions && this.nodeOptionsCache[node.id]) {
2181
1506
  nodeOptions = this.nodeOptionsCache[node.id];
2182
1507
  }
2183
1508
  else {
2184
- nodeOptions = nodeIterationExtractor(node, index, this.nodes, state, this.nodeSettings.options ?? {}, nodeOptionsGetter);
2185
- if (this.nodeSettings.cache) {
1509
+ nodeOptions = nodeIterationExtractor(node, index, this.nodes, this, this.nodeSettings.options ?? {}, nodeOptionsGetter);
1510
+ if (this.nodeSettings.cacheOptions) {
2186
1511
  this.nodeOptionsCache[node.id] = nodeOptions;
2187
1512
  }
2188
1513
  }
@@ -2201,6 +1526,8 @@ function getDrawNode(nodeRenders, textRenders, state) {
2201
1526
  }
2202
1527
  let alpha = nodeOptions.alpha;
2203
1528
  let color = nodeOptions.color;
1529
+ let borderColor = nodeOptions.borderColor;
1530
+ let borderWidth = nodeOptions.borderWidth;
2204
1531
  let radiusInitial = nodeOptions.radius;
2205
1532
  let widthInitial = nodeOptions.width;
2206
1533
  let heightInitial = nodeOptions.height;
@@ -2209,101 +1536,107 @@ function getDrawNode(nodeRenders, textRenders, state) {
2209
1536
  let textShiftX = nodeOptions.textShiftX;
2210
1537
  let textShiftY = nodeOptions.textShiftY;
2211
1538
  let textWeight = nodeOptions.textWeight;
2212
- let textWidth = nodeOptions.textWidth;
2213
- let sizeCoefficient = 1;
2214
- /** Node Highlight */
1539
+ let labelSize = nodeOptions.labelSize;
1540
+ let labelWeight = nodeOptions.labelWeight;
1541
+ let labelAlpha = nodeOptions.labelAlpha;
1542
+ /** Highlight */
2215
1543
  if (this.highlightedNeighbors && this.highlightedNode) {
2216
- /** Not highlighted */
1544
+ /** By Node Not Highlight */
2217
1545
  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
- }
1546
+ const fadingOptions = nodeFade({
1547
+ highlightProgress: this.highlightProgress,
1548
+ nodeOptions,
1549
+ highlightForLabelFadingMin: this.highlightSettings.highlightByNodeForLabelFadingMin,
1550
+ highlightForNodeColorFading: this.highlightSettings.highlightByNodeForNodeColorFading,
1551
+ highlightForNodeColorFadingMin: this.highlightSettings.highlightByNodeForNodeColorFadingMin,
1552
+ highlightForNodeFadingMin: this.highlightSettings.highlightByNodeForNodeFadingMin,
1553
+ highlightForTextFadingMin: this.highlightSettings.highlightByNodeForTextFadingMin,
1554
+ });
1555
+ alpha = fadingOptions.alpha;
1556
+ color = fadingOptions.color;
1557
+ textAlpha = fadingOptions.textAlpha;
1558
+ labelAlpha = fadingOptions.labelAlpha;
2238
1559
  }
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
- }
1560
+ else if (!this.highlightSettings.highlightByNodeOnlyRoot ||
1561
+ (this.highlightSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)) {
1562
+ /** By Node Highlight */
1563
+ const highlightOptions = nodeHighlight({
1564
+ highlightProgress: this.highlightProgress,
1565
+ nodeOptions,
1566
+ highlightForLabelSizingAdditional: this.highlightSettings.highlightByNodeForLabelSizingAdditional,
1567
+ highlightForLabelWeightAdditional: this.highlightSettings.highlightByNodeForLabelWeightAdditional,
1568
+ highlightForNodeBorderColor: this.highlightSettings.highlightByNodeForNodeBorderColor,
1569
+ highlightForNodeBorderSizingAdditional: this.highlightSettings.highlightByNodeForNodeBorderSizingAdditional,
1570
+ highlightForNodeColor: this.highlightSettings.highlightByNodeForNodeColor,
1571
+ highlightForNodeSizingAdditional: this.highlightSettings.highlightByNodeForNodeSizingAdditional,
1572
+ highlightForNodeSizingAdditionalCoefficient: this.highlightSettings.highlightByNodeForNodeSizingAdditionalCoefficient,
1573
+ highlightForTextShiftXAdditional: this.highlightSettings.highlightByNodeForTextShiftXAdditional,
1574
+ highlightForTextShiftYAdditional: this.highlightSettings.highlightByNodeForTextShiftYAdditional,
1575
+ highlightForTextSizingAdditional: this.highlightSettings.highlightByNodeForTextSizingAdditional,
1576
+ highlightForTextWeightAdditional: this.highlightSettings.highlightByNodeForTextWeightAdditional,
1577
+ });
1578
+ color = highlightOptions.color;
1579
+ borderColor = highlightOptions.borderColor;
1580
+ borderWidth = highlightOptions.borderWidth;
1581
+ radiusInitial = highlightOptions.radiusInitial;
1582
+ widthInitial = highlightOptions.widthInitial;
1583
+ heightInitial = highlightOptions.heightInitial;
1584
+ textSize = highlightOptions.textSize;
1585
+ textShiftX = highlightOptions.textShiftX;
1586
+ textShiftY = highlightOptions.textShiftY;
1587
+ textWeight = highlightOptions.textWeight;
1588
+ labelSize = highlightOptions.labelSize;
1589
+ labelWeight = highlightOptions.labelWeight;
2258
1590
  }
2259
1591
  }
2260
- /** LinkHighlight */
2261
1592
  if (this.highlightedNeighbors && this.highlightedLink) {
2262
- /** Not highlighted */
1593
+ /** By Link Not Highlight */
2263
1594
  if (!this.highlightedNeighbors.has(node.id) &&
2264
1595
  this.highlightedLink.source !== node &&
2265
1596
  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
- }
1597
+ const fadingOptions = nodeFade({
1598
+ highlightProgress: this.highlightProgress,
1599
+ nodeOptions,
1600
+ highlightForLabelFadingMin: this.highlightSettings.highlightByLinkForLabelFadingMin,
1601
+ highlightForNodeColorFading: this.highlightSettings.highlightByLinkForNodeColorFading,
1602
+ highlightForNodeColorFadingMin: this.highlightSettings.highlightByLinkForNodeColorFadingMin,
1603
+ highlightForNodeFadingMin: this.highlightSettings.highlightByLinkForNodeFadingMin,
1604
+ highlightForTextFadingMin: this.highlightSettings.highlightByLinkForTextFadingMin,
1605
+ });
1606
+ alpha = fadingOptions.alpha;
1607
+ color = fadingOptions.color;
1608
+ textAlpha = fadingOptions.textAlpha;
1609
+ labelAlpha = fadingOptions.labelAlpha;
2286
1610
  }
2287
1611
  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
- }
1612
+ /** By Link Highlight */
1613
+ const highlightOptions = nodeHighlight({
1614
+ highlightProgress: this.highlightProgress,
1615
+ nodeOptions,
1616
+ highlightForLabelSizingAdditional: this.highlightSettings.highlightByLinkForLabelSizingAdditional,
1617
+ highlightForLabelWeightAdditional: this.highlightSettings.highlightByLinkForLabelWeightAdditional,
1618
+ highlightForNodeBorderColor: this.highlightSettings.highlightByLinkForNodeBorderColor,
1619
+ highlightForNodeBorderSizingAdditional: this.highlightSettings.highlightByLinkForNodeBorderSizingAdditional,
1620
+ highlightForNodeColor: this.highlightSettings.highlightByLinkForNodeColor,
1621
+ highlightForNodeSizingAdditional: this.highlightSettings.highlightByLinkForNodeSizingAdditional,
1622
+ highlightForNodeSizingAdditionalCoefficient: this.highlightSettings.highlightByLinkForNodeSizingAdditionalCoefficient,
1623
+ highlightForTextShiftXAdditional: this.highlightSettings.highlightByLinkForTextShiftXAdditional,
1624
+ highlightForTextShiftYAdditional: this.highlightSettings.highlightByLinkForTextShiftYAdditional,
1625
+ highlightForTextSizingAdditional: this.highlightSettings.highlightByLinkForTextSizingAdditional,
1626
+ highlightForTextWeightAdditional: this.highlightSettings.highlightByLinkForTextWeightAdditional,
1627
+ });
1628
+ color = highlightOptions.color;
1629
+ borderColor = highlightOptions.borderColor;
1630
+ borderWidth = highlightOptions.borderWidth;
1631
+ radiusInitial = highlightOptions.radiusInitial;
1632
+ widthInitial = highlightOptions.widthInitial;
1633
+ heightInitial = highlightOptions.heightInitial;
1634
+ textSize = highlightOptions.textSize;
1635
+ textShiftX = highlightOptions.textShiftX;
1636
+ textShiftY = highlightOptions.textShiftY;
1637
+ textWeight = highlightOptions.textWeight;
1638
+ labelSize = highlightOptions.labelSize;
1639
+ labelWeight = highlightOptions.labelWeight;
2307
1640
  }
2308
1641
  }
2309
1642
  /** Flex radius */
@@ -2341,14 +1674,13 @@ function getDrawNode(nodeRenders, textRenders, state) {
2341
1674
  sizeFactor: this.nodeSettings.nodeSizeFactor,
2342
1675
  sizeFlexible: this.nodeSettings.nodeSizeFlexible,
2343
1676
  });
2344
- textSize *= size.additionalSizeCoefficient;
1677
+ labelSize *= size.additionalSizeCoefficient;
2345
1678
  }
2346
1679
  /** Size by text in textNode */
2347
- if (nodeOptions.shape === "text" && nodeOptions.text) {
2348
- textWidth = width;
1680
+ if (nodeOptions.shape === "text" && nodeOptions.label) {
2349
1681
  let lines;
2350
1682
  let textNodeParameters;
2351
- const cachedLines = this.cachedNodeText[node.id];
1683
+ const cachedLines = this.cachedNodeLabel[node.id];
2352
1684
  const cachedTextNodeParameters = this.cachedTextNodeParameters[node.id];
2353
1685
  if (cachedLines != undefined && cachedTextNodeParameters != undefined) {
2354
1686
  lines = cachedLines;
@@ -2357,30 +1689,31 @@ function getDrawNode(nodeRenders, textRenders, state) {
2357
1689
  else {
2358
1690
  const textInfo = getTextLines({
2359
1691
  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,
1692
+ text: nodeOptions.label,
1693
+ textAlign: nodeOptions.labelAlign,
1694
+ textColor: nodeOptions.labelColor,
1695
+ textFont: nodeOptions.labelFont,
1696
+ textSize: labelSize,
1697
+ maxWidth: nodeOptions.labelWidth,
1698
+ textStyle: nodeOptions.labelStyle,
2367
1699
  textWeight,
2368
1700
  });
2369
- textNodeParameters = [textInfo.currentMaxSize, textSize];
1701
+ textNodeParameters = [textInfo.currentMaxSize, labelSize];
2370
1702
  lines = textInfo.lines;
2371
- this.cachedNodeText[node.id] = lines;
1703
+ this.cachedNodeLabel[node.id] = lines;
2372
1704
  this.cachedTextNodeParameters[node.id] = textNodeParameters;
2373
1705
  }
2374
- const textSizeCoefficient = textSize / textNodeParameters[1];
1706
+ const textSizeCoefficient = labelSize / textNodeParameters[1];
2375
1707
  const maxSize = textNodeParameters[0] * textSizeCoefficient;
2376
1708
  height =
2377
- lines.length * textSize +
2378
- (lines.length - 1) * nodeOptions.textGap +
2379
- nodeOptions.textNodeYPadding;
2380
- width = maxSize + nodeOptions.textNodeXPadding;
1709
+ lines.length * labelSize +
1710
+ (lines.length - 1) * nodeOptions.labelGap +
1711
+ nodeOptions.labelYPadding;
1712
+ width = maxSize + nodeOptions.labelXPadding;
2381
1713
  }
2382
1714
  /** Node parameters */
2383
1715
  node._radius = radius;
1716
+ node._borderWidth = borderWidth;
2384
1717
  node._width = width;
2385
1718
  node._height = height;
2386
1719
  node._borderRadius =
@@ -2405,49 +1738,127 @@ function getDrawNode(nodeRenders, textRenders, state) {
2405
1738
  return;
2406
1739
  this.context.beginPath();
2407
1740
  this.context.globalAlpha = alpha;
2408
- this.context.lineWidth = nodeOptions.borderWidth;
2409
- this.context.strokeStyle = nodeOptions.borderColor;
1741
+ this.context.lineWidth = borderWidth;
1742
+ this.context.strokeStyle = borderColor;
2410
1743
  this.context.fillStyle = color;
2411
1744
  switch (nodeOptions.shape) {
2412
1745
  case "circle": {
2413
- this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
1746
+ if (!node.image) {
1747
+ this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
1748
+ this.context.fill();
1749
+ if (borderWidth > 0) {
1750
+ this.context.stroke();
1751
+ }
1752
+ }
1753
+ else {
1754
+ this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
1755
+ this.context.closePath();
1756
+ this.context.save();
1757
+ this.context.clip();
1758
+ this.context.drawImage(node.image, node.x - radius, node.y - radius, radius * 2, radius * 2);
1759
+ this.context.restore();
1760
+ if (borderWidth > 0) {
1761
+ this.context.stroke();
1762
+ }
1763
+ }
1764
+ if (node.label) {
1765
+ this.context.globalAlpha = labelAlpha;
1766
+ drawText({
1767
+ context: this.context,
1768
+ cachedNodeText: this.cachedNodeLabel,
1769
+ id: node.id,
1770
+ text: node.label,
1771
+ textAlign: nodeOptions.labelAlign,
1772
+ textColor: nodeOptions.labelColor,
1773
+ textFont: nodeOptions.labelFont,
1774
+ textGap: nodeOptions.labelGap,
1775
+ textSize: labelSize,
1776
+ textStyle: nodeOptions.labelStyle,
1777
+ textWeight: labelWeight,
1778
+ maxWidth: nodeOptions.labelWidth,
1779
+ x: node.x,
1780
+ y: node.y + labelSize / 3,
1781
+ });
1782
+ }
2414
1783
  break;
2415
1784
  }
2416
1785
  case "square": {
2417
- this.context.roundRect(node.x - width / 2, node.y - height / 2, width, height, node._borderRadius);
1786
+ if (!node.image) {
1787
+ this.context.roundRect(node.x - width / 2, node.y - height / 2, width, height, node._borderRadius);
1788
+ this.context.fill();
1789
+ if (borderWidth > 0) {
1790
+ this.context.stroke();
1791
+ }
1792
+ }
1793
+ else {
1794
+ this.context.roundRect(node.x - width / 2, node.y - height / 2, width, height, node._borderRadius);
1795
+ this.context.closePath();
1796
+ this.context.save();
1797
+ this.context.clip();
1798
+ this.context.drawImage(node.image, node.x - width / 2, node.y - height / 2, width, height);
1799
+ this.context.restore();
1800
+ if (borderWidth > 0) {
1801
+ this.context.stroke();
1802
+ }
1803
+ }
1804
+ if (node.label) {
1805
+ this.context.globalAlpha = labelAlpha;
1806
+ drawText({
1807
+ context: this.context,
1808
+ cachedNodeText: this.cachedNodeLabel,
1809
+ id: node.id,
1810
+ text: node.label,
1811
+ textAlign: nodeOptions.labelAlign,
1812
+ textColor: nodeOptions.labelColor,
1813
+ textFont: nodeOptions.labelFont,
1814
+ textGap: nodeOptions.labelGap,
1815
+ textSize: labelSize,
1816
+ textStyle: nodeOptions.labelStyle,
1817
+ textWeight: labelWeight,
1818
+ maxWidth: nodeOptions.labelWidth,
1819
+ x: node.x,
1820
+ y: node.y + labelSize / 3,
1821
+ });
1822
+ }
2418
1823
  break;
2419
1824
  }
2420
1825
  case "text": {
2421
1826
  if (this.nodeSettings.textNodeDebug) {
2422
1827
  this.context.strokeRect(node.x - width / 2, node.y - height / 2, width, height);
2423
1828
  }
2424
- const lines = this.cachedNodeText[node.id];
2425
- if (nodeOptions.text && lines)
1829
+ const lines = this.cachedNodeLabel[node.id];
1830
+ if (nodeOptions.label && lines)
2426
1831
  drawText({
2427
1832
  id: node.id,
2428
- cachedNodeText: this.cachedNodeText,
1833
+ cachedNodeText: this.cachedNodeLabel,
2429
1834
  context: this.context,
2430
- text: nodeOptions.text,
2431
- textAlign: nodeOptions.textAlign,
2432
- textColor: nodeOptions.textColor,
2433
- textFont: nodeOptions.textFont,
2434
- textSize,
1835
+ text: nodeOptions.label,
1836
+ textAlign: nodeOptions.labelAlign,
1837
+ textColor: nodeOptions.labelColor,
1838
+ textFont: nodeOptions.labelFont,
1839
+ textSize: labelSize,
2435
1840
  x: node.x,
2436
1841
  y: node.y + textSize / 4 - (lines.length - 1) * (textSize / 2),
2437
- maxWidth: textWidth,
2438
- textStyle: nodeOptions.textStyle,
1842
+ maxWidth: nodeOptions.labelWidth,
1843
+ textStyle: nodeOptions.labelStyle,
2439
1844
  textWeight,
2440
- textGap: nodeOptions.textGap,
1845
+ textGap: nodeOptions.labelGap,
2441
1846
  });
1847
+ this.context.fill();
1848
+ if (borderWidth > 0) {
1849
+ this.context.stroke();
1850
+ }
2442
1851
  break;
2443
1852
  }
2444
1853
  default: {
2445
1854
  this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
1855
+ this.context.fill();
1856
+ if (borderWidth > 0) {
1857
+ this.context.stroke();
1858
+ }
2446
1859
  break;
2447
1860
  }
2448
1861
  }
2449
- this.context.fill();
2450
- this.context.stroke();
2451
1862
  });
2452
1863
  if (nodeOptions.nodeExtraDraw) {
2453
1864
  nodeRenders.push(() => {
@@ -2461,12 +1872,11 @@ function getDrawNode(nodeRenders, textRenders, state) {
2461
1872
  textShiftX,
2462
1873
  textShiftY,
2463
1874
  textWeight,
2464
- textWidth,
2465
1875
  });
2466
1876
  });
2467
1877
  }
2468
1878
  /** Text draw */
2469
- if (nodeOptions.textVisible && nodeOptions.text && nodeOptions.shape !== "text") {
1879
+ if (nodeOptions.textVisible && nodeOptions.text) {
2470
1880
  textRenders.push(() => {
2471
1881
  if (nodeOptions.textDraw) {
2472
1882
  nodeOptions.textDraw.bind(this)(node, {
@@ -2479,7 +1889,6 @@ function getDrawNode(nodeRenders, textRenders, state) {
2479
1889
  textShiftX,
2480
1890
  textShiftY,
2481
1891
  textWeight,
2482
- textWidth,
2483
1892
  });
2484
1893
  return;
2485
1894
  }
@@ -2491,7 +1900,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
2491
1900
  if (nodeOptions.shape === "circle") {
2492
1901
  y += radius;
2493
1902
  }
2494
- if (nodeOptions.shape === "square") {
1903
+ if (nodeOptions.shape === "square" || nodeOptions.shape === "text") {
2495
1904
  y += height / 2;
2496
1905
  }
2497
1906
  drawText({
@@ -2505,7 +1914,7 @@ function getDrawNode(nodeRenders, textRenders, state) {
2505
1914
  textSize,
2506
1915
  x: node.x + textShiftX,
2507
1916
  y,
2508
- maxWidth: textWidth,
1917
+ maxWidth: nodeOptions.textWidth,
2509
1918
  textStyle: nodeOptions.textStyle,
2510
1919
  textWeight,
2511
1920
  textGap: nodeOptions.textGap,
@@ -2521,7 +1930,6 @@ function getDrawNode(nodeRenders, textRenders, state) {
2521
1930
  textShiftX,
2522
1931
  textShiftY,
2523
1932
  textWeight,
2524
- textWidth,
2525
1933
  });
2526
1934
  }
2527
1935
  });
@@ -2569,18 +1977,8 @@ function initDraw() {
2569
1977
  function draw() {
2570
1978
  if (!this.context)
2571
1979
  return;
2572
- const state = this.state;
2573
1980
  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
- });
1981
+ this.listeners.onDraw.call(this);
2584
1982
  return;
2585
1983
  }
2586
1984
  this.context.save();
@@ -2589,14 +1987,14 @@ function initDraw() {
2589
1987
  this.context.scale(this.areaTransform.k, this.areaTransform.k);
2590
1988
  const textRenders = [];
2591
1989
  const nodeRenders = [];
2592
- this.nodes.forEach(getDrawNode(nodeRenders, textRenders, state).bind(this));
1990
+ this.nodes.forEach(getDrawNode(nodeRenders, textRenders).bind(this));
2593
1991
  /** links */
2594
- this.links.forEach(getDrawLink(state).bind(this));
1992
+ this.links.forEach(getDrawLink().bind(this));
2595
1993
  /** nodes */
2596
1994
  nodeRenders.forEach((render) => render());
2597
1995
  textRenders.forEach((render) => render());
2598
1996
  this.context.restore();
2599
- this.listeners.onDrawFinished?.(state);
1997
+ this.listeners.onDrawFinished?.call?.(this);
2600
1998
  calculateHighlight.bind(this)();
2601
1999
  }
2602
2000
  if (this.graphSettings.showDrawTime) {
@@ -2613,8 +2011,8 @@ function initPointer() {
2613
2011
  return;
2614
2012
  let currentNode;
2615
2013
  let currentLink;
2616
- const checkHighlightNode = this.nodeSettings.highlightByHoverNode && !this.isDragging;
2617
- const checkHighlightLink = this.linkSettings.highlightByHoverLink && !this.isDragging;
2014
+ const checkHighlightNode = this.highlightSettings.highlightByHoverNode && !this.isDragging;
2015
+ const checkHighlightLink = this.highlightSettings.highlightByHoverLink && !this.isDragging;
2618
2016
  let highlightNode = true;
2619
2017
  let highlightLink = true;
2620
2018
  if (checkHighlightNode) {
@@ -2632,7 +2030,7 @@ function initPointer() {
2632
2030
  }
2633
2031
  else if (checkHighlightLink) {
2634
2032
  currentLink = linkByPointerGetter({
2635
- linkSettings: this.linkSettings,
2033
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2636
2034
  areaRect: this.areaRect,
2637
2035
  areaTransform: this.areaTransform,
2638
2036
  mouseEvent: event,
@@ -2693,7 +2091,7 @@ function initPointer() {
2693
2091
  });
2694
2092
  if (!currentNode && (!checkHighlightNode || (!checkHighlightLink && !currentLink))) {
2695
2093
  currentLink = linkByPointerGetter({
2696
- linkSettings: this.linkSettings,
2094
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2697
2095
  areaRect: this.areaRect,
2698
2096
  areaTransform: this.areaTransform,
2699
2097
  mouseEvent: event,
@@ -2701,7 +2099,7 @@ function initPointer() {
2701
2099
  });
2702
2100
  }
2703
2101
  if (!currentNode)
2704
- return void this.listeners.onMove(event, currentNode, currentLink);
2102
+ return void this.listeners.onMove.call(this, event, currentNode, currentLink);
2705
2103
  }
2706
2104
  function onWheelClick(event) {
2707
2105
  if (this.isDragging ||
@@ -2717,15 +2115,15 @@ function initPointer() {
2717
2115
  });
2718
2116
  if (!currentNode) {
2719
2117
  const currentLink = linkByPointerGetter({
2720
- linkSettings: this.linkSettings,
2118
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2721
2119
  areaRect: this.areaRect,
2722
2120
  areaTransform: this.areaTransform,
2723
2121
  mouseEvent: event,
2724
2122
  links: this.links,
2725
2123
  });
2726
- return void this.listeners.onWheelClick(event, undefined, currentLink);
2124
+ return void this.listeners.onWheelClick.call(this, event, undefined, currentLink);
2727
2125
  }
2728
- return void this.listeners.onWheelClick(event, currentNode, undefined);
2126
+ return void this.listeners.onWheelClick.call(this, event, currentNode, undefined);
2729
2127
  }
2730
2128
  function onRightClick(event) {
2731
2129
  if (!this.listeners.onContextMenu)
@@ -2738,15 +2136,15 @@ function initPointer() {
2738
2136
  });
2739
2137
  if (!currentNode) {
2740
2138
  const currentLink = linkByPointerGetter({
2741
- linkSettings: this.linkSettings,
2139
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2742
2140
  areaRect: this.areaRect,
2743
2141
  areaTransform: this.areaTransform,
2744
2142
  mouseEvent: event,
2745
2143
  links: this.links,
2746
2144
  });
2747
- return void this.listeners.onContextMenu(event, undefined, currentLink);
2145
+ return void this.listeners.onContextMenu.call(this, event, undefined, currentLink);
2748
2146
  }
2749
- return void this.listeners.onContextMenu(event, currentNode, undefined);
2147
+ return void this.listeners.onContextMenu.call(this, event, currentNode, undefined);
2750
2148
  }
2751
2149
  function onDoubleClick(event) {
2752
2150
  if (!this.listeners.onDoubleClick)
@@ -2759,15 +2157,15 @@ function initPointer() {
2759
2157
  });
2760
2158
  if (!currentNode) {
2761
2159
  const currentLink = linkByPointerGetter({
2762
- linkSettings: this.linkSettings,
2160
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2763
2161
  areaRect: this.areaRect,
2764
2162
  areaTransform: this.areaTransform,
2765
2163
  mouseEvent: event,
2766
2164
  links: this.links,
2767
2165
  });
2768
- return void this.listeners.onDoubleClick(event, undefined, currentLink);
2166
+ return void this.listeners.onDoubleClick.call(this, event, undefined, currentLink);
2769
2167
  }
2770
- return void this.listeners.onDoubleClick(event, currentNode, undefined);
2168
+ return void this.listeners.onDoubleClick.call(this, event, currentNode, undefined);
2771
2169
  }
2772
2170
  function onClick(event) {
2773
2171
  if (this.isDragging || !this.listeners.onClick || ("button" in event && event.button !== 0))
@@ -2780,15 +2178,15 @@ function initPointer() {
2780
2178
  });
2781
2179
  if (!currentNode) {
2782
2180
  const currentLink = linkByPointerGetter({
2783
- linkSettings: this.linkSettings,
2181
+ linkHoverExtraZone: this.highlightSettings.linkHoverExtraZone,
2784
2182
  areaRect: this.areaRect,
2785
2183
  areaTransform: this.areaTransform,
2786
2184
  mouseEvent: event,
2787
2185
  links: this.links,
2788
2186
  });
2789
- return void this.listeners.onClick(event, undefined, currentLink);
2187
+ return void this.listeners.onClick.call(this, event, undefined, currentLink);
2790
2188
  }
2791
- return void this.listeners.onClick(event, currentNode, undefined);
2189
+ return void this.listeners.onClick.call(this, event, currentNode, undefined);
2792
2190
  }
2793
2191
  /** hover */
2794
2192
  this.area.addEventListener("mousemove", onHover.bind(this), {
@@ -2845,12 +2243,12 @@ function initSimulation() {
2845
2243
  if (!this.simulation) {
2846
2244
  this.simulation = d3Force.forceSimulation()
2847
2245
  .nodes(this.nodes)
2848
- .force("link", d3Force.forceLink(this.links).id(this.nodeSettings.idGetter))
2246
+ .force("link", d3Force.forceLink(this.links).id(this.nodeSettings.idGetter.bind(this)))
2849
2247
  .on("tick", () => {
2850
2248
  this.draw();
2851
2249
  })
2852
2250
  .on("end", () => {
2853
- this.listeners.onSimulationEnd?.(this.state);
2251
+ this.listeners.onSimulationEnd?.call?.(this);
2854
2252
  if (this.graphSettings.showDrawTime) {
2855
2253
  getDrawTime();
2856
2254
  // eslint-disable-next-line no-console
@@ -2924,11 +2322,11 @@ function initCollideForce(forceUpdate) {
2924
2322
  else if (!this.simulation.force("collide") || forceUpdate) {
2925
2323
  this.simulation.force("collide", d3Force.forceCollide()
2926
2324
  .radius((node, index) => {
2927
- const nodeOptions = nodeIterationExtractor(node, index, this.nodes, this.state, this.nodeSettings.options ?? {}, nodeOptionsGetter);
2325
+ const nodeOptions = nodeIterationExtractor(node, index, this.nodes, this, this.nodeSettings.options ?? {}, nodeOptionsGetter);
2928
2326
  switch (nodeOptions.shape) {
2929
2327
  case "circle": {
2930
2328
  if (this.forceSettings.collideRadius) {
2931
- return nodeIterationExtractor(node, index, this.nodes, this.state, this.forceSettings.collideRadius, undefined);
2329
+ return nodeIterationExtractor(node, index, this.nodes, this, this.forceSettings.collideRadius, undefined);
2932
2330
  }
2933
2331
  const radius = nodeRadiusGetter({
2934
2332
  radiusFlexible: this.nodeSettings.nodeRadiusFlexible,
@@ -2961,30 +2359,29 @@ function initCollideForce(forceUpdate) {
2961
2359
  sizeFlexible: this.nodeSettings.nodeSizeFlexible,
2962
2360
  });
2963
2361
  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;
2362
+ const textInfo = getTextLines({
2363
+ context: this.context,
2364
+ text: nodeOptions.text,
2365
+ textAlign: nodeOptions.textAlign,
2366
+ textColor: nodeOptions.textColor,
2367
+ textFont: nodeOptions.textFont,
2368
+ textSize: nodeOptions.textSize,
2369
+ maxWidth: width,
2370
+ textStyle: nodeOptions.textStyle,
2371
+ textWeight: nodeOptions.textWeight,
2372
+ });
2976
2373
  height =
2977
- lines.length * nodeOptions.textSize +
2978
- (lines.length - 1) * nodeOptions.textGap +
2979
- nodeOptions.textNodeYPadding;
2980
- width += nodeOptions.textNodeXPadding;
2374
+ textInfo.lines.length * nodeOptions.textSize +
2375
+ (textInfo.lines.length - 1) * nodeOptions.textGap +
2376
+ nodeOptions.labelYPadding;
2377
+ width = textInfo.currentMaxSize + nodeOptions.labelXPadding;
2981
2378
  }
2982
2379
  return (Math.sqrt(width ** 2 + height ** 2) / 2 +
2983
2380
  this.forceSettings.collideAdditionalRadius);
2984
2381
  }
2985
2382
  default: {
2986
2383
  if (this.forceSettings.collideRadius) {
2987
- return nodeIterationExtractor(node, index, this.nodes, this.state, this.forceSettings.collideRadius, undefined);
2384
+ return nodeIterationExtractor(node, index, this.nodes, this, this.forceSettings.collideRadius, undefined);
2988
2385
  }
2989
2386
  const radius = nodeRadiusGetter({
2990
2387
  radiusFlexible: this.nodeSettings.nodeRadiusFlexible,
@@ -3009,7 +2406,7 @@ function initZoom(currentZoom) {
3009
2406
  const zoomInstance = d3Zoom.zoom()
3010
2407
  .scaleExtent(this.graphSettings.zoomExtent)
3011
2408
  .on("zoom", (event) => {
3012
- this.listeners.onZoom?.(event);
2409
+ this.listeners.onZoom?.call?.(this, event);
3013
2410
  this.areaTransform = event.transform;
3014
2411
  this.linkOptionsCache = {};
3015
2412
  this.nodeOptionsCache = {};
@@ -3046,6 +2443,7 @@ class GraphCanvas {
3046
2443
  /** settings */
3047
2444
  graphSettings;
3048
2445
  forceSettings;
2446
+ highlightSettings;
3049
2447
  nodeSettings;
3050
2448
  linkSettings;
3051
2449
  listeners;
@@ -3057,6 +2455,7 @@ class GraphCanvas {
3057
2455
  draw;
3058
2456
  eventAbortController;
3059
2457
  cachedNodeText = {};
2458
+ cachedNodeLabel = {};
3060
2459
  cachedTextNodeParameters = {};
3061
2460
  linkOptionsCache = {};
3062
2461
  nodeOptionsCache = {};
@@ -3074,32 +2473,7 @@ class GraphCanvas {
3074
2473
  const force = (simulationAlpha - simulationAlphaMin) / simulationAlphaDecay;
3075
2474
  return force > 0;
3076
2475
  }
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, }) {
2476
+ constructor({ links, nodes, root, forceSettings, linkSettings, listeners, nodeSettings, graphSettings, highlightSettings, }) {
3103
2477
  // root.style.position = "relative";
3104
2478
  root.style.overflow = "hidden";
3105
2479
  this.root = root;
@@ -3108,6 +2482,7 @@ class GraphCanvas {
3108
2482
  this.nodeSettings = nodeSettingsGetter(nodeSettings);
3109
2483
  this.listeners = listenersGetter(listeners);
3110
2484
  this.graphSettings = graphSettingsGetter(graphSettings);
2485
+ this.highlightSettings = highlightSettingsGetter(highlightSettings);
3111
2486
  this.eventAbortController = new AbortController();
3112
2487
  this.nodes = nodes;
3113
2488
  this.links = links;
@@ -3142,6 +2517,14 @@ class GraphCanvas {
3142
2517
  if (options.forceSettings) {
3143
2518
  this.forceSettings = forceSettingsGetter(options.forceSettings, this.forceSettings);
3144
2519
  }
2520
+ if (options.highlightSettings) {
2521
+ this.highlightSettings = highlightSettingsGetter(options.highlightSettings, this.highlightSettings);
2522
+ this.linkOptionsCache = {};
2523
+ this.cachedNodeText = {};
2524
+ this.cachedNodeLabel = {};
2525
+ this.cachedTextNodeParameters = {};
2526
+ this.nodeOptionsCache = {};
2527
+ }
3145
2528
  if (options.linkSettings) {
3146
2529
  this.linkSettings = linkSettingsGetter(options.linkSettings, this.linkSettings);
3147
2530
  this.linkOptionsCache = {};
@@ -3149,6 +2532,7 @@ class GraphCanvas {
3149
2532
  if (options.nodeSettings) {
3150
2533
  this.nodeSettings = nodeSettingsGetter(options.nodeSettings, this.nodeSettings);
3151
2534
  this.cachedNodeText = {};
2535
+ this.cachedNodeLabel = {};
3152
2536
  this.cachedTextNodeParameters = {};
3153
2537
  this.nodeOptionsCache = {};
3154
2538
  initCollideForce.call(this, true);
@@ -3162,11 +2546,20 @@ class GraphCanvas {
3162
2546
  if (this.area)
3163
2547
  this.areaRect = this.area.getBoundingClientRect();
3164
2548
  }
3165
- clearCache() {
3166
- this.nodeOptionsCache = {};
3167
- this.linkOptionsCache = {};
3168
- this.cachedNodeText = {};
3169
- this.cachedTextNodeParameters = {};
2549
+ clearCache(keys) {
2550
+ if (!keys) {
2551
+ this.nodeOptionsCache = {};
2552
+ this.linkOptionsCache = {};
2553
+ this.cachedNodeText = {};
2554
+ this.cachedNodeLabel = {};
2555
+ this.cachedTextNodeParameters = {};
2556
+ }
2557
+ else {
2558
+ for (let i = 0; i < keys.length; i++) {
2559
+ const key = keys[i];
2560
+ this[key] = {};
2561
+ }
2562
+ }
3170
2563
  }
3171
2564
  tick() {
3172
2565
  if (!this.simulationWorking && !this.highlightWorking)
@@ -3231,7 +2624,7 @@ class GraphCanvas {
3231
2624
  this.simulation
3232
2625
  .nodes(this.nodes)
3233
2626
  .force("link", d3Force.forceLink(this.links)
3234
- .id(this.nodeSettings.idGetter)
2627
+ .id(this.nodeSettings.idGetter.bind(this))
3235
2628
  .distance(this.forceSettings.forces && this.forceSettings.linkForce
3236
2629
  ? this.forceSettings.linkDistance
3237
2630
  : 0)
@@ -3265,28 +2658,1223 @@ class GraphCanvas {
3265
2658
  }
3266
2659
  }
3267
2660
 
2661
+ const FORCE_CONTROLS = [
2662
+ {
2663
+ id: "forces",
2664
+ initialValue: FORCE_SETTINGS.forces,
2665
+ label: "Физика",
2666
+ type: "checkbox",
2667
+ },
2668
+ {
2669
+ id: "collideForce",
2670
+ type: "checkbox",
2671
+ label: "Сила отталкивания",
2672
+ initialValue: FORCE_SETTINGS.collideForce,
2673
+ },
2674
+ {
2675
+ id: "centerForce",
2676
+ type: "checkbox",
2677
+ label: "Сила центрирования",
2678
+ initialValue: FORCE_SETTINGS.centerForce,
2679
+ },
2680
+ {
2681
+ id: "chargeForce",
2682
+ type: "checkbox",
2683
+ label: "Сила дистанции",
2684
+ initialValue: FORCE_SETTINGS.chargeForce,
2685
+ },
2686
+ {
2687
+ id: "linkForce",
2688
+ type: "checkbox",
2689
+ label: "Сила связей",
2690
+ initialValue: FORCE_SETTINGS.linkForce,
2691
+ },
2692
+ {
2693
+ id: "xForce",
2694
+ type: "checkbox",
2695
+ label: "Сила притяжения по оси X",
2696
+ initialValue: FORCE_SETTINGS.xForce,
2697
+ },
2698
+ {
2699
+ id: "yForce",
2700
+ type: "checkbox",
2701
+ label: "Сила притяжения по оси Y",
2702
+ initialValue: FORCE_SETTINGS.yForce,
2703
+ },
2704
+ {
2705
+ id: "collideStrength",
2706
+ initialValue: FORCE_SETTINGS.collideStrength,
2707
+ label: "Сила отталкивания",
2708
+ max: 1,
2709
+ min: 0,
2710
+ step: 0.01,
2711
+ type: "range",
2712
+ },
2713
+ {
2714
+ id: "collideAdditionalRadius",
2715
+ initialValue: FORCE_SETTINGS.collideAdditionalRadius,
2716
+ label: "Радиус отталкивания",
2717
+ max: 300,
2718
+ min: 0,
2719
+ step: 0.1,
2720
+ type: "range",
2721
+ },
2722
+ {
2723
+ id: "collideIterations",
2724
+ initialValue: FORCE_SETTINGS.collideIterations,
2725
+ label: "Итерации отталкивания",
2726
+ max: 10,
2727
+ min: 0,
2728
+ step: 1,
2729
+ type: "range",
2730
+ },
2731
+ {
2732
+ id: "chargeStrength",
2733
+ initialValue: typeof FORCE_SETTINGS.chargeStrength === "number" ? FORCE_SETTINGS.chargeStrength : 0,
2734
+ label: "Дистанция",
2735
+ max: 0,
2736
+ min: -300,
2737
+ step: 0.1,
2738
+ type: "range",
2739
+ },
2740
+ {
2741
+ type: "range",
2742
+ id: "xPosition",
2743
+ min: 0,
2744
+ max: 2000,
2745
+ step: 1,
2746
+ label: "Координата притяжения по оси X",
2747
+ initialValue: typeof FORCE_SETTINGS.xPosition === "number" ? FORCE_SETTINGS.xPosition : 0,
2748
+ },
2749
+ {
2750
+ type: "range",
2751
+ id: "yPosition",
2752
+ min: 0,
2753
+ max: 2000,
2754
+ step: 1,
2755
+ label: "Координата притяжения по оси Y",
2756
+ initialValue: typeof FORCE_SETTINGS.yPosition === "number" ? FORCE_SETTINGS.yPosition : 0,
2757
+ },
2758
+ {
2759
+ type: "range",
2760
+ id: "xStrength",
2761
+ min: 0,
2762
+ max: 1,
2763
+ step: 0.01,
2764
+ label: "Сила притяжения по оси X",
2765
+ initialValue: typeof FORCE_SETTINGS.xStrength === "number" ? FORCE_SETTINGS.xStrength : 0,
2766
+ },
2767
+ {
2768
+ type: "range",
2769
+ id: "yStrength",
2770
+ min: 0,
2771
+ max: 1,
2772
+ step: 0.01,
2773
+ label: "Сила притяжения по оси Y",
2774
+ initialValue: typeof FORCE_SETTINGS.yStrength === "number" ? FORCE_SETTINGS.yStrength : 0,
2775
+ },
2776
+ {
2777
+ type: "range",
2778
+ id: "linkStrength",
2779
+ min: 0,
2780
+ max: 1,
2781
+ step: 0.01,
2782
+ label: "Сила связей",
2783
+ initialValue: typeof FORCE_SETTINGS.linkStrength === "number" ? FORCE_SETTINGS.linkStrength : 0,
2784
+ },
2785
+ {
2786
+ type: "range",
2787
+ id: "linkDistance",
2788
+ min: 0,
2789
+ max: 300,
2790
+ step: 0.1,
2791
+ label: "Расстояние связей",
2792
+ initialValue: typeof FORCE_SETTINGS.linkDistance === "number" ? FORCE_SETTINGS.linkDistance : 30,
2793
+ },
2794
+ ];
2795
+
2796
+ const GRAPH_CONTROLS = [
2797
+ {
2798
+ id: "highlightDownFrames",
2799
+ initialValue: GRAPH_SETTINGS.highlightDownFrames,
2800
+ max: 60,
2801
+ min: 1,
2802
+ step: 1,
2803
+ type: "range",
2804
+ label: "Скорость отмены анимации в кадрах",
2805
+ },
2806
+ {
2807
+ id: "highlightUpFrames",
2808
+ initialValue: GRAPH_SETTINGS.highlightUpFrames,
2809
+ max: 60,
2810
+ min: 1,
2811
+ step: 1,
2812
+ type: "range",
2813
+ label: "Скорость применения анимации в кадрах",
2814
+ },
2815
+ ];
2816
+
2817
+ const HIGHLIGHT_COMMON_CONTROLS = [
2818
+ {
2819
+ id: "highlightByHoverNode",
2820
+ type: "checkbox",
2821
+ initialValue: HIGHLIGHT_SETTINGS.highlightByHoverNode,
2822
+ label: "Анимация при наведении на вершину",
2823
+ },
2824
+ {
2825
+ id: "highlightByHoverLink",
2826
+ type: "checkbox",
2827
+ label: "Анимация при наведении на связь",
2828
+ initialValue: HIGHLIGHT_SETTINGS.highlightByHoverLink,
2829
+ },
2830
+ {
2831
+ id: "linkHoverExtraZone",
2832
+ initialValue: HIGHLIGHT_SETTINGS.linkHoverExtraZone,
2833
+ max: 10,
2834
+ min: 0,
2835
+ step: 0.01,
2836
+ type: "range",
2837
+ label: "Расширение границы связи для курсора",
2838
+ },
2839
+ ];
2840
+ const HIGHLIGHT_BY_NODE_FOR_NODE_CONTROLS = [
2841
+ {
2842
+ id: "highlightByNodeOnlyRoot",
2843
+ type: "checkbox",
2844
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeOnlyRoot,
2845
+ label: "Основная анимация только на инициаторе",
2846
+ },
2847
+ {
2848
+ id: "highlightByNodeForNodeColorFading",
2849
+ type: "checkbox",
2850
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeColorFading,
2851
+ label: "Прозрачность без альфа канала",
2852
+ },
2853
+ {
2854
+ id: "highlightByNodeForNodeColor",
2855
+ type: "color",
2856
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeColor ?? "#000000",
2857
+ label: "Цвет",
2858
+ },
2859
+ {
2860
+ id: "highlightByNodeForNodeFadingMin",
2861
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeFadingMin,
2862
+ max: 1,
2863
+ min: 0,
2864
+ step: 0.01,
2865
+ type: "range",
2866
+ label: "Граница прозрачности",
2867
+ },
2868
+ {
2869
+ id: "highlightByNodeForNodeColorFadingMin",
2870
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeColorFadingMin,
2871
+ max: 1,
2872
+ min: 0.01,
2873
+ step: 0.01,
2874
+ type: "range",
2875
+ label: "Граница прозрачности без альфа канала",
2876
+ },
2877
+ {
2878
+ id: "highlightByNodeForNodeSizingAdditional",
2879
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeSizingAdditional,
2880
+ max: 10,
2881
+ min: -10,
2882
+ step: 0.01,
2883
+ type: "range",
2884
+ label: "Изменение радиуса (только для круга)",
2885
+ },
2886
+ {
2887
+ id: "highlightByNodeForNodeSizingAdditionalCoefficient",
2888
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeSizingAdditionalCoefficient,
2889
+ max: 10,
2890
+ min: 0.01,
2891
+ step: 0.01,
2892
+ type: "range",
2893
+ label: "Коэффициент изменения размера (только не для круга)",
2894
+ },
2895
+ {
2896
+ id: "highlightByNodeForNodeBorderColor",
2897
+ type: "color",
2898
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeBorderColor ?? "#000000",
2899
+ label: "Цвет границы",
2900
+ },
2901
+ {
2902
+ id: "highlightByNodeForNodeBorderSizingAdditional",
2903
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForNodeBorderSizingAdditional,
2904
+ max: 10,
2905
+ min: 0.01,
2906
+ step: 0.01,
2907
+ type: "range",
2908
+ label: "Изменение размера границы",
2909
+ },
2910
+ ];
2911
+ const HIGHLIGHT_BY_NODE_FOR_TEXT_CONTROLS = [
2912
+ {
2913
+ id: "highlightByNodeForTextFadingMin",
2914
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForTextFadingMin,
2915
+ max: 1,
2916
+ min: 0,
2917
+ step: 0.01,
2918
+ type: "range",
2919
+ label: "Граница прозрачности",
2920
+ },
2921
+ {
2922
+ id: "highlightByNodeForTextSizingAdditional",
2923
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForTextSizingAdditional,
2924
+ max: 10,
2925
+ min: -10,
2926
+ step: 0.1,
2927
+ type: "range",
2928
+ label: "Изменение размера",
2929
+ },
2930
+ {
2931
+ id: "highlightByNodeForTextWeightAdditional",
2932
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForTextWeightAdditional,
2933
+ max: 1000,
2934
+ min: -1e3,
2935
+ step: 100,
2936
+ type: "range",
2937
+ label: "Изменение жирности",
2938
+ },
2939
+ {
2940
+ id: "highlightByNodeForTextShiftXAdditional",
2941
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForTextShiftXAdditional,
2942
+ max: 50,
2943
+ min: -50,
2944
+ step: 0.1,
2945
+ type: "range",
2946
+ label: "Смещение по оси X",
2947
+ },
2948
+ {
2949
+ id: "highlightByNodeForTextShiftYAdditional",
2950
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForTextShiftYAdditional,
2951
+ max: 50,
2952
+ min: -50,
2953
+ step: 0.1,
2954
+ type: "range",
2955
+ label: "Смещение по оси Y",
2956
+ },
2957
+ ];
2958
+ const HIGHLIGHT_BY_NODE_FOR_LABEL_CONTROLS = [
2959
+ {
2960
+ id: "highlightByNodeForLabelFadingMin",
2961
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLabelFadingMin,
2962
+ max: 1,
2963
+ min: 0,
2964
+ step: 0.01,
2965
+ type: "range",
2966
+ label: "Граница прозрачности",
2967
+ },
2968
+ {
2969
+ id: "highlightByNodeForLabelSizingAdditional",
2970
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLabelSizingAdditional,
2971
+ max: 10,
2972
+ min: -10,
2973
+ step: 0.1,
2974
+ type: "range",
2975
+ label: "Изменение размера",
2976
+ },
2977
+ {
2978
+ id: "highlightByNodeForLabelWeightAdditional",
2979
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLabelWeightAdditional,
2980
+ max: 1000,
2981
+ min: -1e3,
2982
+ step: 100,
2983
+ type: "range",
2984
+ label: "Изменение жирности",
2985
+ },
2986
+ ];
2987
+ const HIGHLIGHT_BY_NODE_FOR_LINK_CONTROLS = [
2988
+ {
2989
+ id: "highlightByNodeForLinkColor",
2990
+ type: "color",
2991
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLinkColor ?? "#000000",
2992
+ label: "Цвет",
2993
+ },
2994
+ {
2995
+ id: "highlightByNodeForLinkFadingMin",
2996
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLinkFadingMin,
2997
+ max: 1,
2998
+ min: 0,
2999
+ step: 0.01,
3000
+ type: "range",
3001
+ label: "Граница прозрачности",
3002
+ },
3003
+ {
3004
+ id: "highlightByNodeForLinkSizeAdditional",
3005
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForLinkSizeAdditional,
3006
+ max: 10,
3007
+ min: -10,
3008
+ step: 0.1,
3009
+ type: "range",
3010
+ label: "Изменение размера",
3011
+ },
3012
+ ];
3013
+ const HIGHLIGHT_BY_NODE_FOR_ARROW_CONTROLS = [
3014
+ {
3015
+ id: "highlightByNodeForArrowColor",
3016
+ type: "color",
3017
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForArrowColor ?? "#000000",
3018
+ label: "Цвет",
3019
+ },
3020
+ {
3021
+ id: "highlightByNodeForArrowFadingMin",
3022
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForArrowFadingMin,
3023
+ max: 1,
3024
+ min: 0,
3025
+ step: 0.01,
3026
+ type: "range",
3027
+ label: "Граница прозрачности",
3028
+ },
3029
+ {
3030
+ id: "highlightByNodeForArrowSizeAdditional",
3031
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForArrowSizeAdditional,
3032
+ max: 10,
3033
+ min: -10,
3034
+ step: 0.1,
3035
+ type: "range",
3036
+ label: "Изменение размера",
3037
+ },
3038
+ {
3039
+ id: "highlightByNodeForArrowBorderColor",
3040
+ type: "color",
3041
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForArrowBorderColor ?? "#000000",
3042
+ label: "Цвет границы",
3043
+ },
3044
+ {
3045
+ id: "highlightByNodeForArrowBorderSizingAdditional",
3046
+ initialValue: HIGHLIGHT_SETTINGS.highlightByNodeForArrowBorderSizingAdditional,
3047
+ max: 10,
3048
+ min: 0.01,
3049
+ step: 0.01,
3050
+ type: "range",
3051
+ label: "Изменение размера границы",
3052
+ },
3053
+ ];
3054
+ const HIGHLIGHT_BY_LINK_FOR_NODE_CONTROLS = [
3055
+ {
3056
+ id: "highlightByLinkForNodeColorFading",
3057
+ type: "checkbox",
3058
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeColorFading,
3059
+ label: "Прозрачность без альфа канала",
3060
+ },
3061
+ {
3062
+ id: "highlightByLinkForNodeColor",
3063
+ type: "color",
3064
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeColor ?? "#000000",
3065
+ label: "Цвет",
3066
+ },
3067
+ {
3068
+ id: "highlightByLinkForNodeFadingMin",
3069
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeFadingMin,
3070
+ max: 1,
3071
+ min: 0,
3072
+ step: 0.01,
3073
+ type: "range",
3074
+ label: "Граница прозрачности",
3075
+ },
3076
+ {
3077
+ id: "highlightByLinkForNodeColorFadingMin",
3078
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeColorFadingMin,
3079
+ max: 1,
3080
+ min: 0.01,
3081
+ step: 0.01,
3082
+ type: "range",
3083
+ label: "Граница прозрачности без альфа канала",
3084
+ },
3085
+ {
3086
+ id: "highlightByLinkForNodeSizingAdditional",
3087
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeSizingAdditional,
3088
+ max: 10,
3089
+ min: -10,
3090
+ step: 0.01,
3091
+ type: "range",
3092
+ label: "Изменение радиуса (только для круга)",
3093
+ },
3094
+ {
3095
+ id: "highlightByLinkForNodeSizingAdditionalCoefficient",
3096
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeSizingAdditionalCoefficient,
3097
+ max: 10,
3098
+ min: 0.01,
3099
+ step: 0.01,
3100
+ type: "range",
3101
+ label: "Коэффициент изменения размера (только не для круга)",
3102
+ },
3103
+ {
3104
+ id: "highlightByLinkForNodeBorderColor",
3105
+ type: "color",
3106
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeBorderColor ?? "#000000",
3107
+ label: "Цвет границы",
3108
+ },
3109
+ {
3110
+ id: "highlightByLinkForNodeBorderSizingAdditional",
3111
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForNodeBorderSizingAdditional,
3112
+ max: 10,
3113
+ min: 0.01,
3114
+ step: 0.01,
3115
+ type: "range",
3116
+ label: "Изменение размера границы",
3117
+ },
3118
+ ];
3119
+ const HIGHLIGHT_BY_LINK_FOR_TEXT_CONTROLS = [
3120
+ {
3121
+ id: "highlightByLinkForTextFadingMin",
3122
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForTextFadingMin,
3123
+ max: 1,
3124
+ min: 0,
3125
+ step: 0.01,
3126
+ type: "range",
3127
+ label: "Граница прозрачности",
3128
+ },
3129
+ {
3130
+ id: "highlightByLinkForTextSizingAdditional",
3131
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForTextSizingAdditional,
3132
+ max: 10,
3133
+ min: -10,
3134
+ step: 0.1,
3135
+ type: "range",
3136
+ label: "Изменение размера",
3137
+ },
3138
+ {
3139
+ id: "highlightByLinkForTextWeightAdditional",
3140
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForTextWeightAdditional,
3141
+ max: 1000,
3142
+ min: -1e3,
3143
+ step: 100,
3144
+ type: "range",
3145
+ label: "Изменение жирности",
3146
+ },
3147
+ {
3148
+ id: "highlightByLinkForTextShiftXAdditional",
3149
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForTextShiftXAdditional,
3150
+ max: 50,
3151
+ min: -50,
3152
+ step: 0.1,
3153
+ type: "range",
3154
+ label: "Смещение по оси X",
3155
+ },
3156
+ {
3157
+ id: "highlightByLinkForTextShiftYAdditional",
3158
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForTextShiftYAdditional,
3159
+ max: 50,
3160
+ min: -50,
3161
+ step: 0.1,
3162
+ type: "range",
3163
+ label: "Смещение по оси Y",
3164
+ },
3165
+ ];
3166
+ const HIGHLIGHT_BY_LINK_FOR_LABEL_CONTROLS = [
3167
+ {
3168
+ id: "highlightByLinkForLabelFadingMin",
3169
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLabelFadingMin,
3170
+ max: 1,
3171
+ min: 0,
3172
+ step: 0.01,
3173
+ type: "range",
3174
+ label: "Граница прозрачности",
3175
+ },
3176
+ {
3177
+ id: "highlightByLinkForLabelSizingAdditional",
3178
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLabelSizingAdditional,
3179
+ max: 10,
3180
+ min: -10,
3181
+ step: 0.1,
3182
+ type: "range",
3183
+ label: "Изменение размера",
3184
+ },
3185
+ {
3186
+ id: "highlightByLinkForLabelWeightAdditional",
3187
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLabelWeightAdditional,
3188
+ max: 1000,
3189
+ min: -1e3,
3190
+ step: 100,
3191
+ type: "range",
3192
+ label: "Изменение жирности",
3193
+ },
3194
+ ];
3195
+ const HIGHLIGHT_BY_LINK_FOR_LINK_CONTROLS = [
3196
+ {
3197
+ id: "highlightByLinkForLinkColor",
3198
+ type: "color",
3199
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLinkColor ?? "#000000",
3200
+ label: "Цвет",
3201
+ },
3202
+ {
3203
+ id: "highlightByLinkForLinkFadingMin",
3204
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLinkFadingMin,
3205
+ max: 1,
3206
+ min: 0,
3207
+ step: 0.01,
3208
+ type: "range",
3209
+ label: "Граница прозрачности",
3210
+ },
3211
+ {
3212
+ id: "highlightByLinkForLinkSizeAdditional",
3213
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForLinkSizeAdditional,
3214
+ max: 10,
3215
+ min: -10,
3216
+ step: 0.1,
3217
+ type: "range",
3218
+ label: "Изменение размера",
3219
+ },
3220
+ ];
3221
+ const HIGHLIGHT_BY_LINK_FOR_ARROW_CONTROLS = [
3222
+ {
3223
+ id: "highlightByLinkForArrowColor",
3224
+ type: "color",
3225
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForArrowColor ?? "#000000",
3226
+ label: "Цвет",
3227
+ },
3228
+ {
3229
+ id: "highlightByLinkForArrowFadingMin",
3230
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForArrowFadingMin,
3231
+ max: 1,
3232
+ min: 0,
3233
+ step: 0.01,
3234
+ type: "range",
3235
+ label: "Граница прозрачности",
3236
+ },
3237
+ {
3238
+ id: "highlightByLinkForArrowSizeAdditional",
3239
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForArrowSizeAdditional,
3240
+ max: 10,
3241
+ min: -10,
3242
+ step: 0.1,
3243
+ type: "range",
3244
+ label: "Изменение размера",
3245
+ },
3246
+ {
3247
+ id: "highlightByLinkForArrowBorderColor",
3248
+ type: "color",
3249
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForArrowBorderColor ?? "#000000",
3250
+ label: "Цвет границы",
3251
+ },
3252
+ {
3253
+ id: "highlightByLinkForArrowBorderSizingAdditional",
3254
+ initialValue: HIGHLIGHT_SETTINGS.highlightByLinkForArrowBorderSizingAdditional,
3255
+ max: 10,
3256
+ min: 0.01,
3257
+ step: 0.01,
3258
+ type: "range",
3259
+ label: "Изменение размера границы",
3260
+ },
3261
+ ];
3262
+
3263
+ const LINK_SETTINGS_CONTROLS = [
3264
+ {
3265
+ id: "cacheOptions",
3266
+ type: "checkbox",
3267
+ label: "Кеширование вычисляемых настроек",
3268
+ initialValue: LINK_SETTINGS.cacheOptions,
3269
+ },
3270
+ {
3271
+ id: "prettyDraw",
3272
+ type: "checkbox",
3273
+ label: "Обсчет корректного соединения",
3274
+ initialValue: LINK_SETTINGS.prettyDraw,
3275
+ },
3276
+ {
3277
+ id: "linkScaleSwitch",
3278
+ initialValue: LINK_SETTINGS.linkScaleSwitch,
3279
+ max: 20,
3280
+ min: 0,
3281
+ step: 0.01,
3282
+ type: "range",
3283
+ label: "Граница зума для связи",
3284
+ },
3285
+ {
3286
+ id: "linkWidthAfterScaleSwitch",
3287
+ initialValue: LINK_SETTINGS.linkWidthAfterScaleSwitch,
3288
+ max: 20,
3289
+ min: 0,
3290
+ step: 0.01,
3291
+ type: "range",
3292
+ label: "Размер связи после границы зума",
3293
+ },
3294
+ {
3295
+ id: "linkWidthBeforeScaleSwitch",
3296
+ initialValue: LINK_SETTINGS.linkWidthBeforeScaleSwitch,
3297
+ max: 20,
3298
+ min: 0,
3299
+ step: 0.01,
3300
+ type: "range",
3301
+ label: "Размер связи до границы зума",
3302
+ },
3303
+ {
3304
+ id: "linkColorAfterScaleSwitch",
3305
+ type: "color",
3306
+ initialValue: LINK_SETTINGS.linkColorAfterScaleSwitch,
3307
+ label: "Цвет связи после границы зума",
3308
+ },
3309
+ {
3310
+ id: "linkColorBeforeScaleSwitch",
3311
+ type: "color",
3312
+ initialValue: LINK_SETTINGS.linkColorBeforeScaleSwitch,
3313
+ label: "Цвет связи до границы зума",
3314
+ },
3315
+ {
3316
+ id: "arrow",
3317
+ type: "checkbox",
3318
+ label: "Стрелка",
3319
+ initialValue: LINK_SETTINGS.arrow,
3320
+ },
3321
+ {
3322
+ id: "arrowByHighlight",
3323
+ type: "checkbox",
3324
+ label: "Появление стрелки при анимации",
3325
+ initialValue: LINK_SETTINGS.arrowByHighlight,
3326
+ },
3327
+ {
3328
+ id: "particles",
3329
+ type: "checkbox",
3330
+ label: "Частицы",
3331
+ initialValue: LINK_SETTINGS.particles,
3332
+ },
3333
+ {
3334
+ id: "particleFlexSpeed",
3335
+ type: "checkbox",
3336
+ label: "Гибкий расчет скорости частицы",
3337
+ initialValue: LINK_SETTINGS.particleFlexSpeed,
3338
+ },
3339
+ {
3340
+ id: "particleFlexSpeedCoefficient",
3341
+ initialValue: LINK_SETTINGS.particleFlexSpeedCoefficient,
3342
+ max: 10,
3343
+ min: 0.1,
3344
+ step: 0.1,
3345
+ type: "range",
3346
+ label: "Коэффициент скорости частицы относительно расстояния",
3347
+ },
3348
+ ];
3349
+ const LINK_OPTIONS_LINK_CONTROLS = [
3350
+ {
3351
+ id: "alpha",
3352
+ type: "range",
3353
+ max: 1,
3354
+ min: 0,
3355
+ step: 0.1,
3356
+ label: "Прозрачность",
3357
+ initialValue: LINK_OPTIONS.alpha,
3358
+ },
3359
+ {
3360
+ id: "width",
3361
+ type: "range",
3362
+ max: 10,
3363
+ min: 0.1,
3364
+ step: 0.1,
3365
+ label: "Толщина",
3366
+ initialValue: 0.1,
3367
+ },
3368
+ {
3369
+ id: "color",
3370
+ type: "color",
3371
+ initialValue: "#000000FF",
3372
+ label: "Цвет",
3373
+ },
3374
+ ];
3375
+ const LINK_OPTIONS_ARROW_CONTROLS = [
3376
+ {
3377
+ id: "arrowColor",
3378
+ type: "color",
3379
+ initialValue: "#000000FF",
3380
+ label: "Цвет стрелки",
3381
+ },
3382
+ {
3383
+ id: "arrowAlpha",
3384
+ type: "range",
3385
+ max: 1,
3386
+ min: 0,
3387
+ step: 0.1,
3388
+ label: "Прозрачность",
3389
+ initialValue: LINK_OPTIONS.arrowAlpha,
3390
+ },
3391
+ {
3392
+ id: "arrowSize",
3393
+ type: "range",
3394
+ max: 10,
3395
+ min: 0.1,
3396
+ step: 0.1,
3397
+ label: "Размер",
3398
+ initialValue: LINK_OPTIONS.arrowSize,
3399
+ },
3400
+ {
3401
+ id: "arrowBorderColor",
3402
+ type: "color",
3403
+ initialValue: LINK_OPTIONS.arrowBorderColor,
3404
+ label: "Цвет границы",
3405
+ },
3406
+ {
3407
+ id: "arrowBorderWidth",
3408
+ type: "range",
3409
+ max: 10,
3410
+ min: 0,
3411
+ step: 0.1,
3412
+ label: "Размер границы",
3413
+ initialValue: LINK_OPTIONS.arrowBorderWidth,
3414
+ },
3415
+ ];
3416
+ const LINK_OPTIONS_PARTICLE_CONTROLS = [
3417
+ {
3418
+ id: "particleColor",
3419
+ type: "color",
3420
+ initialValue: LINK_OPTIONS.particleColor,
3421
+ label: "Цвет",
3422
+ },
3423
+ {
3424
+ id: "particleAlpha",
3425
+ type: "range",
3426
+ max: 1,
3427
+ min: 0,
3428
+ step: 0.1,
3429
+ label: "Прозрачность",
3430
+ initialValue: LINK_OPTIONS.particleAlpha,
3431
+ },
3432
+ {
3433
+ id: "particleRadius",
3434
+ type: "range",
3435
+ max: 10,
3436
+ min: 0.1,
3437
+ step: 0.1,
3438
+ label: "Радиус",
3439
+ initialValue: LINK_OPTIONS.particleRadius,
3440
+ },
3441
+ {
3442
+ id: "particleCount",
3443
+ type: "range",
3444
+ max: 20,
3445
+ min: 1,
3446
+ step: 1,
3447
+ label: "Количество",
3448
+ initialValue: LINK_OPTIONS.particleCount,
3449
+ },
3450
+ {
3451
+ id: "particleSteps",
3452
+ type: "range",
3453
+ max: 200,
3454
+ min: 1,
3455
+ step: 1,
3456
+ label: "Количество кадров",
3457
+ initialValue: LINK_OPTIONS.particleSteps,
3458
+ },
3459
+ {
3460
+ id: "particleBorderColor",
3461
+ type: "color",
3462
+ initialValue: LINK_OPTIONS.particleBorderColor,
3463
+ label: "Цвет границы",
3464
+ },
3465
+ {
3466
+ id: "particleBorderWidth",
3467
+ type: "range",
3468
+ max: 10,
3469
+ min: 0,
3470
+ step: 0.1,
3471
+ label: "Размер границы",
3472
+ initialValue: LINK_OPTIONS.particleBorderWidth,
3473
+ },
3474
+ ];
3475
+
3476
+ const NODE_SETTINGS_CONTROLS = [
3477
+ {
3478
+ id: "cacheOptions",
3479
+ type: "checkbox",
3480
+ initialValue: NODE_SETTINGS.cacheOptions,
3481
+ label: "Кеширование вычисляемых настроек",
3482
+ },
3483
+ {
3484
+ id: "textNodeDebug",
3485
+ type: "checkbox",
3486
+ initialValue: NODE_SETTINGS.textNodeDebug,
3487
+ label: "Отладка текстовой вершины",
3488
+ },
3489
+ {
3490
+ id: "nodeRadiusFlexible",
3491
+ type: "checkbox",
3492
+ initialValue: NODE_SETTINGS.nodeRadiusFlexible,
3493
+ label: "Гибкий радиус (только для круга)",
3494
+ },
3495
+ {
3496
+ id: "nodeRadiusCoefficient",
3497
+ initialValue: NODE_SETTINGS.nodeRadiusCoefficient,
3498
+ max: 100,
3499
+ min: 0.1,
3500
+ step: 0.1,
3501
+ type: "range",
3502
+ label: "Количество связей для увеличения радиуса (только для круга)",
3503
+ },
3504
+ {
3505
+ id: "nodeRadiusFactor",
3506
+ initialValue: NODE_SETTINGS.nodeRadiusFactor,
3507
+ max: 50,
3508
+ min: 0.1,
3509
+ step: 0.1,
3510
+ type: "range",
3511
+ label: "Коэффициент увеличения радиуса (только для круга)",
3512
+ },
3513
+ {
3514
+ id: "nodeSizeFlexible",
3515
+ type: "checkbox",
3516
+ initialValue: NODE_SETTINGS.nodeSizeFlexible,
3517
+ label: "Гибкий размер (только не для круга)",
3518
+ },
3519
+ {
3520
+ id: "nodeSizeCoefficient",
3521
+ initialValue: NODE_SETTINGS.nodeSizeCoefficient,
3522
+ max: 50,
3523
+ min: 0.1,
3524
+ step: 0.1,
3525
+ type: "range",
3526
+ label: "Количество связей для увеличения размера (только не для круга)",
3527
+ },
3528
+ {
3529
+ id: "nodeSizeFactor",
3530
+ initialValue: NODE_SETTINGS.nodeSizeFactor,
3531
+ max: 20,
3532
+ min: 0.01,
3533
+ step: 0.01,
3534
+ type: "range",
3535
+ label: "Коэффициент увеличения размера (только не для круга)",
3536
+ },
3537
+ {
3538
+ id: "textScaleMin",
3539
+ initialValue: NODE_SETTINGS.textScaleMin,
3540
+ max: 20,
3541
+ min: 0,
3542
+ step: 0.01,
3543
+ type: "range",
3544
+ label: "Минимальная граница зума для текста",
3545
+ },
3546
+ {
3547
+ id: "textScaleMax",
3548
+ initialValue: NODE_SETTINGS.textScaleMax,
3549
+ max: 20,
3550
+ min: 0,
3551
+ step: 0.01,
3552
+ type: "range",
3553
+ label: "Максимальная граница зума для текста",
3554
+ },
3555
+ {
3556
+ id: "textSizeMin",
3557
+ initialValue: NODE_SETTINGS.textSizeMin,
3558
+ max: 20,
3559
+ min: 0,
3560
+ step: 0.01,
3561
+ type: "range",
3562
+ label: "Размер текста на минимальной границе зума",
3563
+ },
3564
+ {
3565
+ id: "textSizeMax",
3566
+ initialValue: NODE_SETTINGS.textSizeMax,
3567
+ max: 20,
3568
+ min: 0,
3569
+ step: 0.01,
3570
+ type: "range",
3571
+ label: "Размер текста на максимальной границе зума",
3572
+ },
3573
+ {
3574
+ id: "textShiftYMin",
3575
+ initialValue: NODE_SETTINGS.textShiftYMin,
3576
+ max: 20,
3577
+ min: 0,
3578
+ step: 0.01,
3579
+ type: "range",
3580
+ label: "Смещение текста по оси Y на минимальной границе зума",
3581
+ },
3582
+ {
3583
+ id: "textShiftYMax",
3584
+ initialValue: NODE_SETTINGS.textShiftYMax,
3585
+ max: 20,
3586
+ min: 0,
3587
+ step: 0.01,
3588
+ type: "range",
3589
+ label: "Смещение текста по оси Y на максимальной границе зума",
3590
+ },
3591
+ ];
3592
+ const NODE_OPTIONS_NODE_CONTROLS = [
3593
+ {
3594
+ id: "shape",
3595
+ type: "select",
3596
+ initialValue: NODE_OPTIONS.shape,
3597
+ label: "Форма",
3598
+ options: [
3599
+ { label: "Картинки", value: "icon" },
3600
+ { label: "Круг", value: "circle" },
3601
+ { label: "Прямоугольник", value: "square" },
3602
+ { label: "Текст", value: "text" },
3603
+ ],
3604
+ },
3605
+ {
3606
+ id: "color",
3607
+ type: "color",
3608
+ initialValue: "#000000FF",
3609
+ label: "Цвет",
3610
+ },
3611
+ {
3612
+ id: "alpha",
3613
+ type: "range",
3614
+ max: 1,
3615
+ min: 0,
3616
+ step: 0.1,
3617
+ label: "Прозрачность",
3618
+ initialValue: NODE_OPTIONS.alpha,
3619
+ },
3620
+ {
3621
+ id: "radius",
3622
+ type: "range",
3623
+ max: 50,
3624
+ min: 1,
3625
+ step: 0.1,
3626
+ label: "Радиус (только для круга)",
3627
+ initialValue: NODE_OPTIONS.radius,
3628
+ },
3629
+ {
3630
+ id: "width",
3631
+ type: "range",
3632
+ max: 50,
3633
+ min: 1,
3634
+ step: 1,
3635
+ label: "Ширина (только не для круга)",
3636
+ initialValue: NODE_OPTIONS.width,
3637
+ },
3638
+ {
3639
+ id: "height",
3640
+ type: "range",
3641
+ max: 50,
3642
+ min: 1,
3643
+ step: 1,
3644
+ label: "Высота (только не для круга)",
3645
+ initialValue: NODE_OPTIONS.height,
3646
+ },
3647
+ {
3648
+ id: "borderColor",
3649
+ type: "color",
3650
+ initialValue: "#000000FF",
3651
+ label: "Цвет границы",
3652
+ },
3653
+ {
3654
+ id: "borderWidth",
3655
+ type: "range",
3656
+ max: 5,
3657
+ min: 0,
3658
+ step: 0.1,
3659
+ label: "Толщина границы",
3660
+ initialValue: NODE_OPTIONS.borderWidth,
3661
+ },
3662
+ {
3663
+ id: "borderRadius",
3664
+ type: "range",
3665
+ max: 50,
3666
+ min: 0,
3667
+ step: 1,
3668
+ label: "Радиус границы (только не для круга)",
3669
+ initialValue: NODE_OPTIONS.borderRadius,
3670
+ },
3671
+ ];
3672
+ const NODE_OPTIONS_TEXT_CONTROLS = [
3673
+ {
3674
+ id: "textColor",
3675
+ type: "color",
3676
+ initialValue: NODE_OPTIONS.textColor,
3677
+ label: "Цвет",
3678
+ },
3679
+ {
3680
+ id: "textSize",
3681
+ type: "range",
3682
+ max: 30,
3683
+ min: 0,
3684
+ step: 0.1,
3685
+ label: "Размер",
3686
+ initialValue: 0,
3687
+ },
3688
+ {
3689
+ id: "textAlpha",
3690
+ type: "range",
3691
+ max: 1,
3692
+ min: 0,
3693
+ step: 0.1,
3694
+ label: "Прозрачность",
3695
+ initialValue: NODE_OPTIONS.textAlpha,
3696
+ },
3697
+ {
3698
+ id: "textWidth",
3699
+ type: "range",
3700
+ max: 200,
3701
+ min: 5,
3702
+ step: 1,
3703
+ label: "Ширина",
3704
+ initialValue: NODE_OPTIONS.textWidth,
3705
+ },
3706
+ {
3707
+ id: "textShiftX",
3708
+ type: "range",
3709
+ max: 100,
3710
+ min: 0,
3711
+ step: 0.1,
3712
+ label: "Смещение по оси X",
3713
+ initialValue: NODE_OPTIONS.textShiftX,
3714
+ },
3715
+ {
3716
+ id: "textShiftY",
3717
+ type: "range",
3718
+ max: 100,
3719
+ min: 0,
3720
+ step: 0.1,
3721
+ label: "Смещение по оси Y",
3722
+ initialValue: 4,
3723
+ },
3724
+ {
3725
+ id: "textWeight",
3726
+ type: "range",
3727
+ max: 1000,
3728
+ min: 100,
3729
+ step: 100,
3730
+ label: "Жирность",
3731
+ initialValue: NODE_OPTIONS.textWeight,
3732
+ },
3733
+ {
3734
+ id: "textGap",
3735
+ type: "range",
3736
+ max: 30,
3737
+ min: 0,
3738
+ step: 0.1,
3739
+ label: "Расстояние между строками",
3740
+ initialValue: NODE_OPTIONS.textGap,
3741
+ },
3742
+ ];
3743
+ const NODE_OPTIONS_LABEL_CONTROLS = [
3744
+ {
3745
+ id: "labelColor",
3746
+ type: "color",
3747
+ initialValue: NODE_OPTIONS.labelColor,
3748
+ label: "Цвет",
3749
+ },
3750
+ {
3751
+ id: "labelSize",
3752
+ type: "range",
3753
+ max: 30,
3754
+ min: 0,
3755
+ step: 0.1,
3756
+ label: "Размер",
3757
+ initialValue: NODE_OPTIONS.labelSize,
3758
+ },
3759
+ {
3760
+ id: "labelAlpha",
3761
+ type: "range",
3762
+ max: 1,
3763
+ min: 0,
3764
+ step: 0.1,
3765
+ label: "Прозрачность",
3766
+ initialValue: NODE_OPTIONS.labelAlpha,
3767
+ },
3768
+ {
3769
+ id: "labelWidth",
3770
+ type: "range",
3771
+ max: 200,
3772
+ min: 5,
3773
+ step: 1,
3774
+ label: "Ширина",
3775
+ initialValue: NODE_OPTIONS.labelWidth,
3776
+ },
3777
+ {
3778
+ id: "labelWeight",
3779
+ type: "range",
3780
+ max: 1000,
3781
+ min: 100,
3782
+ step: 100,
3783
+ label: "Жирность",
3784
+ initialValue: NODE_OPTIONS.labelWeight,
3785
+ },
3786
+ {
3787
+ id: "labelGap",
3788
+ type: "range",
3789
+ max: 30,
3790
+ min: 0,
3791
+ step: 0.1,
3792
+ label: "Расстояние между строками",
3793
+ initialValue: NODE_OPTIONS.labelGap,
3794
+ },
3795
+ {
3796
+ id: "labelXPadding",
3797
+ type: "range",
3798
+ max: 30,
3799
+ min: 0,
3800
+ step: 0.1,
3801
+ label: "Отступы по оси X",
3802
+ initialValue: NODE_OPTIONS.labelXPadding,
3803
+ },
3804
+ {
3805
+ id: "labelYPadding",
3806
+ type: "range",
3807
+ max: 30,
3808
+ min: 0,
3809
+ step: 0.1,
3810
+ label: "Отступы по оси Y",
3811
+ initialValue: NODE_OPTIONS.labelYPadding,
3812
+ },
3813
+ ];
3814
+
3815
+ exports.COMMON_SETTINGS = COMMON_SETTINGS;
3816
+ exports.FORCE_CONTROLS = FORCE_CONTROLS;
3817
+ exports.FORCE_SETTINGS = FORCE_SETTINGS;
3818
+ exports.GRAPH_CONTROLS = GRAPH_CONTROLS;
3819
+ exports.GRAPH_SETTINGS = GRAPH_SETTINGS;
3268
3820
  exports.GraphCanvas = GraphCanvas;
3821
+ exports.HIGHLIGHT_BY_LINK_FOR_ARROW_CONTROLS = HIGHLIGHT_BY_LINK_FOR_ARROW_CONTROLS;
3822
+ exports.HIGHLIGHT_BY_LINK_FOR_LABEL_CONTROLS = HIGHLIGHT_BY_LINK_FOR_LABEL_CONTROLS;
3823
+ exports.HIGHLIGHT_BY_LINK_FOR_LINK_CONTROLS = HIGHLIGHT_BY_LINK_FOR_LINK_CONTROLS;
3824
+ exports.HIGHLIGHT_BY_LINK_FOR_NODE_CONTROLS = HIGHLIGHT_BY_LINK_FOR_NODE_CONTROLS;
3825
+ exports.HIGHLIGHT_BY_LINK_FOR_TEXT_CONTROLS = HIGHLIGHT_BY_LINK_FOR_TEXT_CONTROLS;
3826
+ exports.HIGHLIGHT_BY_NODE_FOR_ARROW_CONTROLS = HIGHLIGHT_BY_NODE_FOR_ARROW_CONTROLS;
3827
+ exports.HIGHLIGHT_BY_NODE_FOR_LABEL_CONTROLS = HIGHLIGHT_BY_NODE_FOR_LABEL_CONTROLS;
3828
+ exports.HIGHLIGHT_BY_NODE_FOR_LINK_CONTROLS = HIGHLIGHT_BY_NODE_FOR_LINK_CONTROLS;
3829
+ exports.HIGHLIGHT_BY_NODE_FOR_NODE_CONTROLS = HIGHLIGHT_BY_NODE_FOR_NODE_CONTROLS;
3830
+ exports.HIGHLIGHT_BY_NODE_FOR_TEXT_CONTROLS = HIGHLIGHT_BY_NODE_FOR_TEXT_CONTROLS;
3831
+ exports.HIGHLIGHT_COMMON_CONTROLS = HIGHLIGHT_COMMON_CONTROLS;
3832
+ exports.HIGHLIGHT_SETTINGS = HIGHLIGHT_SETTINGS;
3833
+ exports.LINK_OPTIONS = LINK_OPTIONS;
3834
+ exports.LINK_OPTIONS_ARROW_CONTROLS = LINK_OPTIONS_ARROW_CONTROLS;
3835
+ exports.LINK_OPTIONS_LINK_CONTROLS = LINK_OPTIONS_LINK_CONTROLS;
3836
+ exports.LINK_OPTIONS_PARTICLE_CONTROLS = LINK_OPTIONS_PARTICLE_CONTROLS;
3837
+ exports.LINK_SETTINGS = LINK_SETTINGS;
3838
+ exports.LINK_SETTINGS_CONTROLS = LINK_SETTINGS_CONTROLS;
3839
+ exports.NODE_OPTIONS = NODE_OPTIONS;
3840
+ exports.NODE_OPTIONS_LABEL_CONTROLS = NODE_OPTIONS_LABEL_CONTROLS;
3841
+ exports.NODE_OPTIONS_NODE_CONTROLS = NODE_OPTIONS_NODE_CONTROLS;
3842
+ exports.NODE_OPTIONS_TEXT_CONTROLS = NODE_OPTIONS_TEXT_CONTROLS;
3843
+ exports.NODE_SETTINGS = NODE_SETTINGS;
3844
+ exports.NODE_SETTINGS_CONTROLS = NODE_SETTINGS_CONTROLS;
3269
3845
  exports.animationByProgress = animationByProgress;
3270
3846
  exports.calculateLinkPositionByNode = calculateLinkPositionByNode;
3847
+ exports.colorGetter = colorGetter;
3271
3848
  exports.colorToRgb = colorToRgb;
3849
+ exports.dragPlaceCoefficientGetter = dragPlaceCoefficientGetter;
3272
3850
  exports.drawText = drawText;
3273
3851
  exports.extractRgb = extractRgb;
3274
3852
  exports.fadeRgb = fadeRgb;
3853
+ exports.forceSettingsGetter = forceSettingsGetter;
3275
3854
  exports.getDrawLink = getDrawLink;
3276
3855
  exports.getDrawNode = getDrawNode;
3277
- exports.getForceControls = getForceControls;
3278
- exports.getGraphControls = getGraphControls;
3279
- exports.getLinkOptionsControls = getLinkOptionsControls;
3280
- exports.getLinkSettingsControls = getLinkSettingsControls;
3281
- exports.getNodeOptionsControls = getNodeOptionsControls;
3282
- exports.getNodeSettingControls = getNodeSettingControls;
3283
3856
  exports.getParticlePosition = getParticlePosition;
3857
+ exports.graphSettingsGetter = graphSettingsGetter;
3858
+ exports.highlightSettingsGetter = highlightSettingsGetter;
3859
+ exports.isNodeVisible = isNodeVisible;
3860
+ exports.isOverlapsNode = isOverlapsNode;
3284
3861
  exports.linkByPointerGetter = linkByPointerGetter;
3862
+ exports.linkFade = linkFade;
3863
+ exports.linkHighlight = linkHighlight;
3285
3864
  exports.linkIterationExtractor = linkIterationExtractor;
3286
3865
  exports.linkOptionsGetter = linkOptionsGetter;
3866
+ exports.linkSettingsGetter = linkSettingsGetter;
3867
+ exports.listenersGetter = listenersGetter;
3287
3868
  exports.nodeByPointerGetter = nodeByPointerGetter;
3869
+ exports.nodeFade = nodeFade;
3870
+ exports.nodeHighlight = nodeHighlight;
3871
+ exports.nodeIdGetter = nodeIdGetter;
3288
3872
  exports.nodeIterationExtractor = nodeIterationExtractor;
3289
3873
  exports.nodeOptionsGetter = nodeOptionsGetter;
3290
3874
  exports.nodeRadiusGetter = nodeRadiusGetter;
3875
+ exports.nodeSettingsGetter = nodeSettingsGetter;
3876
+ exports.nodeSizeGetter = nodeSizeGetter;
3877
+ exports.nodeTextSizeGetter = nodeTextSizeGetter;
3878
+ exports.pointerGetter = pointerGetter;
3291
3879
  exports.rgbAnimationByProgress = rgbAnimationByProgress;
3292
3880
  //# sourceMappingURL=index.cjs.map