@krainovsd/graph 0.14.0-beta.8 → 0.15.0-beta.1
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 +845 -375
- package/lib/cjs/index.cjs.map +1 -1
- package/lib/esm/constants/force-controls.js +6 -4
- package/lib/esm/constants/force-controls.js.map +1 -1
- package/lib/esm/constants/highlight-controls.js +6 -3
- package/lib/esm/constants/highlight-controls.js.map +1 -1
- package/lib/esm/constants/link-controls.js +6 -3
- package/lib/esm/constants/link-controls.js.map +1 -1
- package/lib/esm/constants/node-controls.js +6 -3
- package/lib/esm/constants/node-controls.js.map +1 -1
- package/lib/esm/index.js +8 -6
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/module/GraphCanvas/GraphCanvas.js +40 -17
- package/lib/esm/module/GraphCanvas/GraphCanvas.js.map +1 -1
- package/lib/esm/module/GraphCanvas/StaticGraphCanvas.js +127 -0
- package/lib/esm/module/GraphCanvas/StaticGraphCanvas.js.map +1 -0
- package/lib/esm/module/GraphCanvas/constants/graph-settings.js +6 -7
- package/lib/esm/module/GraphCanvas/constants/graph-settings.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/highlight-settings.js +1 -4
- package/lib/esm/module/GraphCanvas/constants/highlight-settings.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/index.js +6 -4
- package/lib/esm/module/GraphCanvas/constants/index.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/link-settings.js +1 -9
- package/lib/esm/module/GraphCanvas/constants/link-settings.js.map +1 -1
- package/lib/esm/module/GraphCanvas/constants/node-settings.js +1 -10
- package/lib/esm/module/GraphCanvas/constants/node-settings.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/force-settings-getter.js +6 -4
- package/lib/esm/module/GraphCanvas/lib/settings/force-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/graph-settings-getter.js +0 -3
- package/lib/esm/module/GraphCanvas/lib/settings/graph-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/highlight-settings-getter.js +6 -3
- package/lib/esm/module/GraphCanvas/lib/settings/highlight-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/link-settings-getter.js +6 -3
- package/lib/esm/module/GraphCanvas/lib/settings/link-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js +20 -6
- package/lib/esm/module/GraphCanvas/lib/settings/node-settings-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-curve-link-position-by-node.js +6 -4
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-curve-link-position-by-node.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js +6 -4
- package/lib/esm/module/GraphCanvas/lib/utils/calculate-link-position-by-node.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/get-particle-position.js +1 -1
- 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 +25 -27
- 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.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/node-by-pointer-getter.js +2 -1
- package/lib/esm/module/GraphCanvas/lib/utils/node-by-pointer-getter.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/node-highlight.js +7 -11
- package/lib/esm/module/GraphCanvas/lib/utils/node-highlight.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/node-iteration-extractor.js +3 -0
- package/lib/esm/module/GraphCanvas/lib/utils/node-iteration-extractor.js.map +1 -1
- package/lib/esm/module/GraphCanvas/lib/utils/precompute-graph.js +24 -0
- package/lib/esm/module/GraphCanvas/lib/utils/precompute-graph.js.map +1 -0
- package/lib/esm/module/GraphCanvas/lib/utils/prepare-graph-data.js +49 -0
- package/lib/esm/module/GraphCanvas/lib/utils/prepare-graph-data.js.map +1 -0
- package/lib/esm/module/GraphCanvas/lib/utils/svg-context.js +159 -0
- package/lib/esm/module/GraphCanvas/lib/utils/svg-context.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/draw-links.js +24 -42
- package/lib/esm/module/GraphCanvas/slices/draw-links.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/draw-nodes.js +80 -168
- package/lib/esm/module/GraphCanvas/slices/draw-nodes.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/draw-text.js +1 -9
- package/lib/esm/module/GraphCanvas/slices/draw-text.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/export-svg.js +62 -0
- package/lib/esm/module/GraphCanvas/slices/export-svg.js.map +1 -0
- package/lib/esm/module/GraphCanvas/slices/init-dnd.js +15 -3
- package/lib/esm/module/GraphCanvas/slices/init-dnd.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-draw.js +212 -8
- package/lib/esm/module/GraphCanvas/slices/init-draw.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-pointer.js +6 -8
- package/lib/esm/module/GraphCanvas/slices/init-pointer.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-simulation.js +3 -4
- package/lib/esm/module/GraphCanvas/slices/init-simulation.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/init-zoom.js +2 -4
- package/lib/esm/module/GraphCanvas/slices/init-zoom.js.map +1 -1
- package/lib/esm/module/GraphCanvas/slices/update-link-cache.js +5 -5
- package/lib/esm/module/GraphCanvas/slices/update-node-cache.js +17 -29
- package/lib/esm/module/GraphCanvas/slices/update-node-cache.js.map +1 -1
- package/lib/index.d.ts +95 -43
- package/package.json +1 -1
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { isNumber } from '@krainovsd/js-helpers';
|
|
2
2
|
import '../constants/force-settings.js';
|
|
3
|
-
import '../constants/graph-settings.js';
|
|
4
|
-
import '../constants/highlight-settings.js';
|
|
5
|
-
import '../constants/link-settings.js';
|
|
6
|
-
import '../constants/node-settings.js';
|
|
7
3
|
import 'd3-array';
|
|
8
4
|
import { isNodeVisible } from '../lib/utils/is-node-visible.js';
|
|
9
5
|
import { nodeFade, nodeHighlight } from '../lib/utils/node-highlight.js';
|
|
10
|
-
import
|
|
6
|
+
import 'd3-force';
|
|
7
|
+
import 'd3-selection';
|
|
8
|
+
import 'd3-zoom';
|
|
9
|
+
import 'd3-drag';
|
|
11
10
|
|
|
12
|
-
function getDrawNode(
|
|
11
|
+
function getDrawNode(nodeBatch, nodeImageBatch, textBatch, deferredNodeRender, deferredTextRender, area) {
|
|
13
12
|
return function drawNode(node, index) {
|
|
14
13
|
if (!this.context || !node.x || !node.y)
|
|
15
14
|
return;
|
|
@@ -23,12 +22,12 @@ function getDrawNode(nodeRenders, textRenders) {
|
|
|
23
22
|
if (!nodeOptions)
|
|
24
23
|
return;
|
|
25
24
|
if (nodeOptions.nodeDraw && nodeOptions.textDraw) {
|
|
26
|
-
|
|
25
|
+
deferredNodeRender.push(() => {
|
|
27
26
|
if (nodeOptions.nodeDraw) {
|
|
28
27
|
nodeOptions.nodeDraw.bind(this)(node, nodeOptions);
|
|
29
28
|
}
|
|
30
29
|
});
|
|
31
|
-
|
|
30
|
+
deferredTextRender.push(() => {
|
|
32
31
|
if (nodeOptions.textDraw) {
|
|
33
32
|
nodeOptions.textDraw.bind(this)(node, nodeOptions);
|
|
34
33
|
}
|
|
@@ -148,7 +147,6 @@ function getDrawNode(nodeRenders, textRenders) {
|
|
|
148
147
|
labelWeight = highlightOptions.labelWeight;
|
|
149
148
|
}
|
|
150
149
|
}
|
|
151
|
-
/** Node parameters */
|
|
152
150
|
node._radius = radius;
|
|
153
151
|
node._borderWidth = borderWidth;
|
|
154
152
|
node._width = width;
|
|
@@ -158,138 +156,55 @@ function getDrawNode(nodeRenders, textRenders) {
|
|
|
158
156
|
? Math.min(nodeOptions.borderRadius, nodeOptions.width / 2, nodeOptions.height / 2)
|
|
159
157
|
: 0;
|
|
160
158
|
node._shape = nodeOptions.shape ?? "circle";
|
|
161
|
-
|
|
162
|
-
if (!isNodeVisible({
|
|
163
|
-
height: this.height,
|
|
164
|
-
width: this.width,
|
|
165
|
-
transform: this.areaTransform,
|
|
166
|
-
node,
|
|
167
|
-
})) {
|
|
159
|
+
if (!isNodeVisible(node, area)) {
|
|
168
160
|
node._visible = false;
|
|
169
161
|
return;
|
|
170
162
|
}
|
|
171
163
|
node._visible = true;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
|
|
193
|
-
this.context.closePath();
|
|
194
|
-
this.context.save();
|
|
195
|
-
this.context.clip();
|
|
196
|
-
this.context.drawImage(node.image, node.x - radius, node.y - radius, radius * 2, radius * 2);
|
|
197
|
-
this.context.restore();
|
|
198
|
-
if (borderWidth > 0) {
|
|
199
|
-
this.context.stroke();
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
if (node.label && labelLines) {
|
|
203
|
-
this.context.globalAlpha = labelAlpha;
|
|
204
|
-
drawText({
|
|
205
|
-
context: this.context,
|
|
206
|
-
lines: labelLines,
|
|
207
|
-
textAlign: nodeOptions.labelAlign,
|
|
208
|
-
textColor: nodeOptions.labelColor,
|
|
209
|
-
textFont: nodeOptions.labelFont,
|
|
210
|
-
textGap: nodeOptions.labelGap,
|
|
211
|
-
textSize: labelSize,
|
|
212
|
-
textStyle: nodeOptions.labelStyle,
|
|
213
|
-
textWeight: labelWeight,
|
|
214
|
-
x: node.x,
|
|
215
|
-
y: node.y + labelSize / 3,
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
break;
|
|
219
|
-
}
|
|
220
|
-
case "square": {
|
|
221
|
-
if (!node.image) {
|
|
222
|
-
this.context.roundRect(node.x - width / 2, node.y - height / 2, width, height, node._borderRadius);
|
|
223
|
-
this.context.fill();
|
|
224
|
-
if (borderWidth > 0) {
|
|
225
|
-
this.context.stroke();
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
this.context.roundRect(node.x - width / 2, node.y - height / 2, width, height, node._borderRadius);
|
|
230
|
-
this.context.closePath();
|
|
231
|
-
this.context.save();
|
|
232
|
-
this.context.clip();
|
|
233
|
-
this.context.drawImage(node.image, node.x - width / 2, node.y - height / 2, width, height);
|
|
234
|
-
this.context.restore();
|
|
235
|
-
if (borderWidth > 0) {
|
|
236
|
-
this.context.stroke();
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
if (node.label && labelLines) {
|
|
240
|
-
this.context.globalAlpha = labelAlpha;
|
|
241
|
-
drawText({
|
|
242
|
-
context: this.context,
|
|
243
|
-
lines: labelLines,
|
|
244
|
-
textAlign: nodeOptions.labelAlign,
|
|
245
|
-
textColor: nodeOptions.labelColor,
|
|
246
|
-
textFont: nodeOptions.labelFont,
|
|
247
|
-
textGap: nodeOptions.labelGap,
|
|
248
|
-
textSize: labelSize,
|
|
249
|
-
textStyle: nodeOptions.labelStyle,
|
|
250
|
-
textWeight: labelWeight,
|
|
251
|
-
x: node.x,
|
|
252
|
-
y: node.y + labelSize / 3,
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
case "text": {
|
|
258
|
-
if (this.nodeSettings.textNodeDebug) {
|
|
259
|
-
this.context.strokeRect(node.x - width / 2, node.y - height / 2, width, height);
|
|
260
|
-
}
|
|
261
|
-
if (nodeOptions.label && labelLines)
|
|
262
|
-
drawText({
|
|
263
|
-
lines: labelLines,
|
|
264
|
-
context: this.context,
|
|
265
|
-
textAlign: nodeOptions.labelAlign,
|
|
266
|
-
textColor: nodeOptions.labelColor,
|
|
267
|
-
textFont: nodeOptions.labelFont,
|
|
268
|
-
textSize: labelSize,
|
|
269
|
-
x: node.x,
|
|
270
|
-
y: node.y + textSize / 4 - (labelLines.length - 1) * (textSize / 2),
|
|
271
|
-
textStyle: nodeOptions.labelStyle,
|
|
272
|
-
textWeight,
|
|
273
|
-
textGap: nodeOptions.labelGap,
|
|
274
|
-
});
|
|
275
|
-
this.context.fill();
|
|
276
|
-
if (borderWidth > 0) {
|
|
277
|
-
this.context.stroke();
|
|
278
|
-
}
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
default: {
|
|
282
|
-
this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);
|
|
283
|
-
this.context.fill();
|
|
284
|
-
if (borderWidth > 0) {
|
|
285
|
-
this.context.stroke();
|
|
286
|
-
}
|
|
287
|
-
break;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
164
|
+
const nodeBatchKey = `${alpha}|${borderColor}|${borderWidth}|${color}`;
|
|
165
|
+
let nodeGroup;
|
|
166
|
+
if (!node.image) {
|
|
167
|
+
nodeBatch[nodeBatchKey] ??= [];
|
|
168
|
+
nodeGroup = nodeBatch[nodeBatchKey];
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
nodeImageBatch[nodeBatchKey] ??= [];
|
|
172
|
+
nodeGroup = nodeImageBatch[nodeBatchKey];
|
|
173
|
+
}
|
|
174
|
+
nodeGroup.push({
|
|
175
|
+
shape: nodeOptions.shape,
|
|
176
|
+
x: node.x,
|
|
177
|
+
y: node.y,
|
|
178
|
+
radius,
|
|
179
|
+
width,
|
|
180
|
+
height,
|
|
181
|
+
image: node.image,
|
|
290
182
|
});
|
|
183
|
+
const labelLines = this.cachedNodeLabel[index];
|
|
184
|
+
if (labelLines && labelLines.length > 0) {
|
|
185
|
+
let y = node.y + labelSize / 3;
|
|
186
|
+
let weight = labelWeight;
|
|
187
|
+
if (nodeOptions.shape == "text") {
|
|
188
|
+
y = node.y + textSize / 4 - (labelLines.length - 1) * (textSize / 2);
|
|
189
|
+
weight = textWeight;
|
|
190
|
+
}
|
|
191
|
+
const font = `${nodeOptions.labelStyle} normal ${weight} ${labelSize}px ${nodeOptions.labelFont}`;
|
|
192
|
+
textBatch[font] ??= {};
|
|
193
|
+
const fontBatch = textBatch[font];
|
|
194
|
+
const textBatchKey = `${labelAlpha}|${nodeOptions.labelAlign}|${nodeOptions.labelColor}`;
|
|
195
|
+
fontBatch[textBatchKey] ??= [];
|
|
196
|
+
const textGroup = fontBatch[textBatchKey];
|
|
197
|
+
for (let i = 0; i < labelLines.length; i++) {
|
|
198
|
+
const line = labelLines[i];
|
|
199
|
+
textGroup.push({
|
|
200
|
+
text: line,
|
|
201
|
+
x: node.x,
|
|
202
|
+
y: y + i * textSize + i * nodeOptions.textGap,
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
291
206
|
if (nodeOptions.nodeExtraDraw) {
|
|
292
|
-
|
|
207
|
+
deferredNodeRender.push(() => {
|
|
293
208
|
nodeOptions?.nodeExtraDraw?.bind?.(this)?.(node, {
|
|
294
209
|
...nodeOptions,
|
|
295
210
|
radius,
|
|
@@ -303,12 +218,11 @@ function getDrawNode(nodeRenders, textRenders) {
|
|
|
303
218
|
});
|
|
304
219
|
});
|
|
305
220
|
}
|
|
306
|
-
/** Text draw */
|
|
307
221
|
const textLines = this.cachedNodeText[index];
|
|
308
|
-
if (
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
nodeOptions
|
|
222
|
+
if (textLines && textLines.length > 0) {
|
|
223
|
+
if (nodeOptions.textDraw) {
|
|
224
|
+
deferredTextRender.push(() => {
|
|
225
|
+
nodeOptions?.textDraw?.bind?.(this)?.(node, {
|
|
312
226
|
...nodeOptions,
|
|
313
227
|
radius,
|
|
314
228
|
alpha,
|
|
@@ -319,34 +233,32 @@ function getDrawNode(nodeRenders, textRenders) {
|
|
|
319
233
|
textShiftY,
|
|
320
234
|
textWeight,
|
|
321
235
|
});
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
textSize,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
let y = node.y + textShiftY;
|
|
239
|
+
if (nodeOptions.shape === "circle") {
|
|
240
|
+
y += radius;
|
|
241
|
+
}
|
|
242
|
+
if (nodeOptions.shape === "square" || nodeOptions.shape === "text") {
|
|
243
|
+
y += height / 2;
|
|
244
|
+
}
|
|
245
|
+
const font = `${nodeOptions.textStyle} normal ${textWeight} ${textSize}px ${nodeOptions.textFont}`;
|
|
246
|
+
textBatch[font] ??= {};
|
|
247
|
+
const fontBatch = textBatch[font];
|
|
248
|
+
const textBatchKey = `${textAlpha}|${nodeOptions.textAlign}|${nodeOptions.textColor}`;
|
|
249
|
+
fontBatch[textBatchKey] ??= [];
|
|
250
|
+
const textGroup = fontBatch[textBatchKey];
|
|
251
|
+
for (let i = 0; i < textLines.length; i++) {
|
|
252
|
+
const line = textLines[i];
|
|
253
|
+
textGroup.push({
|
|
254
|
+
text: line,
|
|
342
255
|
x: node.x + textShiftX,
|
|
343
|
-
y,
|
|
344
|
-
textStyle: nodeOptions.textStyle,
|
|
345
|
-
textWeight,
|
|
346
|
-
textGap: nodeOptions.textGap,
|
|
256
|
+
y: y + i * textSize + i * nodeOptions.textGap,
|
|
347
257
|
});
|
|
348
|
-
|
|
349
|
-
|
|
258
|
+
}
|
|
259
|
+
if (nodeOptions.textExtraDraw) {
|
|
260
|
+
deferredTextRender.push(() => {
|
|
261
|
+
nodeOptions?.textExtraDraw?.bind?.(this)?.(node, {
|
|
350
262
|
...nodeOptions,
|
|
351
263
|
radius,
|
|
352
264
|
alpha,
|
|
@@ -357,8 +269,8 @@ function getDrawNode(nodeRenders, textRenders) {
|
|
|
357
269
|
textShiftY,
|
|
358
270
|
textWeight,
|
|
359
271
|
});
|
|
360
|
-
}
|
|
361
|
-
}
|
|
272
|
+
});
|
|
273
|
+
}
|
|
362
274
|
}
|
|
363
275
|
};
|
|
364
276
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draw-nodes.js","sources":["../../../../../src/module/GraphCanvas/slices/draw-nodes.ts"],"sourcesContent":["import { isNumber } from \"@krainovsd/js-helpers\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport { isNodeVisible, nodeFade, nodeHighlight } from \"../lib\";\nimport type { NodeInterface } from \"../types\";\nimport { drawText } from \"./draw-text\";\n\nexport function getDrawNode<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(nodeRenders: (() => void)[], textRenders: (() => void)[]) {\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 if (node.visible != undefined && !node.visible) {\n node._radius = 0;\n node._width = 0;\n node._height = 0;\n\n return;\n }\n\n const nodeOptions = this.nodeOptionsCache[index];\n if (!nodeOptions) return;\n\n if (nodeOptions.nodeDraw && nodeOptions.textDraw) {\n nodeRenders.push(() => {\n if (nodeOptions.nodeDraw) {\n nodeOptions.nodeDraw.bind(this)(node, nodeOptions);\n }\n });\n\n textRenders.push(() => {\n if (nodeOptions.textDraw) {\n nodeOptions.textDraw.bind(this)(node, nodeOptions);\n }\n });\n\n return;\n }\n\n let radius = nodeOptions.radius;\n let width = nodeOptions.width;\n let height = nodeOptions.height;\n let alpha = nodeOptions.alpha;\n let color = nodeOptions.color;\n let borderColor = nodeOptions.borderColor;\n let borderWidth = nodeOptions.borderWidth;\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 labelSize = nodeOptions.labelSize;\n let labelWeight = nodeOptions.labelWeight;\n let labelAlpha = nodeOptions.labelAlpha;\n /** Highlight */\n if (this.highlightedNeighbors && this.highlightedNode) {\n /** By Node Not Highlight */\n if (!this.highlightedNeighbors.has(node.id) && this.highlightedNode.id != node.id) {\n const fadingOptions = nodeFade({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelFadingMin: this.highlightSettings.highlightByNodeForLabelFadingMin,\n highlightForNodeColorFading: this.highlightSettings.highlightByNodeForNodeColorFading,\n highlightForNodeFadingMin: this.highlightSettings.highlightByNodeForNodeFadingMin,\n highlightForTextFadingMin: this.highlightSettings.highlightByNodeForTextFadingMin,\n });\n alpha = fadingOptions.alpha;\n color = fadingOptions.color;\n textAlpha = fadingOptions.textAlpha;\n labelAlpha = fadingOptions.labelAlpha;\n } else if (\n !this.highlightSettings.highlightByNodeOnlyRoot ||\n (this.highlightSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)\n ) {\n /** By Node Highlight */\n const highlightOptions = nodeHighlight({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelSizingAdditional:\n this.highlightSettings.highlightByNodeForLabelSizingAdditional,\n highlightForLabelWeightAdditional:\n this.highlightSettings.highlightByNodeForLabelWeightAdditional,\n highlightForNodeBorderColor: this.highlightSettings.highlightByNodeForNodeBorderColor,\n highlightForNodeBorderSizingAdditional:\n this.highlightSettings.highlightByNodeForNodeBorderSizingAdditional,\n highlightForNodeColor: this.highlightSettings.highlightByNodeForNodeColor,\n highlightForNodeSizingAdditional:\n this.highlightSettings.highlightByNodeForNodeSizingAdditional,\n highlightForNodeSizingAdditionalCoefficient:\n this.highlightSettings.highlightByNodeForNodeSizingAdditionalCoefficient,\n highlightForTextShiftXAdditional:\n this.highlightSettings.highlightByNodeForTextShiftXAdditional,\n highlightForTextShiftYAdditional:\n this.highlightSettings.highlightByNodeForTextShiftYAdditional,\n highlightForTextSizingAdditional:\n this.highlightSettings.highlightByNodeForTextSizingAdditional,\n highlightForTextWeightAdditional:\n this.highlightSettings.highlightByNodeForTextWeightAdditional,\n });\n color = highlightOptions.color;\n borderColor = highlightOptions.borderColor;\n borderWidth = highlightOptions.borderWidth;\n radius = highlightOptions.radiusInitial;\n width = highlightOptions.widthInitial;\n height = highlightOptions.heightInitial;\n textSize = highlightOptions.textSize;\n textShiftX = highlightOptions.textShiftX;\n textShiftY = highlightOptions.textShiftY;\n textWeight = highlightOptions.textWeight;\n labelSize = highlightOptions.labelSize;\n labelWeight = highlightOptions.labelWeight;\n }\n }\n if (this.highlightedNeighbors && this.highlightedLink) {\n /** By Link Not Highlight */\n if (\n !this.highlightedNeighbors.has(node.id) &&\n this.highlightedLink.source !== node &&\n this.highlightedLink.target !== node\n ) {\n const fadingOptions = nodeFade({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelFadingMin: this.highlightSettings.highlightByLinkForLabelFadingMin,\n highlightForNodeColorFading: this.highlightSettings.highlightByLinkForNodeColorFading,\n highlightForNodeFadingMin: this.highlightSettings.highlightByLinkForNodeFadingMin,\n highlightForTextFadingMin: this.highlightSettings.highlightByLinkForTextFadingMin,\n });\n alpha = fadingOptions.alpha;\n color = fadingOptions.color;\n textAlpha = fadingOptions.textAlpha;\n labelAlpha = fadingOptions.labelAlpha;\n } else {\n /** By Link Highlight */\n\n const highlightOptions = nodeHighlight({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelSizingAdditional:\n this.highlightSettings.highlightByLinkForLabelSizingAdditional,\n highlightForLabelWeightAdditional:\n this.highlightSettings.highlightByLinkForLabelWeightAdditional,\n highlightForNodeBorderColor: this.highlightSettings.highlightByLinkForNodeBorderColor,\n highlightForNodeBorderSizingAdditional:\n this.highlightSettings.highlightByLinkForNodeBorderSizingAdditional,\n highlightForNodeColor: this.highlightSettings.highlightByLinkForNodeColor,\n highlightForNodeSizingAdditional:\n this.highlightSettings.highlightByLinkForNodeSizingAdditional,\n highlightForNodeSizingAdditionalCoefficient:\n this.highlightSettings.highlightByLinkForNodeSizingAdditionalCoefficient,\n highlightForTextShiftXAdditional:\n this.highlightSettings.highlightByLinkForTextShiftXAdditional,\n highlightForTextShiftYAdditional:\n this.highlightSettings.highlightByLinkForTextShiftYAdditional,\n highlightForTextSizingAdditional:\n this.highlightSettings.highlightByLinkForTextSizingAdditional,\n highlightForTextWeightAdditional:\n this.highlightSettings.highlightByLinkForTextWeightAdditional,\n });\n color = highlightOptions.color;\n borderColor = highlightOptions.borderColor;\n borderWidth = highlightOptions.borderWidth;\n radius = highlightOptions.radiusInitial;\n width = highlightOptions.widthInitial;\n height = highlightOptions.heightInitial;\n textSize = highlightOptions.textSize;\n textShiftX = highlightOptions.textShiftX;\n textShiftY = highlightOptions.textShiftY;\n textWeight = highlightOptions.textWeight;\n labelSize = highlightOptions.labelSize;\n labelWeight = highlightOptions.labelWeight;\n }\n }\n\n /** Node parameters */\n node._radius = radius;\n node._borderWidth = borderWidth;\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 = borderWidth;\n this.context.strokeStyle = borderColor;\n this.context.fillStyle = color;\n const labelLines = this.cachedNodeLabel[index];\n\n switch (nodeOptions.shape) {\n case \"circle\": {\n if (!node.image) {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n } else {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n this.context.closePath();\n this.context.save();\n this.context.clip();\n\n this.context.drawImage(\n node.image,\n node.x - radius,\n node.y - radius,\n radius * 2,\n radius * 2,\n );\n\n this.context.restore();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n }\n\n if (node.label && labelLines) {\n this.context.globalAlpha = labelAlpha;\n drawText({\n context: this.context,\n lines: labelLines,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textGap: nodeOptions.labelGap,\n textSize: labelSize,\n textStyle: nodeOptions.labelStyle,\n textWeight: labelWeight,\n x: node.x,\n y: node.y + labelSize / 3,\n });\n }\n\n break;\n }\n case \"square\": {\n if (!node.image) {\n this.context.roundRect(\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n node._borderRadius,\n );\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n } else {\n this.context.roundRect(\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n node._borderRadius,\n );\n this.context.closePath();\n this.context.save();\n this.context.clip();\n this.context.drawImage(\n node.image,\n node.x - width / 2,\n node.y - height / 2,\n width,\n height,\n );\n this.context.restore();\n\n if (borderWidth > 0) {\n this.context.stroke();\n }\n }\n if (node.label && labelLines) {\n this.context.globalAlpha = labelAlpha;\n drawText({\n context: this.context,\n lines: labelLines,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textGap: nodeOptions.labelGap,\n textSize: labelSize,\n textStyle: nodeOptions.labelStyle,\n textWeight: labelWeight,\n x: node.x,\n y: node.y + labelSize / 3,\n });\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 if (nodeOptions.label && labelLines)\n drawText({\n lines: labelLines,\n context: this.context,\n textAlign: nodeOptions.labelAlign,\n textColor: nodeOptions.labelColor,\n textFont: nodeOptions.labelFont,\n textSize: labelSize,\n x: node.x,\n y: node.y + textSize / 4 - (labelLines.length - 1) * (textSize / 2),\n textStyle: nodeOptions.labelStyle,\n textWeight,\n textGap: nodeOptions.labelGap,\n });\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n break;\n }\n default: {\n this.context.arc(node.x, node.y, radius, 0, 2 * Math.PI);\n this.context.fill();\n if (borderWidth > 0) {\n this.context.stroke();\n }\n break;\n }\n }\n });\n\n if (nodeOptions.nodeExtraDraw) {\n nodeRenders.push(() => {\n nodeOptions?.nodeExtraDraw?.bind?.(this)?.(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n });\n });\n }\n\n /** Text draw */\n const textLines = this.cachedNodeText[index];\n if (nodeOptions.textVisible && nodeOptions.text && textLines) {\n textRenders.push(() => {\n if (nodeOptions.textDraw) {\n nodeOptions.textDraw.bind(this)(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\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\" || nodeOptions.shape === \"text\") {\n y += height / 2;\n }\n\n drawText({\n lines: textLines,\n context: this.context,\n textAlign: nodeOptions.textAlign,\n textColor: nodeOptions.textColor,\n textFont: nodeOptions.textFont,\n textSize,\n x: node.x + textShiftX,\n y,\n textStyle: nodeOptions.textStyle,\n textWeight,\n textGap: nodeOptions.textGap,\n });\n\n if (nodeOptions.textExtraDraw) {\n nodeOptions.textExtraDraw.bind(this)(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShi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AE,WAAW,CAAC,SAAS;oBAChC,SAAS,EAAE,WAAW,CAAC,SAAS;oBAChC,QAAQ,EAAE,WAAW,CAAC,QAAQ;oBAC9B,QAAQ;AACR,oBAAA,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,UAAU;oBACtB,CAAC;oBACD,SAAS,EAAE,WAAW,CAAC,SAAS;oBAChC,UAAU;oBACV,OAAO,EAAE,WAAW,CAAC,OAAO;AAC7B,iBAAA,CAAC;AAEF,gBAAA,IAAI,WAAW,CAAC,aAAa,EAAE;oBAC7B,WAAW,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;AACzC,wBAAA,GAAG,WAAW;wBACd,MAAM;wBACN,KAAK;wBACL,KAAK;wBACL,SAAS;wBACT,QAAQ;wBACR,UAAU;wBACV,UAAU;wBACV,UAAU;AACX,qBAAA,CAAC;;AAEN,aAAC,CAAC;;AAEN,KAAC;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"draw-nodes.js","sources":["../../../../../src/module/GraphCanvas/slices/draw-nodes.ts"],"sourcesContent":["import { isNumber } from \"@krainovsd/js-helpers\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport { isNodeVisible, nodeFade, nodeHighlight } from \"../lib\";\nimport type { Area, DeferredDraw, NodeDrawBatch, NodeInterface, NodeTextDrawBatch } from \"../types\";\n\nexport function getDrawNode<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(\n nodeBatch: Record<string, NodeDrawBatch[]>,\n nodeImageBatch: Record<string, NodeDrawBatch[]>,\n textBatch: Record<string, Record<string, NodeTextDrawBatch[]>>,\n deferredNodeRender: DeferredDraw[],\n deferredTextRender: DeferredDraw[],\n area: Area,\n) {\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 if (node.visible != undefined && !node.visible) {\n node._radius = 0;\n node._width = 0;\n node._height = 0;\n return;\n }\n const nodeOptions = this.nodeOptionsCache[index];\n if (!nodeOptions) return;\n if (nodeOptions.nodeDraw && nodeOptions.textDraw) {\n deferredNodeRender.push(() => {\n if (nodeOptions.nodeDraw) {\n nodeOptions.nodeDraw.bind(this)(node, nodeOptions);\n }\n });\n deferredTextRender.push(() => {\n if (nodeOptions.textDraw) {\n nodeOptions.textDraw.bind(this)(node, nodeOptions);\n }\n });\n return;\n }\n let radius = nodeOptions.radius;\n let width = nodeOptions.width;\n let height = nodeOptions.height;\n let alpha = nodeOptions.alpha;\n let color = nodeOptions.color;\n let borderColor = nodeOptions.borderColor;\n let borderWidth = nodeOptions.borderWidth;\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 labelSize = nodeOptions.labelSize;\n let labelWeight = nodeOptions.labelWeight;\n let labelAlpha = nodeOptions.labelAlpha;\n /** Highlight */\n if (this.highlightedNeighbors && this.highlightedNode) {\n /** By Node Not Highlight */\n if (!this.highlightedNeighbors.has(node.id) && this.highlightedNode.id != node.id) {\n const fadingOptions = nodeFade({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelFadingMin: this.highlightSettings.highlightByNodeForLabelFadingMin,\n highlightForNodeColorFading: this.highlightSettings.highlightByNodeForNodeColorFading,\n highlightForNodeFadingMin: this.highlightSettings.highlightByNodeForNodeFadingMin,\n highlightForTextFadingMin: this.highlightSettings.highlightByNodeForTextFadingMin,\n });\n alpha = fadingOptions.alpha;\n color = fadingOptions.color;\n textAlpha = fadingOptions.textAlpha;\n labelAlpha = fadingOptions.labelAlpha;\n } else if (\n !this.highlightSettings.highlightByNodeOnlyRoot ||\n (this.highlightSettings.highlightByNodeOnlyRoot && this.highlightedNode.id === node.id)\n ) {\n /** By Node Highlight */\n const highlightOptions = nodeHighlight({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelSizingAdditional:\n this.highlightSettings.highlightByNodeForLabelSizingAdditional,\n highlightForLabelWeightAdditional:\n this.highlightSettings.highlightByNodeForLabelWeightAdditional,\n highlightForNodeBorderColor: this.highlightSettings.highlightByNodeForNodeBorderColor,\n highlightForNodeBorderSizingAdditional:\n this.highlightSettings.highlightByNodeForNodeBorderSizingAdditional,\n highlightForNodeColor: this.highlightSettings.highlightByNodeForNodeColor,\n highlightForNodeSizingAdditional:\n this.highlightSettings.highlightByNodeForNodeSizingAdditional,\n highlightForNodeSizingAdditionalCoefficient:\n this.highlightSettings.highlightByNodeForNodeSizingAdditionalCoefficient,\n highlightForTextShiftXAdditional:\n this.highlightSettings.highlightByNodeForTextShiftXAdditional,\n highlightForTextShiftYAdditional:\n this.highlightSettings.highlightByNodeForTextShiftYAdditional,\n highlightForTextSizingAdditional:\n this.highlightSettings.highlightByNodeForTextSizingAdditional,\n highlightForTextWeightAdditional:\n this.highlightSettings.highlightByNodeForTextWeightAdditional,\n });\n color = highlightOptions.color;\n borderColor = highlightOptions.borderColor;\n borderWidth = highlightOptions.borderWidth;\n radius = highlightOptions.radiusInitial;\n width = highlightOptions.widthInitial;\n height = highlightOptions.heightInitial;\n textSize = highlightOptions.textSize;\n textShiftX = highlightOptions.textShiftX;\n textShiftY = highlightOptions.textShiftY;\n textWeight = highlightOptions.textWeight;\n labelSize = highlightOptions.labelSize;\n labelWeight = highlightOptions.labelWeight;\n }\n }\n if (this.highlightedNeighbors && this.highlightedLink) {\n /** By Link Not Highlight */\n if (\n !this.highlightedNeighbors.has(node.id) &&\n this.highlightedLink.source !== node &&\n this.highlightedLink.target !== node\n ) {\n const fadingOptions = nodeFade({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelFadingMin: this.highlightSettings.highlightByLinkForLabelFadingMin,\n highlightForNodeColorFading: this.highlightSettings.highlightByLinkForNodeColorFading,\n highlightForNodeFadingMin: this.highlightSettings.highlightByLinkForNodeFadingMin,\n highlightForTextFadingMin: this.highlightSettings.highlightByLinkForTextFadingMin,\n });\n alpha = fadingOptions.alpha;\n color = fadingOptions.color;\n textAlpha = fadingOptions.textAlpha;\n labelAlpha = fadingOptions.labelAlpha;\n } else {\n /** By Link Highlight */\n\n const highlightOptions = nodeHighlight({\n highlightProgress: this.highlightProgress,\n nodeOptions,\n highlightForLabelSizingAdditional:\n this.highlightSettings.highlightByLinkForLabelSizingAdditional,\n highlightForLabelWeightAdditional:\n this.highlightSettings.highlightByLinkForLabelWeightAdditional,\n highlightForNodeBorderColor: this.highlightSettings.highlightByLinkForNodeBorderColor,\n highlightForNodeBorderSizingAdditional:\n this.highlightSettings.highlightByLinkForNodeBorderSizingAdditional,\n highlightForNodeColor: this.highlightSettings.highlightByLinkForNodeColor,\n highlightForNodeSizingAdditional:\n this.highlightSettings.highlightByLinkForNodeSizingAdditional,\n highlightForNodeSizingAdditionalCoefficient:\n this.highlightSettings.highlightByLinkForNodeSizingAdditionalCoefficient,\n highlightForTextShiftXAdditional:\n this.highlightSettings.highlightByLinkForTextShiftXAdditional,\n highlightForTextShiftYAdditional:\n this.highlightSettings.highlightByLinkForTextShiftYAdditional,\n highlightForTextSizingAdditional:\n this.highlightSettings.highlightByLinkForTextSizingAdditional,\n highlightForTextWeightAdditional:\n this.highlightSettings.highlightByLinkForTextWeightAdditional,\n });\n color = highlightOptions.color;\n borderColor = highlightOptions.borderColor;\n borderWidth = highlightOptions.borderWidth;\n radius = highlightOptions.radiusInitial;\n width = highlightOptions.widthInitial;\n height = highlightOptions.heightInitial;\n textSize = highlightOptions.textSize;\n textShiftX = highlightOptions.textShiftX;\n textShiftY = highlightOptions.textShiftY;\n textWeight = highlightOptions.textWeight;\n labelSize = highlightOptions.labelSize;\n labelWeight = highlightOptions.labelWeight;\n }\n }\n node._radius = radius;\n node._borderWidth = borderWidth;\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 if (!isNodeVisible(node, area)) {\n node._visible = false;\n return;\n }\n node._visible = true;\n\n const nodeBatchKey = `${alpha}|${borderColor}|${borderWidth}|${color}`;\n let nodeGroup: NodeDrawBatch[];\n if (!node.image) {\n nodeBatch[nodeBatchKey] ??= [];\n nodeGroup = nodeBatch[nodeBatchKey];\n } else {\n nodeImageBatch[nodeBatchKey] ??= [];\n nodeGroup = nodeImageBatch[nodeBatchKey];\n }\n nodeGroup.push({\n shape: nodeOptions.shape,\n x: node.x,\n y: node.y,\n radius,\n width,\n height,\n image: node.image,\n });\n const labelLines = this.cachedNodeLabel[index];\n if (labelLines && labelLines.length > 0) {\n let y = node.y + labelSize / 3;\n let weight = labelWeight;\n if (nodeOptions.shape == \"text\") {\n y = node.y + textSize / 4 - (labelLines.length - 1) * (textSize / 2);\n weight = textWeight;\n }\n const font = `${nodeOptions.labelStyle} normal ${weight} ${labelSize}px ${nodeOptions.labelFont}`;\n textBatch[font] ??= {};\n const fontBatch = textBatch[font];\n const textBatchKey = `${labelAlpha}|${nodeOptions.labelAlign}|${nodeOptions.labelColor}`;\n fontBatch[textBatchKey] ??= [];\n const textGroup = fontBatch[textBatchKey];\n for (let i = 0; i < labelLines.length; i++) {\n const line = labelLines[i];\n textGroup.push({\n text: line,\n x: node.x,\n y: y + i * textSize + i * nodeOptions.textGap,\n });\n }\n }\n if (nodeOptions.nodeExtraDraw) {\n deferredNodeRender.push(() => {\n nodeOptions?.nodeExtraDraw?.bind?.(this)?.(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n });\n });\n }\n const textLines = this.cachedNodeText[index];\n if (textLines && textLines.length > 0) {\n if (nodeOptions.textDraw) {\n deferredTextRender.push(() => {\n nodeOptions?.textDraw?.bind?.(this)?.(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n });\n });\n }\n let y = node.y + textShiftY;\n if (nodeOptions.shape === \"circle\") {\n y += radius;\n }\n if (nodeOptions.shape === \"square\" || nodeOptions.shape === \"text\") {\n y += height / 2;\n }\n const font = `${nodeOptions.textStyle} normal ${textWeight} ${textSize}px ${nodeOptions.textFont}`;\n textBatch[font] ??= {};\n const fontBatch = textBatch[font];\n const textBatchKey = `${textAlpha}|${nodeOptions.textAlign}|${nodeOptions.textColor}`;\n fontBatch[textBatchKey] ??= [];\n const textGroup = fontBatch[textBatchKey];\n for (let i = 0; i < textLines.length; i++) {\n const line = textLines[i];\n textGroup.push({\n text: line,\n x: node.x + textShiftX,\n y: y + i * textSize + i * nodeOptions.textGap,\n });\n }\n if (nodeOptions.textExtraDraw) {\n deferredTextRender.push(() => {\n nodeOptions?.textExtraDraw?.bind?.(this)?.(node, {\n ...nodeOptions,\n radius,\n alpha,\n color,\n textAlpha,\n textSize,\n textShiftX,\n textShiftY,\n textWeight,\n });\n });\n }\n }\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;AAKgB,SAAA,WAAW,CAIzB,SAA0C,EAC1C,cAA+C,EAC/C,SAA8D,EAC9D,kBAAkC,EAClC,kBAAkC,EAClC,IAAU,EAAA;AAEV,IAAA,OAAO,SAAS,QAAQ,CAEtB,IAA6B,EAC7B,KAAa,EAAA;AAEb,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAAE;QACzC,IAAI,IAAI,CAAC,OAAO,IAAI,SAAS,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AAC9C,YAAA,IAAI,CAAC,OAAO,GAAG,CAAC;AAChB,YAAA,IAAI,CAAC,MAAM,GAAG,CAAC;AACf,YAAA,IAAI,CAAC,OAAO,GAAG,CAAC;YAChB;;QAEF,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAA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,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACzC,gBAAA,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC;gBACzB,SAAS,CAAC,IAAI,CAAC;AACb,oBAAA,IAAI,EAAE,IAAI;AACV,oBAAA,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,UAAU;oBACtB,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,QAAQ,GAAG,CAAC,GAAG,WAAW,CAAC,OAAO;AAC9C,iBAAA,CAAC;;AAEJ,YAAA,IAAI,WAAW,CAAC,aAAa,EAAE;AAC7B,gBAAA,kBAAkB,CAAC,IAAI,CAAC,MAAK;oBAC3B,WAAW,EAAE,aAAa,EAAE,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE;AAC/C,wBAAA,GAAG,WAAW;wBACd,MAAM;wBACN,KAAK;wBACL,KAAK;wBACL,SAAS;wBACT,QAAQ;wBACR,UAAU;wBACV,UAAU;wBACV,UAAU;AACX,qBAAA,CAAC;AACJ,iBAAC,CAAC;;;AAGR,KAAC;AACH;;;;"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
const SPACE = " ";
|
|
2
|
-
function drawText({ context, textAlign, textColor, textFont, textStyle, textGap, textWeight, textSize, x, y, lines, }) {
|
|
3
|
-
context.font = `${textStyle} normal ${textWeight} ${textSize}px ${textFont}`;
|
|
4
|
-
context.fillStyle = textColor;
|
|
5
|
-
context.textAlign = textAlign;
|
|
6
|
-
lines.forEach((line, index) => {
|
|
7
|
-
context.fillText(line, x, y + index * textSize + index * textGap);
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
2
|
function getTextLines({ context, textAlign, textColor, textFont, textStyle, textWeight, textSize, text, maxWidth, }) {
|
|
11
3
|
context.font = `${textStyle} normal ${textWeight} ${textSize}px ${textFont}`;
|
|
12
4
|
context.fillStyle = textColor;
|
|
@@ -43,5 +35,5 @@ function getTextLines({ context, textAlign, textColor, textFont, textStyle, text
|
|
|
43
35
|
return { lines, currentMaxSize };
|
|
44
36
|
}
|
|
45
37
|
|
|
46
|
-
export {
|
|
38
|
+
export { getTextLines };
|
|
47
39
|
//# sourceMappingURL=draw-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draw-text.js","sources":["../../../../../src/module/GraphCanvas/slices/draw-text.ts"],"sourcesContent":["import type { TextStyleEnum } from \"../types\";\n\nexport type DrawTextOptions = {\n lines: string[];\n x: number;\n y: number;\n textSize: number;\n textStyle: TextStyleEnum;\n textWeight: number;\n textFont: string;\n textColor: string;\n textGap: number;\n textAlign: CanvasTextAlign;\n context: CanvasRenderingContext2D;\n};\n\nconst SPACE = \" \";\n\nexport
|
|
1
|
+
{"version":3,"file":"draw-text.js","sources":["../../../../../src/module/GraphCanvas/slices/draw-text.ts"],"sourcesContent":["import type { TextStyleEnum } from \"../types\";\n\nexport type DrawTextOptions = {\n lines: string[];\n x: number;\n y: number;\n textSize: number;\n textStyle: TextStyleEnum;\n textWeight: number;\n textFont: string;\n textColor: string;\n textGap: number;\n textAlign: CanvasTextAlign;\n context: CanvasRenderingContext2D;\n};\n\nconst SPACE = \" \";\n\nexport type GetTextLines = {\n text: string;\n textSize: number;\n textStyle: TextStyleEnum;\n textWeight: number;\n textFont: string;\n textColor: string;\n textAlign: CanvasTextAlign;\n context: CanvasRenderingContext2D;\n maxWidth: number;\n};\nexport function getTextLines({\n context,\n textAlign,\n textColor,\n textFont,\n textStyle,\n textWeight,\n textSize,\n text,\n maxWidth,\n}: GetTextLines) {\n context.font = `${textStyle} normal ${textWeight} ${textSize}px ${textFont}`;\n context.fillStyle = textColor;\n context.textAlign = textAlign;\n\n const spaceWidth = context.measureText(\" \").width;\n const lines: string[] = [];\n let lineWidth = 0;\n let line = \"\";\n let currentMaxSize = 0;\n\n for (const word of text.split(\" \")) {\n const size = context.measureText(word).width;\n lineWidth += size + spaceWidth;\n\n if (line === \"\") {\n line = word;\n\n continue;\n }\n if (lineWidth > maxWidth) {\n const initialSize = lineWidth - size - spaceWidth;\n if (initialSize > currentMaxSize) currentMaxSize = initialSize;\n\n lineWidth = size;\n lines.push(line);\n line = word;\n } else {\n lineWidth += spaceWidth;\n line += `${SPACE}${word}`;\n }\n }\n\n if (line !== \"\") lines.push(line);\n if (lineWidth > currentMaxSize) currentMaxSize = lineWidth;\n\n return { lines, currentMaxSize };\n}\n"],"names":[],"mappings":"AAgBA,MAAM,KAAK,GAAG,GAAG;AAaX,SAAU,YAAY,CAAC,EAC3B,OAAO,EACP,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,UAAU,EACV,QAAQ,EACR,IAAI,EACJ,QAAQ,GACK,EAAA;AACb,IAAA,OAAO,CAAC,IAAI,GAAG,CAAA,EAAG,SAAS,CAAA,QAAA,EAAW,UAAU,CAAA,CAAA,EAAI,QAAQ,CAAA,GAAA,EAAM,QAAQ,CAAA,CAAE;AAC5E,IAAA,OAAO,CAAC,SAAS,GAAG,SAAS;AAC7B,IAAA,OAAO,CAAC,SAAS,GAAG,SAAS;IAE7B,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK;IACjD,MAAM,KAAK,GAAa,EAAE;IAC1B,IAAI,SAAS,GAAG,CAAC;IACjB,IAAI,IAAI,GAAG,EAAE;IACb,IAAI,cAAc,GAAG,CAAC;IAEtB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QAClC,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK;AAC5C,QAAA,SAAS,IAAI,IAAI,GAAG,UAAU;AAE9B,QAAA,IAAI,IAAI,KAAK,EAAE,EAAE;YACf,IAAI,GAAG,IAAI;YAEX;;AAEF,QAAA,IAAI,SAAS,GAAG,QAAQ,EAAE;AACxB,YAAA,MAAM,WAAW,GAAG,SAAS,GAAG,IAAI,GAAG,UAAU;YACjD,IAAI,WAAW,GAAG,cAAc;gBAAE,cAAc,GAAG,WAAW;YAE9D,SAAS,GAAG,IAAI;AAChB,YAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;YAChB,IAAI,GAAG,IAAI;;aACN;YACL,SAAS,IAAI,UAAU;AACvB,YAAA,IAAI,IAAI,CAAG,EAAA,KAAK,CAAG,EAAA,IAAI,EAAE;;;IAI7B,IAAI,IAAI,KAAK,EAAE;AAAE,QAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;IACjC,IAAI,SAAS,GAAG,cAAc;QAAE,cAAc,GAAG,SAAS;AAE1D,IAAA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE;AAClC;;;;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { cloneDeep } from '@krainovsd/js-helpers';
|
|
2
|
+
import { zoomIdentity } from 'd3-zoom';
|
|
3
|
+
import '../constants/force-settings.js';
|
|
4
|
+
import { computeGraphBounds } from '../lib/utils/compute-graph-bounds.js';
|
|
5
|
+
import 'd3-array';
|
|
6
|
+
import 'd3-force';
|
|
7
|
+
import 'd3-selection';
|
|
8
|
+
import 'd3-drag';
|
|
9
|
+
import { initDraw } from './init-draw.js';
|
|
10
|
+
import { SvgContextAdapter } from '../lib/utils/svg-context.js';
|
|
11
|
+
|
|
12
|
+
function exportToSvgSlice(filename = "graph.svg", fit = false) {
|
|
13
|
+
this.tick();
|
|
14
|
+
let svgWidth = this.width;
|
|
15
|
+
let svgHeight = this.height;
|
|
16
|
+
const svgParts = [];
|
|
17
|
+
const adapter = new SvgContextAdapter(svgParts);
|
|
18
|
+
const clone = Object.assign(Object.create(Object.getPrototypeOf(this)), this);
|
|
19
|
+
clone.context = adapter;
|
|
20
|
+
clone.isSelecting = false;
|
|
21
|
+
clone.listeners = {};
|
|
22
|
+
clone.nodes = cloneDeep(this.nodes);
|
|
23
|
+
clone.links = cloneDeep(this.links);
|
|
24
|
+
clone.particles = cloneDeep(this.particles);
|
|
25
|
+
if (fit) {
|
|
26
|
+
const bounds = computeGraphBounds(clone.nodes);
|
|
27
|
+
if (bounds) {
|
|
28
|
+
const pad = 50;
|
|
29
|
+
const graphWidth = bounds.maxX - bounds.minX;
|
|
30
|
+
const graphHeight = bounds.maxY - bounds.minY;
|
|
31
|
+
if (graphWidth > 0 && graphHeight > 0) {
|
|
32
|
+
svgWidth = graphWidth + pad * 2;
|
|
33
|
+
svgHeight = graphHeight + pad * 2;
|
|
34
|
+
const graphCenterX = bounds.minX + graphWidth / 2;
|
|
35
|
+
const graphCenterY = bounds.minY + graphHeight / 2;
|
|
36
|
+
clone.areaTransform = zoomIdentity
|
|
37
|
+
.translate(svgWidth / 2, svgHeight / 2)
|
|
38
|
+
.translate(-graphCenterX, -graphCenterY);
|
|
39
|
+
clone.width = svgWidth;
|
|
40
|
+
clone.height = svgHeight;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const draw = initDraw.call(clone);
|
|
45
|
+
draw();
|
|
46
|
+
adapter.closeTransform();
|
|
47
|
+
const svg = [
|
|
48
|
+
`<svg xmlns="http://www.w3.org/2000/svg" width="${svgWidth}" height="${svgHeight}">`,
|
|
49
|
+
...svgParts,
|
|
50
|
+
"</svg>",
|
|
51
|
+
].join("\n");
|
|
52
|
+
const blob = new Blob([svg], { type: "image/svg+xml;charset=utf-8" });
|
|
53
|
+
const url = URL.createObjectURL(blob);
|
|
54
|
+
const a = document.createElement("a");
|
|
55
|
+
a.href = url;
|
|
56
|
+
a.download = filename;
|
|
57
|
+
a.click();
|
|
58
|
+
URL.revokeObjectURL(url);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { exportToSvgSlice };
|
|
62
|
+
//# sourceMappingURL=export-svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-svg.js","sources":["../../../../../src/module/GraphCanvas/slices/export-svg.ts"],"sourcesContent":["import { cloneDeep } from \"@krainovsd/js-helpers\";\nimport { zoomIdentity } from \"d3-zoom\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport { computeGraphBounds } from \"../lib\";\nimport { SvgContextAdapter } from \"../lib/utils/svg-context\";\nimport { initDraw } from \"./init-draw\";\n\nexport function exportToSvgSlice<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>, filename: string = \"graph.svg\", fit: boolean = false) {\n this.tick();\n\n let svgWidth = this.width;\n let svgHeight = this.height;\n\n const svgParts: string[] = [];\n const adapter = new SvgContextAdapter(svgParts);\n\n const clone = Object.assign(Object.create(Object.getPrototypeOf(this)), this) as GraphCanvas<\n NodeData,\n LinkData\n >;\n clone.context = adapter as unknown as CanvasRenderingContext2D;\n clone.isSelecting = false;\n clone.listeners = {} as typeof this.listeners;\n clone.nodes = cloneDeep(this.nodes);\n clone.links = cloneDeep(this.links);\n clone.particles = cloneDeep(this.particles);\n\n if (fit) {\n const bounds = computeGraphBounds(clone.nodes);\n if (bounds) {\n const pad = 50;\n const graphWidth = bounds.maxX - bounds.minX;\n const graphHeight = bounds.maxY - bounds.minY;\n if (graphWidth > 0 && graphHeight > 0) {\n svgWidth = graphWidth + pad * 2;\n svgHeight = graphHeight + pad * 2;\n const graphCenterX = bounds.minX + graphWidth / 2;\n const graphCenterY = bounds.minY + graphHeight / 2;\n clone.areaTransform = zoomIdentity\n .translate(svgWidth / 2, svgHeight / 2)\n .translate(-graphCenterX, -graphCenterY);\n clone.width = svgWidth;\n clone.height = svgHeight;\n }\n }\n }\n\n const draw = initDraw.call<\n GraphCanvas<NodeData, LinkData>,\n Parameters<typeof initDraw>,\n ReturnType<typeof initDraw>\n >(clone);\n draw();\n adapter.closeTransform();\n\n const svg = [\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${svgWidth}\" height=\"${svgHeight}\">`,\n ...svgParts,\n \"</svg>\",\n ].join(\"\\n\");\n\n const blob = new Blob([svg], { type: \"image/svg+xml;charset=utf-8\" });\n const url = URL.createObjectURL(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';
|
|
4
4
|
import { select } from 'd3-selection';
|
|
5
5
|
|
|
6
|
-
function initDnd() {
|
|
6
|
+
function initDnd(staticMode = false) {
|
|
7
7
|
if (!this.area || !this.nodes)
|
|
8
8
|
throw new Error("bad init data");
|
|
9
9
|
const dragHandler = drag()
|
|
@@ -31,8 +31,20 @@ function initDnd() {
|
|
|
31
31
|
const mouseEvent = event.sourceEvent;
|
|
32
32
|
const [pointerX, pointerY] = this.getPointerAreaPosition(mouseEvent);
|
|
33
33
|
if (this._translateExtent) {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const x = Math.max(this._translateExtent[0][0], Math.min(this._translateExtent[1][0], pointerX));
|
|
35
|
+
const y = Math.max(this._translateExtent[0][1], Math.min(this._translateExtent[1][1], pointerY));
|
|
36
|
+
if (staticMode) {
|
|
37
|
+
event.subject.x = x;
|
|
38
|
+
event.subject.y = y;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
event.subject.fx = x;
|
|
42
|
+
event.subject.fy = y;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (staticMode) {
|
|
46
|
+
event.subject.x = pointerX;
|
|
47
|
+
event.subject.y = pointerY;
|
|
36
48
|
}
|
|
37
49
|
else {
|
|
38
50
|
event.subject.fx = pointerX;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-dnd.js","sources":["../../../../../src/module/GraphCanvas/slices/init-dnd.ts"],"sourcesContent":["import { isBoolean } from \"@krainovsd/js-helpers\";\nimport { greatest } from \"d3-array\";\nimport { drag as d3Drag } from \"d3-drag\";\nimport { select as d3Select } from \"d3-selection\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport type { DragEventInterface } from \"../types\";\n\nexport function initDnd<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData
|
|
1
|
+
{"version":3,"file":"init-dnd.js","sources":["../../../../../src/module/GraphCanvas/slices/init-dnd.ts"],"sourcesContent":["import { isBoolean } from \"@krainovsd/js-helpers\";\nimport { greatest } from \"d3-array\";\nimport { drag as d3Drag } from \"d3-drag\";\nimport { select as d3Select } from \"d3-selection\";\nimport type { GraphCanvas } from \"../GraphCanvas\";\nimport type { DragEventInterface } from \"../types\";\n\nexport function initDnd<\n NodeData extends Record<string, unknown>,\n LinkData extends Record<string, unknown>,\n>(this: GraphCanvas<NodeData, LinkData>, staticMode: boolean = false) {\n if (!this.area || !this.nodes) throw new Error(\"bad init data\");\n\n const dragHandler = d3Drag<HTMLCanvasElement, unknown>()\n .subject((event: DragEventInterface<NodeData>) => {\n if (this.listeners.onDragSubject) {\n return this.listeners.onDragSubject.call(this, event);\n }\n\n const mouseEvent = event.sourceEvent as MouseEvent | TouchEvent;\n const [pointerX, pointerY] = this.getPointerAreaPosition(mouseEvent);\n\n return greatest(this.nodes, (node) => {\n if (!node.x || !node.y || (isBoolean(node.drag) && !node.drag)) return undefined;\n\n return this.graphSettings.dragPlaceCoefficient(node, pointerX, pointerY);\n });\n })\n .on(\"start\", (event: DragEventInterface<NodeData>) => {\n this.listeners.onStartDragFinished?.call?.(this, event);\n })\n .on(\"drag\", (event: DragEventInterface<NodeData>) => {\n if (!this.isDragging) {\n this.isDragging = true;\n if (this.simulation) this.simulation.alphaTarget(0.3).restart();\n }\n\n const mouseEvent = event.sourceEvent as MouseEvent | TouchEvent;\n const [pointerX, pointerY] = this.getPointerAreaPosition(mouseEvent);\n\n if (this._translateExtent) {\n const x = Math.max(\n this._translateExtent[0][0],\n Math.min(this._translateExtent[1][0], pointerX),\n );\n const y = Math.max(\n this._translateExtent[0][1],\n Math.min(this._translateExtent[1][1], pointerY),\n );\n if (staticMode) {\n event.subject.x = x;\n event.subject.y = y;\n } else {\n event.subject.fx = x;\n event.subject.fy = y;\n }\n } else if (staticMode) {\n event.subject.x = pointerX;\n event.subject.y = pointerY;\n } else {\n event.subject.fx = pointerX;\n event.subject.fy = pointerY;\n }\n\n this.listeners.onMoveDragFinished?.call?.(this, event);\n })\n .on(\"end\", (event: DragEventInterface<NodeData>) => {\n this.isDragging = false;\n\n if (!event.active && this.simulation) this.simulation.alphaTarget(0);\n\n const sourceEvent = event.sourceEvent as MouseEvent | TouchEvent;\n if (sourceEvent.altKey) {\n const [pointerX, pointerY] = this.getPointerAreaPosition(sourceEvent);\n if (this._translateExtent) {\n event.subject.fx = Math.max(\n this._translateExtent[0][0],\n Math.min(this._translateExtent[1][0], pointerX),\n );\n event.subject.fy = Math.max(\n this._translateExtent[0][1],\n Math.min(this._translateExtent[1][1], pointerY),\n );\n } else {\n event.subject.fx = pointerX;\n event.subject.fy = pointerY;\n }\n } else {\n event.subject.fx = null;\n event.subject.fy = null;\n }\n\n this.listeners.onEndDragFinished?.call?.(this, event);\n });\n\n d3Select(this.area).call(dragHandler);\n}\n"],"names":["d3Drag","d3Select"],"mappings":";;;;;AAOgB,SAAA,OAAO,CAGkB,UAAA,GAAsB,KAAK,EAAA;IAClE,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC;IAE/D,MAAM,WAAW,GAAGA,IAAM;AACvB,SAAA,OAAO,CAAC,CAAC,KAAmC,KAAI;AAC/C,QAAA,IAAI,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE;AAChC,YAAA,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;;AAGvD,QAAA,MAAM,UAAU,GAAG,KAAK,CAAC,WAAsC;AAC/D,QAAA,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC;QAEpE,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,KAAI;YACnC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,SAAS,CAAC,I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