@krainovsd/graph 0.9.0 → 0.10.0-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.cjs +2633 -1795
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/index.js +12 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/lib/draw-time.js +5 -1
- package/lib/esm/lib/draw-time.js.map +1 -1
- package/lib/esm/lib/get-controls-info.js +451 -224
- package/lib/esm/lib/get-controls-info.js.map +1 -1
- package/lib/esm/module/GraphCanvas/GraphCanvas.js +39 -927
- package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/settings.js +70 -47
- package/lib/esm/module/GraphCanvas/constants/settings.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js +10 -1
- package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js +270 -0
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js.map +1 -0
- package/lib/esm/module/GraphCanvas/lib/utils/drag-place-coefficient-getter.js +2 -2
- package/lib/esm/module/GraphCanvas/lib/utils/drag-place-coefficient-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/get-particle-position.js +19 -4
- package/lib/esm/module/GraphCanvas/lib/utils/get-particle-position.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/is-node-visible.js +29 -4
- package/lib/esm/module/GraphCanvas/lib/utils/is-node-visible.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/is-overlaps-node.js +53 -4
- package/lib/esm/module/GraphCanvas/lib/utils/is-overlaps-node.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js +2 -2
- package/lib/esm/module/GraphCanvas/lib/utils/link-by-pointer-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/node-by-pointer-getter.js +3 -13
- package/lib/esm/module/GraphCanvas/lib/utils/node-by-pointer-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/draw-links.js +207 -0
- package/lib/esm/module/GraphCanvas/slices/draw-links.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/draw-nodes.js +342 -0
- package/lib/esm/module/GraphCanvas/slices/draw-nodes.js.map +1 -0
- package/lib/esm/module/GraphCanvas/{lib/utils → slices}/draw-text.js +23 -6
- package/lib/esm/module/GraphCanvas/slices/draw-text.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-area.js +31 -0
- package/lib/esm/module/GraphCanvas/slices/init-area.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-dnd.js +62 -0
- package/lib/esm/module/GraphCanvas/slices/init-dnd.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-draw.js +84 -0
- package/lib/esm/module/GraphCanvas/slices/init-draw.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-pointer.js +211 -0
- package/lib/esm/module/GraphCanvas/slices/init-pointer.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-resize.js +28 -0
- package/lib/esm/module/GraphCanvas/slices/init-resize.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-simulation.js +172 -0
- package/lib/esm/module/GraphCanvas/slices/init-simulation.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-zoom.js +36 -0
- package/lib/esm/module/GraphCanvas/slices/init-zoom.js.map +1 -0
- package/lib/index.d.ts +169 -132
- package/package.json +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-radius.js +0 -20
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-radius.js.map +0 -1
- package/lib/esm/module/GraphCanvas/lib/utils/draw-text.js.map +0 -1
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { linkOptionsGetter } from '../lib/settings/link-settings-getter.js';
|
|
2
|
+
import '@krainovsd/js-helpers';
|
|
3
|
+
import { linkIterationExtractor } from '../lib/utils/link-iteration-extractor.js';
|
|
4
|
+
import 'd3-array';
|
|
5
|
+
import { calculateLinkPositionByNode } from '../lib/utils/calculate-link-position-by-node.js';
|
|
6
|
+
import { animationByProgress } from '../lib/utils/animation-by-progress.js';
|
|
7
|
+
import { getParticlePosition } from '../lib/utils/get-particle-position.js';
|
|
8
|
+
|
|
9
|
+
function getDrawLink(state) {
|
|
10
|
+
return function drawLink(link, index) {
|
|
11
|
+
if (!this.context ||
|
|
12
|
+
typeof link.source !== "object" ||
|
|
13
|
+
typeof link.target !== "object" ||
|
|
14
|
+
!link.source.x ||
|
|
15
|
+
!link.source.y ||
|
|
16
|
+
!link.target.x ||
|
|
17
|
+
!link.target.y)
|
|
18
|
+
return;
|
|
19
|
+
if (!link.source._visible && !link.target._visible)
|
|
20
|
+
return;
|
|
21
|
+
const id = `${link.target.id}${link.source.id}`;
|
|
22
|
+
let linkOptions;
|
|
23
|
+
if (this.linkSettings.cache && this.linkOptionsCache[id]) {
|
|
24
|
+
linkOptions = this.linkOptionsCache[id];
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
linkOptions = linkIterationExtractor(link, index, this.links, state, this.linkSettings.options ?? {}, linkOptionsGetter);
|
|
28
|
+
if (this.linkSettings.cache) {
|
|
29
|
+
this.linkOptionsCache[id] = linkOptions;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (linkOptions.drawLink) {
|
|
33
|
+
linkOptions.drawLink(link, linkOptions, state);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
let alpha = linkOptions.alpha;
|
|
37
|
+
let arrowAlpha = this.linkSettings.arrowByHighlight ? 0 : linkOptions.arrowAlpha;
|
|
38
|
+
/** NODE HIGHLIGHT */
|
|
39
|
+
if (this.highlightedNeighbors && this.highlightedNode) {
|
|
40
|
+
/** Not highlighted */
|
|
41
|
+
if (this.highlightedNode.id != link.source.id && this.highlightedNode.id != link.target.id) {
|
|
42
|
+
if (this.linkSettings.highlightByNodeLinkFading) {
|
|
43
|
+
const min = this.linkSettings.highlightByNodeLinkFadingMin < alpha
|
|
44
|
+
? this.linkSettings.highlightByNodeLinkFadingMin
|
|
45
|
+
: alpha;
|
|
46
|
+
alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);
|
|
47
|
+
}
|
|
48
|
+
if (this.linkSettings.arrow &&
|
|
49
|
+
this.linkSettings.highlightByNodeArrowFading &&
|
|
50
|
+
!this.linkSettings.arrowByHighlight) {
|
|
51
|
+
const min = this.linkSettings.highlightByNodeArrowFadingMin < arrowAlpha
|
|
52
|
+
? this.linkSettings.highlightByNodeArrowFadingMin
|
|
53
|
+
: arrowAlpha;
|
|
54
|
+
arrowAlpha = animationByProgress(min, arrowAlpha - min, 1 - this.highlightProgress);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// eslint-disable-next-line no-lonely-if
|
|
59
|
+
if (this.linkSettings.arrow && this.linkSettings.arrowByHighlight) {
|
|
60
|
+
/** Highlighted */
|
|
61
|
+
arrowAlpha = animationByProgress(0, linkOptions.arrowAlpha, this.highlightProgress);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/** LINK HIGHLIGHT */
|
|
66
|
+
if (this.highlightedNeighbors && this.highlightedLink) {
|
|
67
|
+
/** Not highlighted */
|
|
68
|
+
if (this.highlightedLink !== link) {
|
|
69
|
+
if (this.linkSettings.highlightByLinkLinkFading) {
|
|
70
|
+
const min = this.linkSettings.highlightByLinkLinkFadingMin < alpha
|
|
71
|
+
? this.linkSettings.highlightByLinkLinkFadingMin
|
|
72
|
+
: alpha;
|
|
73
|
+
alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);
|
|
74
|
+
}
|
|
75
|
+
if (this.linkSettings.arrow &&
|
|
76
|
+
this.linkSettings.highlightByLinkArrowFading &&
|
|
77
|
+
!this.linkSettings.arrowByHighlight) {
|
|
78
|
+
const min = this.linkSettings.highlightByLinkArrowFadingMin < arrowAlpha
|
|
79
|
+
? this.linkSettings.highlightByLinkArrowFadingMin
|
|
80
|
+
: arrowAlpha;
|
|
81
|
+
arrowAlpha = animationByProgress(min, arrowAlpha - min, 1 - this.highlightProgress);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// eslint-disable-next-line no-lonely-if
|
|
86
|
+
if (this.linkSettings.arrow && this.linkSettings.arrowByHighlight) {
|
|
87
|
+
/** Highlighted */
|
|
88
|
+
arrowAlpha = animationByProgress(0, linkOptions.arrowAlpha, this.highlightProgress);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** Link */
|
|
93
|
+
this.context.beginPath();
|
|
94
|
+
this.context.globalAlpha = alpha;
|
|
95
|
+
this.context.strokeStyle = linkOptions.color;
|
|
96
|
+
this.context.lineWidth = linkOptions.width;
|
|
97
|
+
let xStart = link.source.x;
|
|
98
|
+
let yStart = link.source.y;
|
|
99
|
+
let xEnd = link.target.x;
|
|
100
|
+
let yEnd = link.target.y;
|
|
101
|
+
let linkDistance = 0;
|
|
102
|
+
if (this.linkSettings.pretty || this.linkSettings.particleFlexSpeed) {
|
|
103
|
+
const isHasArrow = this.linkSettings.arrow && arrowAlpha > 0;
|
|
104
|
+
const position = calculateLinkPositionByNode(link, isHasArrow ? linkOptions.arrowSize : 0);
|
|
105
|
+
if (position) {
|
|
106
|
+
xStart = position.x1;
|
|
107
|
+
xEnd = position.x2;
|
|
108
|
+
yStart = position.y1;
|
|
109
|
+
yEnd = position.y2;
|
|
110
|
+
linkDistance = position.distance;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
this.context.moveTo(xStart, yStart);
|
|
114
|
+
this.context.lineTo(xEnd, yEnd);
|
|
115
|
+
this.context.stroke();
|
|
116
|
+
/** Particle */
|
|
117
|
+
if (this.linkSettings.particles &&
|
|
118
|
+
((this.highlightedNode &&
|
|
119
|
+
(this.highlightedNode.id === link.source.id ||
|
|
120
|
+
this.highlightedNode.id === link.target.id)) ||
|
|
121
|
+
(this.highlightedLink && this.highlightedLink === link))) {
|
|
122
|
+
const particleSteps = this.linkSettings.particleFlexSpeed
|
|
123
|
+
? linkDistance <= 0
|
|
124
|
+
? 0
|
|
125
|
+
: linkDistance * this.linkSettings.particleFlexSpeedCoefficient
|
|
126
|
+
: linkOptions.particleSteps;
|
|
127
|
+
const particleCount = linkOptions.particleCount;
|
|
128
|
+
if (!this.particles[id]) {
|
|
129
|
+
const sourceId = link.source.id;
|
|
130
|
+
const targetId = link.target.id;
|
|
131
|
+
const particles = [];
|
|
132
|
+
let prevParticle;
|
|
133
|
+
for (let i = 0; i < particleCount; i++) {
|
|
134
|
+
const particle = {
|
|
135
|
+
step: 0,
|
|
136
|
+
sourceId,
|
|
137
|
+
targetId,
|
|
138
|
+
prev: prevParticle,
|
|
139
|
+
next: undefined,
|
|
140
|
+
index: i,
|
|
141
|
+
};
|
|
142
|
+
if (prevParticle)
|
|
143
|
+
prevParticle.next = particle;
|
|
144
|
+
particles.push(particle);
|
|
145
|
+
prevParticle = particle;
|
|
146
|
+
}
|
|
147
|
+
if (particles.length >= 2) {
|
|
148
|
+
particles[0].prev = particles[particles.length - 1];
|
|
149
|
+
particles[particles.length - 1].next = particles[0];
|
|
150
|
+
}
|
|
151
|
+
this.particles[id] = particles;
|
|
152
|
+
}
|
|
153
|
+
if (particleSteps !== 0) {
|
|
154
|
+
this.particles[id].forEach((particle) => {
|
|
155
|
+
if (!this.context)
|
|
156
|
+
return;
|
|
157
|
+
const distance = particleSteps / particleCount;
|
|
158
|
+
getParticlePosition({
|
|
159
|
+
distance,
|
|
160
|
+
particle,
|
|
161
|
+
totalSteps: particleSteps,
|
|
162
|
+
xEnd,
|
|
163
|
+
xStart,
|
|
164
|
+
yEnd,
|
|
165
|
+
yStart,
|
|
166
|
+
});
|
|
167
|
+
if (particle.x != undefined && particle.y != undefined) {
|
|
168
|
+
this.context.beginPath();
|
|
169
|
+
this.context.strokeStyle = linkOptions.particleBorderColor;
|
|
170
|
+
this.context.lineWidth = linkOptions.particleBorderWidth;
|
|
171
|
+
this.context.arc(particle.x, particle.y, linkOptions.particleRadius, 0, Math.PI * 2);
|
|
172
|
+
this.context.fillStyle = linkOptions.particleColor;
|
|
173
|
+
this.context.fill();
|
|
174
|
+
this.context.stroke();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/** Arrow */
|
|
180
|
+
if (this.linkSettings.arrow && arrowAlpha > 0) {
|
|
181
|
+
const { x1: xStart, x2: xEnd, y1: yStart, y2: yEnd, } = calculateLinkPositionByNode(link) ?? {
|
|
182
|
+
x1: 0,
|
|
183
|
+
x2: 0,
|
|
184
|
+
y1: 0,
|
|
185
|
+
y2: 0,
|
|
186
|
+
};
|
|
187
|
+
this.context.beginPath();
|
|
188
|
+
this.context.globalAlpha = arrowAlpha;
|
|
189
|
+
this.context.strokeStyle = linkOptions.arrowBorderColor;
|
|
190
|
+
this.context.lineWidth = linkOptions.arrowBorderWidth;
|
|
191
|
+
this.context.fillStyle = linkOptions.arrowColor;
|
|
192
|
+
const angle = Math.atan2(yEnd - yStart, xEnd - xStart);
|
|
193
|
+
this.context.moveTo(xEnd, yEnd);
|
|
194
|
+
this.context.lineTo(xEnd - linkOptions.arrowSize * Math.cos(angle - Math.PI / 6), yEnd - linkOptions.arrowSize * Math.sin(angle - Math.PI / 6));
|
|
195
|
+
this.context.lineTo(xEnd - linkOptions.arrowSize * Math.cos(angle + Math.PI / 6), yEnd - linkOptions.arrowSize * Math.sin(angle + Math.PI / 6));
|
|
196
|
+
this.context.closePath();
|
|
197
|
+
this.context.fill();
|
|
198
|
+
this.context.stroke();
|
|
199
|
+
}
|
|
200
|
+
if (linkOptions.drawExtraLink) {
|
|
201
|
+
linkOptions.drawExtraLink(link, { ...linkOptions, alpha }, state);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export { getDrawLink };
|
|
207
|
+
//# sourceMappingURL=draw-links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draw-links.js","sources":["../../../../../src/module/GraphCanvas/slices/draw-links.ts"],"sourcesContent":["import type { LinkInterface } from \"@/types\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport {\n animationByProgress,\n calculateLinkPositionByNode,\n getParticlePosition,\n linkIterationExtractor,\n linkOptionsGetter,\n} from \"../lib\";\nimport type { GraphParticle, GraphState, LinkOptionsInterface } from \"../types\";\n\nexport function getDrawLink<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(state: GraphState<NodeData, LinkData>) {\n return function drawLink(\n this: GraphCanvas<NodeData, LinkData>,\n link: LinkInterface<NodeData, LinkData>,\n index: number,\n ) {\n if (\n !this.context ||\n typeof link.source !== \"object\" ||\n typeof link.target !== \"object\" ||\n !link.source.x ||\n !link.source.y ||\n !link.target.x ||\n !link.target.y\n )\n return;\n\n if (!link.source._visible && !link.target._visible) return;\n\n const id = `${link.target.id}${link.source.id}`;\n let linkOptions: Required<LinkOptionsInterface<NodeData, LinkData>>;\n if (this.linkSettings.cache && this.linkOptionsCache[id]) {\n linkOptions = this.linkOptionsCache[id];\n } else {\n linkOptions = linkIterationExtractor(\n link,\n index,\n this.links,\n state,\n this.linkSettings.options ?? {},\n linkOptionsGetter,\n );\n if (this.linkSettings.cache) {\n this.linkOptionsCache[id] = linkOptions;\n }\n }\n\n if (linkOptions.drawLink) {\n linkOptions.drawLink(link, linkOptions, state);\n\n return;\n }\n\n let alpha = linkOptions.alpha;\n let arrowAlpha = this.linkSettings.arrowByHighlight ? 0 : linkOptions.arrowAlpha;\n\n /** NODE HIGHLIGHT */\n if (this.highlightedNeighbors && this.highlightedNode) {\n /** Not highlighted */\n if (this.highlightedNode.id != link.source.id && this.highlightedNode.id != link.target.id) {\n if (this.linkSettings.highlightByNodeLinkFading) {\n const min =\n this.linkSettings.highlightByNodeLinkFadingMin < alpha\n ? this.linkSettings.highlightByNodeLinkFadingMin\n : alpha;\n alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);\n }\n if (\n this.linkSettings.arrow &&\n this.linkSettings.highlightByNodeArrowFading &&\n !this.linkSettings.arrowByHighlight\n ) {\n const min =\n this.linkSettings.highlightByNodeArrowFadingMin < arrowAlpha\n ? this.linkSettings.highlightByNodeArrowFadingMin\n : arrowAlpha;\n arrowAlpha = animationByProgress(min, arrowAlpha - min, 1 - this.highlightProgress);\n }\n } else {\n // eslint-disable-next-line no-lonely-if\n if (this.linkSettings.arrow && this.linkSettings.arrowByHighlight) {\n /** Highlighted */\n arrowAlpha = animationByProgress(0, linkOptions.arrowAlpha, this.highlightProgress);\n }\n }\n }\n /** LINK HIGHLIGHT */\n if (this.highlightedNeighbors && this.highlightedLink) {\n /** Not highlighted */\n if (this.highlightedLink !== link) {\n if (this.linkSettings.highlightByLinkLinkFading) {\n const min =\n this.linkSettings.highlightByLinkLinkFadingMin < alpha\n ? this.linkSettings.highlightByLinkLinkFadingMin\n : alpha;\n alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);\n }\n if (\n this.linkSettings.arrow &&\n this.linkSettings.highlightByLinkArrowFading &&\n !this.linkSettings.arrowByHighlight\n ) {\n const min =\n this.linkSettings.highlightByLinkArrowFadingMin < arrowAlpha\n ? this.linkSettings.highlightByLinkArrowFadingMin\n : arrowAlpha;\n arrowAlpha = animationByProgress(min, arrowAlpha - min, 1 - this.highlightProgress);\n }\n } else {\n // eslint-disable-next-line no-lonely-if\n if (this.linkSettings.arrow && this.linkSettings.arrowByHighlight) {\n /** Highlighted */\n arrowAlpha = animationByProgress(0, linkOptions.arrowAlpha, this.highlightProgress);\n }\n }\n }\n\n /** Link */\n this.context.beginPath();\n\n this.context.globalAlpha = alpha;\n this.context.strokeStyle = linkOptions.color;\n this.context.lineWidth = linkOptions.width;\n\n let xStart = link.source.x;\n let yStart = link.source.y;\n let xEnd = link.target.x;\n let yEnd = link.target.y;\n let linkDistance = 0;\n if (this.linkSettings.pretty || this.linkSettings.particleFlexSpeed) {\n const isHasArrow = this.linkSettings.arrow && arrowAlpha > 0;\n const position = calculateLinkPositionByNode(link, isHasArrow ? linkOptions.arrowSize : 0);\n\n if (position) {\n xStart = position.x1;\n xEnd = position.x2;\n yStart = position.y1;\n yEnd = position.y2;\n linkDistance = position.distance;\n }\n }\n this.context.moveTo(xStart, yStart);\n this.context.lineTo(xEnd, yEnd);\n this.context.stroke();\n\n /** Particle */\n if (\n this.linkSettings.particles &&\n ((this.highlightedNode &&\n (this.highlightedNode.id === link.source.id ||\n this.highlightedNode.id === link.target.id)) ||\n (this.highlightedLink && this.highlightedLink === link))\n ) {\n const particleSteps = this.linkSettings.particleFlexSpeed\n ? linkDistance <= 0\n ? 0\n : linkDistance * this.linkSettings.particleFlexSpeedCoefficient\n : linkOptions.particleSteps;\n const particleCount = linkOptions.particleCount;\n\n if (!this.particles[id]) {\n const sourceId = link.source.id;\n const targetId = link.target.id;\n\n const particles: GraphParticle[] = [];\n let prevParticle: GraphParticle | undefined;\n\n for (let i = 0; i < particleCount; i++) {\n const particle: GraphParticle = {\n step: 0,\n sourceId,\n targetId,\n prev: prevParticle,\n next: undefined,\n index: i,\n };\n if (prevParticle) prevParticle.next = particle;\n particles.push(particle);\n prevParticle = particle;\n }\n if (particles.length >= 2) {\n particles[0].prev = particles[particles.length - 1];\n particles[particles.length - 1].next = particles[0];\n }\n this.particles[id] = particles;\n }\n\n if (particleSteps !== 0) {\n this.particles[id].forEach((particle) => {\n if (!this.context) return;\n\n const distance = particleSteps / particleCount;\n getParticlePosition({\n distance,\n particle,\n totalSteps: particleSteps,\n totalCount: particleCount,\n xEnd,\n xStart,\n yEnd,\n yStart,\n });\n if (particle.x != undefined && particle.y != undefined) {\n this.context.beginPath();\n this.context.strokeStyle = linkOptions.particleBorderColor;\n this.context.lineWidth = linkOptions.particleBorderWidth;\n this.context.arc(particle.x, particle.y, linkOptions.particleRadius, 0, Math.PI * 2);\n this.context.fillStyle = linkOptions.particleColor;\n this.context.fill();\n this.context.stroke();\n }\n });\n }\n }\n\n /** Arrow */\n if (this.linkSettings.arrow && arrowAlpha > 0) {\n const {\n x1: xStart,\n x2: xEnd,\n y1: yStart,\n y2: yEnd,\n } = calculateLinkPositionByNode(link) ?? {\n x1: 0,\n x2: 0,\n y1: 0,\n y2: 0,\n };\n\n this.context.beginPath();\n this.context.globalAlpha = arrowAlpha;\n this.context.strokeStyle = linkOptions.arrowBorderColor;\n this.context.lineWidth = linkOptions.arrowBorderWidth;\n this.context.fillStyle = linkOptions.arrowColor;\n const angle = Math.atan2(yEnd - yStart, xEnd - xStart);\n this.context.moveTo(xEnd, yEnd);\n this.context.lineTo(\n xEnd - linkOptions.arrowSize * Math.cos(angle - Math.PI / 6),\n yEnd - linkOptions.arrowSize * Math.sin(angle - Math.PI / 6),\n );\n this.context.lineTo(\n xEnd - linkOptions.arrowSize * Math.cos(angle + Math.PI / 6),\n yEnd - linkOptions.arrowSize * Math.sin(angle + Math.PI / 6),\n );\n this.context.closePath();\n this.context.fill();\n this.context.stroke();\n }\n\n if (linkOptions.drawExtraLink) {\n linkOptions.drawExtraLink(link, { ...linkOptions, alpha }, state);\n }\n };\n}\n"],"names":[],"mappings":";;;;;;;;AAWM,SAAU,WAAW,CAGzB,KAAqC,EAAA;AACrC,IAAA,OAAO,SAAS,QAAQ,CAEtB,IAAuC,EACvC,KAAa,EAAA;QAEb,IACE,CAAC,IAAI,CAAC,OAAO;AACb,YAAA,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;AAC/B,YAAA,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;AAC/B,YAAA,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACd,YAAA,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACd,YAAA,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC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+
import { colorToRgb } from '../../../lib/color-to-rgb.js';
|
|
3
|
+
import { extractRgb } from '../../../lib/extract-rgb.js';
|
|
4
|
+
import { fadeRgb } from '../../../lib/fade-rgb.js';
|
|
5
|
+
import { rgbAnimationByProgress } from '../../../lib/rgb-animation-by-progress.js';
|
|
6
|
+
import { nodeOptionsGetter, nodeRadiusGetter, nodeSizeGetter } from '../lib/settings/node-settings-getter.js';
|
|
7
|
+
import 'd3-array';
|
|
8
|
+
import { nodeIterationExtractor } from '../lib/utils/node-iteration-extractor.js';
|
|
9
|
+
import { animationByProgress } from '../lib/utils/animation-by-progress.js';
|
|
10
|
+
import { isNodeVisible } from '../lib/utils/is-node-visible.js';
|
|
11
|
+
import { getTextLines, drawText } from './draw-text.js';
|
|
12
|
+
|
|
13
|
+
function getDrawNode(nodeRenders, textRenders, state) {
|
|
14
|
+
return function drawNode(node, index) {
|
|
15
|
+
if (!this.context || !node.x || !node.y)
|
|
16
|
+
return;
|
|
17
|
+
let nodeOptions;
|
|
18
|
+
if (this.nodeSettings.cache && this.nodeOptionsCache[node.id]) {
|
|
19
|
+
nodeOptions = this.nodeOptionsCache[node.id];
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
nodeOptions = nodeIterationExtractor(node, index, this.nodes, state, this.nodeSettings.options ?? {}, nodeOptionsGetter);
|
|
23
|
+
if (this.nodeSettings.cache) {
|
|
24
|
+
this.nodeOptionsCache[node.id] = nodeOptions;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (nodeOptions.nodeDraw && nodeOptions.textDraw) {
|
|
28
|
+
nodeRenders.push(() => {
|
|
29
|
+
nodeOptions?.nodeDraw?.(node, nodeOptions, state);
|
|
30
|
+
});
|
|
31
|
+
textRenders.push(() => {
|
|
32
|
+
nodeOptions?.textDraw?.(node, nodeOptions, state);
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
let alpha = nodeOptions.alpha;
|
|
37
|
+
let color = nodeOptions.color;
|
|
38
|
+
let radiusInitial = nodeOptions.radius;
|
|
39
|
+
let widthInitial = nodeOptions.width;
|
|
40
|
+
let heightInitial = nodeOptions.height;
|
|
41
|
+
let textAlpha = nodeOptions.textAlpha;
|
|
42
|
+
let textSize = nodeOptions.textSize;
|
|
43
|
+
let textShiftX = nodeOptions.textShiftX;
|
|
44
|
+
let textShiftY = nodeOptions.textShiftY;
|
|
45
|
+
let textWeight = nodeOptions.textWeight;
|
|
46
|
+
let textWidth = nodeOptions.textWidth;
|
|
47
|
+
/** Node Highlight */
|
|
48
|
+
if (this.highlightedNeighbors && this.highlightedNode) {
|
|
49
|
+
/** Not highlighted */
|
|
50
|
+
if (!this.highlightedNeighbors.has(node.id) && this.highlightedNode.id != node.id) {
|
|
51
|
+
if (this.nodeSettings.highlightByNodeNodeFading) {
|
|
52
|
+
const min = this.nodeSettings.highlightByNodeNodeFadingMin < alpha
|
|
53
|
+
? this.nodeSettings.highlightByNodeNodeFadingMin
|
|
54
|
+
: alpha;
|
|
55
|
+
alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);
|
|
56
|
+
}
|
|
57
|
+
if (this.nodeSettings.highlightByNodeTextFading) {
|
|
58
|
+
const min = this.nodeSettings.highlightByNodeTextFadingMin < textAlpha
|
|
59
|
+
? this.nodeSettings.highlightByNodeTextFadingMin
|
|
60
|
+
: textAlpha;
|
|
61
|
+
textAlpha = animationByProgress(min, textAlpha - min, 1 - this.highlightProgress);
|
|
62
|
+
}
|
|
63
|
+
if (this.nodeSettings.highlightByNodeNodeColor) {
|
|
64
|
+
const colorRgb = extractRgb(colorToRgb(color));
|
|
65
|
+
if (colorRgb) {
|
|
66
|
+
const colorRgbFade = fadeRgb(colorRgb, this.nodeSettings.highlightByNodeNodeColorFadingMin);
|
|
67
|
+
const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbFade, this.highlightProgress);
|
|
68
|
+
color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else if (!this.nodeSettings.highlightByNodeOnlyRoot ||
|
|
73
|
+
(this.nodeSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)) {
|
|
74
|
+
/** Highlighted */
|
|
75
|
+
if (this.nodeSettings.highlightByNodeNodeSizing && nodeOptions.shape === "circle") {
|
|
76
|
+
radiusInitial = animationByProgress(radiusInitial, this.nodeSettings.highlightByNodeNodeSizingAdditional, this.highlightProgress);
|
|
77
|
+
}
|
|
78
|
+
if (this.nodeSettings.highlightByLinkNodeSizing &&
|
|
79
|
+
(nodeOptions.shape === "square" || nodeOptions.shape === "text")) {
|
|
80
|
+
const widthCoefficient = animationByProgress(1, this.nodeSettings.highlightByNodeNodeSizingAdditionalCoefficient, this.highlightProgress);
|
|
81
|
+
const heightCoefficient = animationByProgress(1, this.nodeSettings.highlightByNodeNodeSizingAdditionalCoefficient, this.highlightProgress);
|
|
82
|
+
widthInitial *= widthCoefficient;
|
|
83
|
+
heightInitial *= heightCoefficient;
|
|
84
|
+
}
|
|
85
|
+
if (this.nodeSettings.highlightByNodeTextSizing) {
|
|
86
|
+
textSize = animationByProgress(textSize, this.nodeSettings.highlightByNodeTextSizingAdditional, this.highlightProgress);
|
|
87
|
+
textShiftX = animationByProgress(textShiftX, this.nodeSettings.highlightByNodeTextShiftXAdditional, this.highlightProgress);
|
|
88
|
+
textShiftY = animationByProgress(textShiftY, this.nodeSettings.highlightByNodeTextShiftYAdditional, this.highlightProgress);
|
|
89
|
+
textWeight = animationByProgress(textWeight, this.nodeSettings.highlightByNodeTextWeightAdditional, this.highlightProgress);
|
|
90
|
+
textWidth = animationByProgress(textWidth, this.nodeSettings.highlightByNodeTextWidthAdditional, this.highlightProgress);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** LinkHighlight */
|
|
95
|
+
if (this.highlightedNeighbors && this.highlightedLink) {
|
|
96
|
+
/** Not highlighted */
|
|
97
|
+
if (!this.highlightedNeighbors.has(node.id) &&
|
|
98
|
+
this.highlightedLink.source !== node &&
|
|
99
|
+
this.highlightedLink.target !== node) {
|
|
100
|
+
if (this.nodeSettings.highlightByLinkNodeFading) {
|
|
101
|
+
const min = this.nodeSettings.highlightByLinkNodeFadingMin < alpha
|
|
102
|
+
? this.nodeSettings.highlightByLinkNodeFadingMin
|
|
103
|
+
: alpha;
|
|
104
|
+
alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);
|
|
105
|
+
}
|
|
106
|
+
if (this.nodeSettings.highlightByLinkTextFading) {
|
|
107
|
+
const min = this.nodeSettings.highlightByLinkTextFadingMin < textAlpha
|
|
108
|
+
? this.nodeSettings.highlightByLinkTextFadingMin
|
|
109
|
+
: textAlpha;
|
|
110
|
+
textAlpha = animationByProgress(min, textAlpha - min, 1 - this.highlightProgress);
|
|
111
|
+
}
|
|
112
|
+
if (this.nodeSettings.highlightByLinkNodeColor) {
|
|
113
|
+
const colorRgb = extractRgb(colorToRgb(color));
|
|
114
|
+
if (colorRgb) {
|
|
115
|
+
const colorRgbFade = fadeRgb(colorRgb, this.nodeSettings.highlightByLinkNodeColorFadingMin);
|
|
116
|
+
const colorFadeAnimation = rgbAnimationByProgress(colorRgb, colorRgbFade, this.highlightProgress);
|
|
117
|
+
color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
/** Highlighted */
|
|
123
|
+
if (this.nodeSettings.highlightByLinkNodeSizing && nodeOptions.shape === "circle") {
|
|
124
|
+
radiusInitial = animationByProgress(radiusInitial, this.nodeSettings.highlightByLinkNodeSizingAdditional, this.highlightProgress);
|
|
125
|
+
}
|
|
126
|
+
if (this.nodeSettings.highlightByLinkNodeSizing &&
|
|
127
|
+
(nodeOptions.shape === "square" ||
|
|
128
|
+
nodeOptions.shape === "text" ||
|
|
129
|
+
nodeOptions.shape === "icon")) {
|
|
130
|
+
const widthCoefficient = animationByProgress(1, this.nodeSettings.highlightByLinkNodeSizingAdditionalCoefficient, this.highlightProgress);
|
|
131
|
+
const heightCoefficient = animationByProgress(1, this.nodeSettings.highlightByLinkNodeSizingAdditionalCoefficient, this.highlightProgress);
|
|
132
|
+
widthInitial *= widthCoefficient;
|
|
133
|
+
heightInitial *= heightCoefficient;
|
|
134
|
+
}
|
|
135
|
+
if (this.nodeSettings.highlightByLinkTextSizing) {
|
|
136
|
+
textSize = animationByProgress(textSize, this.nodeSettings.highlightByLinkTextSizingAdditional, this.highlightProgress);
|
|
137
|
+
textShiftX = animationByProgress(textShiftX, this.nodeSettings.highlightByLinkTextShiftXAdditional, this.highlightProgress);
|
|
138
|
+
textShiftY = animationByProgress(textShiftY, this.nodeSettings.highlightByLinkTextShiftYAdditional, this.highlightProgress);
|
|
139
|
+
textWeight = animationByProgress(textWeight, this.nodeSettings.highlightByLinkTextWeightAdditional, this.highlightProgress);
|
|
140
|
+
textWidth = animationByProgress(textWidth, this.nodeSettings.highlightByLinkTextWidthAdditional, this.highlightProgress);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/** Flex radius */
|
|
145
|
+
const radius = nodeOptions.shape === "circle"
|
|
146
|
+
? nodeRadiusGetter({
|
|
147
|
+
radiusFlexible: this.nodeSettings.nodeRadiusFlexible,
|
|
148
|
+
radiusInitial,
|
|
149
|
+
radiusCoefficient: this.nodeSettings.nodeRadiusCoefficient,
|
|
150
|
+
radiusFactor: this.nodeSettings.nodeRadiusFactor,
|
|
151
|
+
linkCount: node.linkCount,
|
|
152
|
+
})
|
|
153
|
+
: radiusInitial;
|
|
154
|
+
/** Flex size */
|
|
155
|
+
let height = heightInitial;
|
|
156
|
+
let width = widthInitial;
|
|
157
|
+
if (nodeOptions.shape === "square" || nodeOptions.shape === "text") {
|
|
158
|
+
const size = nodeSizeGetter({
|
|
159
|
+
heightInitial,
|
|
160
|
+
widthInitial,
|
|
161
|
+
linkCount: node.linkCount,
|
|
162
|
+
sizeCoefficient: this.nodeSettings.nodeSizeCoefficient,
|
|
163
|
+
sizeFactor: this.nodeSettings.nodeSizeFactor,
|
|
164
|
+
sizeFlexible: this.nodeSettings.nodeSizeFlexible,
|
|
165
|
+
});
|
|
166
|
+
width = size.width;
|
|
167
|
+
height = size.height;
|
|
168
|
+
}
|
|
169
|
+
if (nodeOptions.shape === "text" && nodeOptions.text) {
|
|
170
|
+
const lines = this.cachedNodeText[node.id] ??
|
|
171
|
+
getTextLines({
|
|
172
|
+
context: this.context,
|
|
173
|
+
text: nodeOptions.text,
|
|
174
|
+
textAlign: nodeOptions.textAlign,
|
|
175
|
+
textColor: nodeOptions.textColor,
|
|
176
|
+
textFont: nodeOptions.textFont,
|
|
177
|
+
textSize,
|
|
178
|
+
maxWidth: width,
|
|
179
|
+
textStyle: nodeOptions.textStyle,
|
|
180
|
+
textWeight,
|
|
181
|
+
});
|
|
182
|
+
if (!this.cachedNodeText[node.id]) {
|
|
183
|
+
this.cachedNodeText[node.id] = lines;
|
|
184
|
+
}
|
|
185
|
+
height =
|
|
186
|
+
lines.length * textSize +
|
|
187
|
+
(lines.length - 1) * nodeOptions.textGap +
|
|
188
|
+
nodeOptions.textNodeYPadding;
|
|
189
|
+
width += nodeOptions.textNodeXPadding;
|
|
190
|
+
}
|
|
191
|
+
/** Node parameters */
|
|
192
|
+
node._radius = radius;
|
|
193
|
+
node._width = width;
|
|
194
|
+
node._height = height;
|
|
195
|
+
node._borderRadius =
|
|
196
|
+
isNumber(nodeOptions.borderRadius) && nodeOptions.borderRadius > 0
|
|
197
|
+
? Math.min(nodeOptions.borderRadius, nodeOptions.width / 2, nodeOptions.height / 2)
|
|
198
|
+
: 0;
|
|
199
|
+
node._shape = nodeOptions.shape ?? "circle";
|
|
200
|
+
/** Node Visibility */
|
|
201
|
+
if (!isNodeVisible({
|
|
202
|
+
height: this.height,
|
|
203
|
+
width: this.width,
|
|
204
|
+
transform: this.areaTransform,
|
|
205
|
+
node,
|
|
206
|
+
})) {
|
|
207
|
+
node._visible = false;
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
node._visible = true;
|
|
211
|
+
/** Node draw */
|
|
212
|
+
nodeRenders.push(() => {
|
|
213
|
+
if (!this.context || !node.x || !node.y)
|
|
214
|
+
return;
|
|
215
|
+
this.context.beginPath();
|
|
216
|
+
this.context.globalAlpha = alpha;
|
|
217
|
+
this.context.lineWidth = nodeOptions.borderWidth;
|
|
218
|
+
this.context.strokeStyle = nodeOptions.borderColor;
|
|
219
|
+
this.context.fillStyle = color;
|
|
220
|
+
switch (nodeOptions.shape) {
|
|
221
|
+
case "circle": {
|
|
222
|
+
this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
case "square": {
|
|
226
|
+
this.context.roundRect(node.x - width / 2, node.y - height / 2, width, height, node._borderRadius);
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
case "text": {
|
|
230
|
+
if (this.nodeSettings.textNodeDebug) {
|
|
231
|
+
this.context.strokeRect(node.x - width / 2, node.y - height / 2, width, height);
|
|
232
|
+
}
|
|
233
|
+
const lines = this.cachedNodeText[node.id];
|
|
234
|
+
if (nodeOptions.text && lines)
|
|
235
|
+
drawText({
|
|
236
|
+
id: node.id,
|
|
237
|
+
cachedNodeText: this.cachedNodeText,
|
|
238
|
+
context: this.context,
|
|
239
|
+
text: nodeOptions.text,
|
|
240
|
+
textAlign: nodeOptions.textAlign,
|
|
241
|
+
textColor: nodeOptions.textColor,
|
|
242
|
+
textFont: nodeOptions.textFont,
|
|
243
|
+
textSize,
|
|
244
|
+
x: node.x,
|
|
245
|
+
y: node.y + textSize / 4 - (lines.length - 1) * (textSize / 2),
|
|
246
|
+
maxWidth: widthInitial,
|
|
247
|
+
textStyle: nodeOptions.textStyle,
|
|
248
|
+
textWeight,
|
|
249
|
+
textGap: nodeOptions.textGap,
|
|
250
|
+
});
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
default: {
|
|
254
|
+
this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
this.context.fill();
|
|
259
|
+
this.context.stroke();
|
|
260
|
+
});
|
|
261
|
+
if (nodeOptions.nodeExtraDraw) {
|
|
262
|
+
nodeRenders.push(() => {
|
|
263
|
+
nodeOptions?.nodeExtraDraw?.(node, {
|
|
264
|
+
...nodeOptions,
|
|
265
|
+
radius,
|
|
266
|
+
alpha,
|
|
267
|
+
color,
|
|
268
|
+
textAlpha,
|
|
269
|
+
textSize,
|
|
270
|
+
textShiftX,
|
|
271
|
+
textShiftY,
|
|
272
|
+
textWeight,
|
|
273
|
+
textWidth,
|
|
274
|
+
}, state);
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
/** Text draw */
|
|
278
|
+
if (nodeOptions.textVisible && nodeOptions.text && nodeOptions.shape !== "text") {
|
|
279
|
+
textRenders.push(() => {
|
|
280
|
+
if (nodeOptions.textDraw) {
|
|
281
|
+
nodeOptions.textDraw(node, {
|
|
282
|
+
...nodeOptions,
|
|
283
|
+
radius,
|
|
284
|
+
alpha,
|
|
285
|
+
color,
|
|
286
|
+
textAlpha,
|
|
287
|
+
textSize,
|
|
288
|
+
textShiftX,
|
|
289
|
+
textShiftY,
|
|
290
|
+
textWeight,
|
|
291
|
+
textWidth,
|
|
292
|
+
}, state);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (!this.context || !node.x || !node.y || !nodeOptions.text)
|
|
296
|
+
return;
|
|
297
|
+
this.context.beginPath();
|
|
298
|
+
this.context.globalAlpha = textAlpha;
|
|
299
|
+
let y = node.y + textShiftY;
|
|
300
|
+
if (nodeOptions.shape === "circle") {
|
|
301
|
+
y += radius;
|
|
302
|
+
}
|
|
303
|
+
if (nodeOptions.shape === "square") {
|
|
304
|
+
y += height / 2;
|
|
305
|
+
}
|
|
306
|
+
drawText({
|
|
307
|
+
id: node.id,
|
|
308
|
+
cachedNodeText: this.cachedNodeText,
|
|
309
|
+
context: this.context,
|
|
310
|
+
text: nodeOptions.text,
|
|
311
|
+
textAlign: nodeOptions.textAlign,
|
|
312
|
+
textColor: nodeOptions.textColor,
|
|
313
|
+
textFont: nodeOptions.textFont,
|
|
314
|
+
textSize,
|
|
315
|
+
x: node.x + textShiftX,
|
|
316
|
+
y,
|
|
317
|
+
maxWidth: textWidth,
|
|
318
|
+
textStyle: nodeOptions.textStyle,
|
|
319
|
+
textWeight,
|
|
320
|
+
textGap: nodeOptions.textGap,
|
|
321
|
+
});
|
|
322
|
+
if (nodeOptions.textExtraDraw) {
|
|
323
|
+
nodeOptions.textExtraDraw(node, {
|
|
324
|
+
...nodeOptions,
|
|
325
|
+
radius,
|
|
326
|
+
alpha,
|
|
327
|
+
color,
|
|
328
|
+
textAlpha,
|
|
329
|
+
textSize,
|
|
330
|
+
textShiftX,
|
|
331
|
+
textShiftY,
|
|
332
|
+
textWeight,
|
|
333
|
+
textWidth,
|
|
334
|
+
}, state);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export { getDrawNode };
|
|
342
|
+
//# sourceMappingURL=draw-nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draw-nodes.js","sources":["../../../../../src/module/GraphCanvas/slices/draw-nodes.ts"],"sourcesContent":["import { isNumber } from \"@krainovsd/js-helpers\";\nimport { colorToRgb, extractRgb, fadeRgb, rgbAnimationByProgress } from \"@/lib\";\nimport type { NodeInterface } from \"@/types\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport {\n animationByProgress,\n isNodeVisible,\n nodeIterationExtractor,\n nodeOptionsGetter,\n nodeRadiusGetter,\n nodeSizeGetter,\n} from \"../lib\";\nimport type { GraphState, NodeOptionsInterface } from \"../types\";\nimport { drawText, getTextLines } from \"./draw-text\";\n\nexport function getDrawNode<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(nodeRenders: (() => void)[], textRenders: (() => void)[], state: GraphState<NodeData, LinkData>) {\n return function drawNode(\n this: GraphCanvas<NodeData, LinkData>,\n node: NodeInterface<NodeData>,\n index: number,\n ) {\n if (!this.context || !node.x || !node.y) return;\n\n let nodeOptions: Required<NodeOptionsInterface<NodeData, LinkData>>;\n if (this.nodeSettings.cache && this.nodeOptionsCache[node.id]) {\n nodeOptions = this.nodeOptionsCache[node.id];\n } else {\n nodeOptions = nodeIterationExtractor(\n node,\n index,\n this.nodes,\n state,\n this.nodeSettings.options ?? {},\n nodeOptionsGetter,\n );\n if (this.nodeSettings.cache) {\n this.nodeOptionsCache[node.id] = nodeOptions;\n }\n }\n\n if (nodeOptions.nodeDraw && nodeOptions.textDraw) {\n nodeRenders.push(() => {\n nodeOptions?.nodeDraw?.(node, nodeOptions, state);\n });\n\n textRenders.push(() => {\n nodeOptions?.textDraw?.(node, nodeOptions, state);\n });\n\n return;\n }\n\n let alpha = nodeOptions.alpha;\n let color = nodeOptions.color;\n let radiusInitial = nodeOptions.radius;\n let widthInitial = nodeOptions.width;\n let heightInitial = nodeOptions.height;\n let textAlpha = nodeOptions.textAlpha;\n let textSize = nodeOptions.textSize;\n let textShiftX = nodeOptions.textShiftX;\n let textShiftY = nodeOptions.textShiftY;\n let textWeight = nodeOptions.textWeight;\n let textWidth = nodeOptions.textWidth;\n /** Node Highlight */\n if (this.highlightedNeighbors && this.highlightedNode) {\n /** Not highlighted */\n if (!this.highlightedNeighbors.has(node.id) && this.highlightedNode.id != node.id) {\n if (this.nodeSettings.highlightByNodeNodeFading) {\n const min =\n this.nodeSettings.highlightByNodeNodeFadingMin < alpha\n ? this.nodeSettings.highlightByNodeNodeFadingMin\n : alpha;\n alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByNodeTextFading) {\n const min =\n this.nodeSettings.highlightByNodeTextFadingMin < textAlpha\n ? this.nodeSettings.highlightByNodeTextFadingMin\n : textAlpha;\n textAlpha = animationByProgress(min, textAlpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByNodeNodeColor) {\n const colorRgb = extractRgb(colorToRgb(color));\n if (colorRgb) {\n const colorRgbFade = fadeRgb(\n colorRgb,\n this.nodeSettings.highlightByNodeNodeColorFadingMin,\n );\n const colorFadeAnimation = rgbAnimationByProgress(\n colorRgb,\n colorRgbFade,\n this.highlightProgress,\n );\n color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;\n }\n }\n } else if (\n !this.nodeSettings.highlightByNodeOnlyRoot ||\n (this.nodeSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)\n ) {\n /** Highlighted */\n\n if (this.nodeSettings.highlightByNodeNodeSizing && nodeOptions.shape === \"circle\") {\n radiusInitial = animationByProgress(\n radiusInitial,\n this.nodeSettings.highlightByNodeNodeSizingAdditional,\n this.highlightProgress,\n );\n }\n if (\n this.nodeSettings.highlightByLinkNodeSizing &&\n (nodeOptions.shape === \"square\" || nodeOptions.shape === \"text\")\n ) {\n const widthCoefficient = animationByProgress(\n 1,\n this.nodeSettings.highlightByNodeNodeSizingAdditionalCoefficient,\n this.highlightProgress,\n );\n const heightCoefficient = animationByProgress(\n 1,\n this.nodeSettings.highlightByNodeNodeSizingAdditionalCoefficient,\n this.highlightProgress,\n );\n widthInitial *= widthCoefficient;\n heightInitial *= heightCoefficient;\n }\n if (this.nodeSettings.highlightByNodeTextSizing) {\n textSize = animationByProgress(\n textSize,\n this.nodeSettings.highlightByNodeTextSizingAdditional,\n this.highlightProgress,\n );\n textShiftX = animationByProgress(\n textShiftX,\n this.nodeSettings.highlightByNodeTextShiftXAdditional,\n this.highlightProgress,\n );\n textShiftY = animationByProgress(\n textShiftY,\n this.nodeSettings.highlightByNodeTextShiftYAdditional,\n this.highlightProgress,\n );\n textWeight = animationByProgress(\n textWeight,\n this.nodeSettings.highlightByNodeTextWeightAdditional,\n this.highlightProgress,\n );\n textWidth = animationByProgress(\n textWidth,\n this.nodeSettings.highlightByNodeTextWidthAdditional,\n this.highlightProgress,\n );\n }\n }\n }\n /** LinkHighlight */\n if (this.highlightedNeighbors && this.highlightedLink) {\n /** Not highlighted */\n if (\n !this.highlightedNeighbors.has(node.id) &&\n this.highlightedLink.source !== node &&\n this.highlightedLink.target !== node\n ) {\n if (this.nodeSettings.highlightByLinkNodeFading) {\n const min =\n this.nodeSettings.highlightByLinkNodeFadingMin < alpha\n ? this.nodeSettings.highlightByLinkNodeFadingMin\n : alpha;\n alpha = animationByProgress(min, alpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByLinkTextFading) {\n const min =\n this.nodeSettings.highlightByLinkTextFadingMin < textAlpha\n ? this.nodeSettings.highlightByLinkTextFadingMin\n : textAlpha;\n textAlpha = animationByProgress(min, textAlpha - min, 1 - this.highlightProgress);\n }\n if (this.nodeSettings.highlightByLinkNodeColor) {\n const colorRgb = extractRgb(colorToRgb(color));\n if (colorRgb) {\n const colorRgbFade = fadeRgb(\n colorRgb,\n this.nodeSettings.highlightByLinkNodeColorFadingMin,\n );\n const colorFadeAnimation = rgbAnimationByProgress(\n colorRgb,\n colorRgbFade,\n this.highlightProgress,\n );\n color = `rgb(${colorFadeAnimation.r}, ${colorFadeAnimation.g}, ${colorFadeAnimation.b})`;\n }\n }\n } else {\n /** Highlighted */\n\n if (this.nodeSettings.highlightByLinkNodeSizing && nodeOptions.shape === \"circle\") {\n radiusInitial = animationByProgress(\n radiusInitial,\n this.nodeSettings.highlightByLinkNodeSizingAdditional,\n this.highlightProgress,\n );\n }\n if (\n this.nodeSettings.highlightByLinkNodeSizing &&\n (nodeOptions.shape === \"square\" ||\n nodeOptions.shape === \"text\" ||\n nodeOptions.shape === \"icon\")\n ) {\n const widthCoefficient = animationByProgress(\n 1,\n this.nodeSettings.highlightByLinkNodeSizingAdditionalCoefficient,\n this.highlightProgress,\n );\n const heightCoefficient = animationByProgress(\n 1,\n this.nodeSettings.highlightByLinkNodeSizingAdditionalCoefficient,\n this.highlightProgress,\n );\n widthInitial *= widthCoefficient;\n heightInitial *= heightCoefficient;\n }\n if (this.nodeSettings.highlightByLinkTextSizing) {\n textSize = animationByProgress(\n textSize,\n this.nodeSettings.highlightByLinkTextSizingAdditional,\n this.highlightProgress,\n );\n textShiftX = animationByProgress(\n textShiftX,\n this.nodeSettings.highlightByLinkTextShiftXAdditional,\n this.highlightProgress,\n );\n textShiftY = animationByProgress(\n textShiftY,\n this.nodeSettings.highlightByLinkTextShiftYAdditional,\n this.highlightProgress,\n );\n textWeight = animationByProgress(\n textWeight,\n this.nodeSettings.highlightByLinkTextWeightAdditional,\n this.highlightProgress,\n );\n textWidth = animationByProgress(\n textWidth,\n this.nodeSettings.highlightByLinkTextWidthAdditional,\n this.highlightProgress,\n );\n }\n }\n }\n\n /** Flex radius */\n const radius =\n nodeOptions.shape === \"circle\"\n ? nodeRadiusGetter({\n radiusFlexible: this.nodeSettings.nodeRadiusFlexible,\n radiusInitial,\n radiusCoefficient: this.nodeSettings.nodeRadiusCoefficient,\n radiusFactor: this.nodeSettings.nodeRadiusFactor,\n linkCount: node.linkCount,\n })\n : radiusInitial;\n /** Flex size */\n let height: number = heightInitial;\n let width: number = widthInitial;\n if (nodeOptions.shape === \"square\" || nodeOptions.shape === \"text\") {\n const size = nodeSizeGetter({\n heightInitial,\n widthInitial,\n linkCount: node.linkCount,\n sizeCoefficient: this.nodeSettings.nodeSizeCoefficient,\n sizeFactor: this.nodeSettings.nodeSizeFactor,\n sizeFlexible: this.nodeSettings.nodeSizeFlexible,\n });\n width = size.width;\n height = size.height;\n }\n if (nodeOptions.shape === \"text\" && nodeOptions.text) {\n const lines =\n this.cachedNodeText[node.id] ??\n getTextLines({\n context: this.context,\n text: nodeOptions.text,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize,\n maxWidth: width,\n textStyle: nodeOptions.textStyle,\n textWeight,\n });\n\n if (!this.cachedNodeText[node.id]) {\n this.cachedNodeText[node.id] = lines;\n }\n\n height =\n lines.length * textSize +\n (lines.length - 1) * nodeOptions.textGap +\n nodeOptions.textNodeYPadding;\n width += nodeOptions.textNodeXPadding;\n }\n\n /** Node parameters */\n node._radius = radius;\n node._width = width;\n node._height = height;\n node._borderRadius =\n isNumber(nodeOptions.borderRadius) && nodeOptions.borderRadius > 0\n ? Math.min(nodeOptions.borderRadius, nodeOptions.width / 2, nodeOptions.height / 2)\n : 0;\n node._shape = nodeOptions.shape ?? \"circle\";\n\n /** Node Visibility */\n if (\n !isNodeVisible({\n height: this.height,\n width: this.width,\n transform: this.areaTransform,\n node,\n })\n ) {\n node._visible = false;\n\n return;\n }\n node._visible = true;\n\n /** Node draw */\n nodeRenders.push(() => {\n if (!this.context || !node.x || !node.y) return;\n\n this.context.beginPath();\n this.context.globalAlpha = alpha;\n this.context.lineWidth = nodeOptions.borderWidth;\n this.context.strokeStyle = nodeOptions.borderColor;\n this.context.fillStyle = color;\n\n switch (nodeOptions.shape) {\n case \"circle\": {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n break;\n }\n case \"square\": {\n this.context.roundRect(\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n node._borderRadius,\n );\n break;\n }\n case \"text\": {\n if (this.nodeSettings.textNodeDebug) {\n this.context.strokeRect(node.x - width / 2, node.y - height / 2, width, height);\n }\n\n const lines = this.cachedNodeText[node.id];\n if (nodeOptions.text && lines)\n drawText({\n id: node.id,\n cachedNodeText: this.cachedNodeText,\n context: this.context,\n text: nodeOptions.text,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize,\n x: node.x,\n y: node.y + textSize / 4 - (lines.length - 1) * (textSize / 2),\n maxWidth: widthInitial,\n textStyle: nodeOptions.textStyle,\n textWeight,\n textGap: nodeOptions.textGap,\n });\n break;\n }\n default: {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n break;\n }\n }\n\n this.context.fill();\n this.context.stroke();\n });\n\n if (nodeOptions.nodeExtraDraw) {\n nodeRenders.push(() => {\n nodeOptions?.nodeExtraDraw?.(\n node,\n {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n textWidth,\n },\n state,\n );\n });\n }\n\n /** Text draw */\n if (nodeOptions.textVisible && nodeOptions.text && nodeOptions.shape !== \"text\") {\n textRenders.push(() => {\n if (nodeOptions.textDraw) {\n nodeOptions.textDraw(\n node,\n {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n textWidth,\n },\n state,\n );\n\n return;\n }\n\n if (!this.context || !node.x || !node.y || !nodeOptions.text) return;\n this.context.beginPath();\n this.context.globalAlpha = textAlpha;\n\n let y = node.y + textShiftY;\n if (nodeOptions.shape === \"circle\") {\n y += radius;\n }\n if (nodeOptions.shape === \"square\") {\n y += height / 2;\n }\n\n drawText({\n id: node.id,\n cachedNodeText: this.cachedNodeText,\n context: this.context,\n text: nodeOptions.text,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize,\n x: node.x + textShiftX,\n y,\n maxWidth: textWidth,\n textStyle: nodeOptions.textStyle,\n textWeight,\n textGap: nodeOptions.textGap,\n });\n\n if (nodeOptions.textExtraDraw) {\n nodeOptions.textExtraDraw(\n node,\n {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n textWidth,\n },\n state,\n );\n }\n });\n }\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;SAegB,WAAW,CAGzB,WAA2B,EAAE,WAA2B,EAAE,KAA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