@html-graph/html-graph 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html-graph.d.ts +50 -39
- package/dist/html-graph.js +197 -192
- package/dist/html-graph.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/html-graph.js
CHANGED
|
@@ -70,7 +70,7 @@ class ne {
|
|
|
70
70
|
}, f = {
|
|
71
71
|
x: c.scale * g + c.x,
|
|
72
72
|
y: c.scale * y + c.y
|
|
73
|
-
},
|
|
73
|
+
}, A = {
|
|
74
74
|
x: v.x,
|
|
75
75
|
y: v.y,
|
|
76
76
|
width: h.width * c.scale,
|
|
@@ -78,7 +78,7 @@ class ne {
|
|
|
78
78
|
direction: r.direction,
|
|
79
79
|
portId: o.from,
|
|
80
80
|
nodeId: r.nodeId
|
|
81
|
-
},
|
|
81
|
+
}, x = {
|
|
82
82
|
x: f.x,
|
|
83
83
|
y: f.y,
|
|
84
84
|
width: n.width * c.scale,
|
|
@@ -87,7 +87,7 @@ class ne {
|
|
|
87
87
|
portId: o.to,
|
|
88
88
|
nodeId: s.nodeId
|
|
89
89
|
};
|
|
90
|
-
o.shape.render({ from:
|
|
90
|
+
o.shape.render({ from: A, to: x });
|
|
91
91
|
}
|
|
92
92
|
updateEdgePriority(e) {
|
|
93
93
|
const o = this.graphStore.getEdge(e);
|
|
@@ -225,7 +225,7 @@ class ve {
|
|
|
225
225
|
return { ...this.viewportStore.getContentMatrix() };
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
class
|
|
228
|
+
class pe {
|
|
229
229
|
constructor(e) {
|
|
230
230
|
i(this, "onAfterNodeAdded");
|
|
231
231
|
i(this, "onAfterNodeUpdated");
|
|
@@ -323,20 +323,20 @@ class S extends Error {
|
|
|
323
323
|
i(this, "name", "HtmlGraphError");
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
|
-
const
|
|
326
|
+
const xe = (t, e) => ({
|
|
327
327
|
x: t / 2,
|
|
328
328
|
y: e / 2
|
|
329
|
-
}),
|
|
329
|
+
}), X = (t) => () => t, oe = X(0), Ae = () => {
|
|
330
330
|
let t = 0;
|
|
331
331
|
return () => t++;
|
|
332
332
|
}, Ee = (t, e) => {
|
|
333
333
|
let o = oe, r = oe;
|
|
334
|
-
const s =
|
|
335
|
-
return t === "incremental" && (o = s), e === "incremental" && (r = s), typeof t == "number" && (o =
|
|
334
|
+
const s = Ae();
|
|
335
|
+
return t === "incremental" && (o = s), e === "incremental" && (r = s), typeof t == "number" && (o = X(t)), typeof e == "number" && (r = X(e)), typeof t == "function" && (o = t), typeof e == "function" && (r = e), {
|
|
336
336
|
nodesPriorityFn: o,
|
|
337
337
|
edgesPriorityFn: r
|
|
338
338
|
};
|
|
339
|
-
},
|
|
339
|
+
}, p = (t, e, o) => ({
|
|
340
340
|
x: e.x * t.x - e.y * t.y + ((1 - e.x) * o.x + e.y * o.y),
|
|
341
341
|
y: e.y * t.x + e.x * t.y + ((1 - e.x) * o.y - e.y * o.x)
|
|
342
342
|
}), T = (t, e, o) => ({ x: e * Math.cos(t), y: o * Math.sin(t) }), w = {
|
|
@@ -347,9 +347,9 @@ const Ae = (t, e) => ({
|
|
|
347
347
|
w,
|
|
348
348
|
{ x: o, y: r },
|
|
349
349
|
{ x: o, y: -r }
|
|
350
|
-
].map((a) =>
|
|
350
|
+
].map((a) => p(a, t, w)).map((a) => ({ x: a.x + e.x, y: a.y + e.y })), n = `M ${h[0].x} ${h[0].y}`, d = `L ${h[1].x} ${h[1].y}`, c = `L ${h[2].x} ${h[2].y}`;
|
|
351
351
|
return `${n} ${d} ${c}`;
|
|
352
|
-
},
|
|
352
|
+
}, B = (t, e) => {
|
|
353
353
|
const o = [];
|
|
354
354
|
if (t.length > 0 && o.push(`M ${t[0].x} ${t[0].y}`), t.length === 2 && o.push(`L ${t[1].x} ${t[1].y}`), t.length > 2) {
|
|
355
355
|
const r = t.length - 1;
|
|
@@ -358,11 +358,11 @@ const Ae = (t, e) => ({
|
|
|
358
358
|
let a = 0, l = 0, g = 0;
|
|
359
359
|
const y = c > 0, v = c < r, f = y && v;
|
|
360
360
|
if (y && (a = -s, l = -h, g = n), v) {
|
|
361
|
-
const
|
|
362
|
-
s =
|
|
361
|
+
const I = t[c + 1];
|
|
362
|
+
s = I.x - d.x, h = I.y - d.y, n = Math.sqrt(s * s + h * h);
|
|
363
363
|
}
|
|
364
|
-
const
|
|
365
|
-
c > 0 && o.push(`L ${
|
|
364
|
+
const x = n !== 0 ? Math.min((f ? e : 0) / n, c < r - 1 ? 0.5 : 1) : 0, b = f ? { x: d.x + s * x, y: d.y + h * x } : d, m = g !== 0 ? Math.min((f ? e : 0) / g, c > 1 ? 0.5 : 1) : 0, R = f ? { x: d.x + a * m, y: d.y + l * m } : d;
|
|
365
|
+
c > 0 && o.push(`L ${R.x} ${R.y}`), f && o.push(
|
|
366
366
|
`C ${d.x} ${d.y} ${d.x} ${d.y} ${b.x} ${b.y}`
|
|
367
367
|
);
|
|
368
368
|
});
|
|
@@ -397,11 +397,11 @@ const Ae = (t, e) => ({
|
|
|
397
397
|
flipY: a
|
|
398
398
|
};
|
|
399
399
|
}, Se = (t) => {
|
|
400
|
-
const e =
|
|
400
|
+
const e = p(
|
|
401
401
|
{ x: t.arrowLength, y: w.y },
|
|
402
402
|
t.fromVector,
|
|
403
403
|
w
|
|
404
|
-
), o =
|
|
404
|
+
), o = p(
|
|
405
405
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
406
406
|
t.toVector,
|
|
407
407
|
t.to
|
|
@@ -414,22 +414,22 @@ const Ae = (t, e) => ({
|
|
|
414
414
|
}, h = `M ${e.x} ${e.y} C ${r.x} ${r.y}, ${s.x} ${s.y}, ${o.x} ${o.y}`, n = t.hasSourceArrow ? "" : `M ${w.x} ${w.y} L ${e.x} ${e.y} `, d = t.hasTargetArrow ? "" : ` M ${o.x} ${o.y} L ${t.to.x} ${t.to.y}`;
|
|
415
415
|
return `${n}${h}${d}`;
|
|
416
416
|
}, be = (t) => {
|
|
417
|
-
const e = t.hasSourceArrow ?
|
|
417
|
+
const e = t.hasSourceArrow ? p(
|
|
418
418
|
{ x: t.arrowLength, y: w.y },
|
|
419
419
|
t.fromVector,
|
|
420
420
|
w
|
|
421
|
-
) : w, o = t.hasTargetArrow ?
|
|
421
|
+
) : w, o = t.hasTargetArrow ? p(
|
|
422
422
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
423
423
|
t.toVector,
|
|
424
424
|
t.to
|
|
425
|
-
) : t.to, r = t.arrowLength, s = Math.cos(t.detourDirection) * t.detourDistance, h = Math.sin(t.detourDirection) * t.detourDistance, n = s * t.flipX, d = h * t.flipY, c =
|
|
425
|
+
) : t.to, r = t.arrowLength, s = Math.cos(t.detourDirection) * t.detourDistance, h = Math.sin(t.detourDirection) * t.detourDistance, n = s * t.flipX, d = h * t.flipY, c = p(
|
|
426
426
|
{ x: r, y: w.y },
|
|
427
427
|
t.fromVector,
|
|
428
428
|
w
|
|
429
429
|
), a = {
|
|
430
430
|
x: c.x + n,
|
|
431
431
|
y: c.y + d
|
|
432
|
-
}, l =
|
|
432
|
+
}, l = p(
|
|
433
433
|
{ x: t.to.x - r, y: t.to.y },
|
|
434
434
|
t.toVector,
|
|
435
435
|
t.to
|
|
@@ -442,34 +442,34 @@ const Ae = (t, e) => ({
|
|
|
442
442
|
}, f = {
|
|
443
443
|
x: l.x - t.curvature * t.toVector.x,
|
|
444
444
|
y: l.y - t.curvature * t.toVector.y
|
|
445
|
-
},
|
|
445
|
+
}, A = {
|
|
446
446
|
x: c.x + n,
|
|
447
447
|
y: c.y + d
|
|
448
|
-
},
|
|
448
|
+
}, x = {
|
|
449
449
|
x: l.x + n,
|
|
450
450
|
y: l.y + d
|
|
451
451
|
};
|
|
452
452
|
return [
|
|
453
453
|
`M ${e.x} ${e.y}`,
|
|
454
454
|
`L ${c.x} ${c.y}`,
|
|
455
|
-
`C ${v.x} ${v.y} ${
|
|
456
|
-
`C ${
|
|
455
|
+
`C ${v.x} ${v.y} ${A.x} ${A.y} ${y.x} ${y.y}`,
|
|
456
|
+
`C ${x.x} ${x.y} ${f.x} ${f.y} ${l.x} ${l.y}`,
|
|
457
457
|
`L ${o.x} ${o.y}`
|
|
458
458
|
].join(" ");
|
|
459
459
|
}, me = (t) => {
|
|
460
|
-
const e = t.hasSourceArrow ?
|
|
460
|
+
const e = t.hasSourceArrow ? p(
|
|
461
461
|
{ x: t.arrowLength, y: w.y },
|
|
462
462
|
t.fromVector,
|
|
463
463
|
w
|
|
464
|
-
) : w, o = t.hasTargetArrow ?
|
|
464
|
+
) : w, o = t.hasTargetArrow ? p(
|
|
465
465
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
466
466
|
t.toVector,
|
|
467
467
|
t.to
|
|
468
|
-
) : t.to, r = t.arrowLength + t.arrowOffset, s = r - t.roundness, h =
|
|
468
|
+
) : t.to, r = t.arrowLength + t.arrowOffset, s = r - t.roundness, h = p(
|
|
469
469
|
{ x: s, y: w.y },
|
|
470
470
|
t.fromVector,
|
|
471
471
|
w
|
|
472
|
-
), n =
|
|
472
|
+
), n = p(
|
|
473
473
|
{ x: t.to.x - s, y: t.to.y },
|
|
474
474
|
t.toVector,
|
|
475
475
|
t.to
|
|
@@ -480,65 +480,65 @@ const Ae = (t, e) => ({
|
|
|
480
480
|
x: t.flipX > 0 ? t.to.x - d : t.to.x + r,
|
|
481
481
|
y: n.y
|
|
482
482
|
}, y = { x: g.x, y: c };
|
|
483
|
-
return
|
|
483
|
+
return B(
|
|
484
484
|
[e, h, a, l, y, g, n, o],
|
|
485
485
|
t.roundness
|
|
486
486
|
);
|
|
487
|
-
},
|
|
488
|
-
const e = t.hasSourceArrow ?
|
|
487
|
+
}, H = (t) => {
|
|
488
|
+
const e = t.hasSourceArrow ? p(
|
|
489
489
|
{ x: t.arrowLength, y: w.y },
|
|
490
490
|
t.fromVector,
|
|
491
491
|
w
|
|
492
|
-
) : w, o = t.hasTargetArrow ?
|
|
492
|
+
) : w, o = t.hasTargetArrow ? p(
|
|
493
493
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
494
494
|
t.toVector,
|
|
495
495
|
t.to
|
|
496
|
-
) : t.to, r = t.arrowLength + t.arrowOffset, s =
|
|
496
|
+
) : t.to, r = t.arrowLength + t.arrowOffset, s = p(
|
|
497
497
|
{ x: r, y: w.y },
|
|
498
498
|
t.fromVector,
|
|
499
499
|
w
|
|
500
|
-
), h = Math.cos(t.detourDirection) * t.detourDistance, n = Math.sin(t.detourDirection) * t.detourDistance, d = h * t.flipX, c = n * t.flipY, a = { x: s.x + d, y: s.y + c }, l =
|
|
500
|
+
), h = Math.cos(t.detourDirection) * t.detourDistance, n = Math.sin(t.detourDirection) * t.detourDistance, d = h * t.flipX, c = n * t.flipY, a = { x: s.x + d, y: s.y + c }, l = p(
|
|
501
501
|
{ x: t.to.x - r, y: t.to.y },
|
|
502
502
|
t.toVector,
|
|
503
503
|
t.to
|
|
504
504
|
), g = { x: l.x + d, y: l.y + c };
|
|
505
|
-
return
|
|
505
|
+
return B(
|
|
506
506
|
[e, s, a, g, l, o],
|
|
507
507
|
t.roundness
|
|
508
508
|
);
|
|
509
509
|
}, Te = (t) => {
|
|
510
|
-
const e = t.hasSourceArrow ?
|
|
510
|
+
const e = t.hasSourceArrow ? p(
|
|
511
511
|
{ x: t.arrowLength, y: w.y },
|
|
512
512
|
t.fromVector,
|
|
513
513
|
w
|
|
514
|
-
) : w, o = t.hasTargetArrow ?
|
|
514
|
+
) : w, o = t.hasTargetArrow ? p(
|
|
515
515
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
516
516
|
t.toVector,
|
|
517
517
|
t.to
|
|
518
|
-
) : t.to, r = t.arrowLength + t.arrowOffset, s =
|
|
518
|
+
) : t.to, r = t.arrowLength + t.arrowOffset, s = p(
|
|
519
519
|
{ x: r, y: w.y },
|
|
520
520
|
t.fromVector,
|
|
521
521
|
w
|
|
522
|
-
), h =
|
|
522
|
+
), h = p(
|
|
523
523
|
{ x: t.to.x - r, y: t.to.y },
|
|
524
524
|
t.toVector,
|
|
525
525
|
t.to
|
|
526
526
|
);
|
|
527
|
-
return
|
|
527
|
+
return B([e, s, h, o], t.roundness);
|
|
528
528
|
}, Ne = (t) => {
|
|
529
|
-
const e = t.hasSourceArrow ?
|
|
529
|
+
const e = t.hasSourceArrow ? p(
|
|
530
530
|
{ x: t.arrowLength, y: w.y },
|
|
531
531
|
t.fromVector,
|
|
532
532
|
w
|
|
533
|
-
) : w, o = t.hasTargetArrow ?
|
|
533
|
+
) : w, o = t.hasTargetArrow ? p(
|
|
534
534
|
{ x: t.to.x - t.arrowLength, y: t.to.y },
|
|
535
535
|
t.toVector,
|
|
536
536
|
t.to
|
|
537
|
-
) : t.to, r = t.arrowLength + t.arrowOffset, s = r - t.roundness, h =
|
|
537
|
+
) : t.to, r = t.arrowLength + t.arrowOffset, s = r - t.roundness, h = p(
|
|
538
538
|
{ x: s, y: w.y },
|
|
539
539
|
t.fromVector,
|
|
540
540
|
w
|
|
541
|
-
), n =
|
|
541
|
+
), n = p(
|
|
542
542
|
{ x: t.to.x - s, y: t.to.y },
|
|
543
543
|
t.toVector,
|
|
544
544
|
t.to
|
|
@@ -549,11 +549,11 @@ const Ae = (t, e) => ({
|
|
|
549
549
|
x: n.x,
|
|
550
550
|
y: t.flipY > 0 ? t.to.y - d : t.to.y + r
|
|
551
551
|
}, y = { x: c, y: g.y };
|
|
552
|
-
return
|
|
552
|
+
return B(
|
|
553
553
|
[e, h, a, l, y, g, n, o],
|
|
554
554
|
t.roundness
|
|
555
555
|
);
|
|
556
|
-
},
|
|
556
|
+
}, j = (t) => {
|
|
557
557
|
const e = t.arrowOffset, o = t.side, r = t.arrowLength + e, s = r + 2 * o, n = [
|
|
558
558
|
{ x: t.arrowLength, y: w.y },
|
|
559
559
|
{ x: r, y: w.y },
|
|
@@ -564,16 +564,16 @@ const Ae = (t, e) => ({
|
|
|
564
564
|
{ x: r, y: w.y },
|
|
565
565
|
{ x: t.arrowLength, y: w.y }
|
|
566
566
|
].map(
|
|
567
|
-
(c) =>
|
|
567
|
+
(c) => p(c, t.fromVector, w)
|
|
568
568
|
), d = `M ${w.x} ${w.y} L ${n[0].x} ${n[0].y} `;
|
|
569
|
-
return `${t.hasSourceArrow || t.hasTargetArrow ? "" : d}${
|
|
569
|
+
return `${t.hasSourceArrow || t.hasTargetArrow ? "" : d}${B(n, t.roundness)}`;
|
|
570
570
|
}, Pe = (t) => {
|
|
571
571
|
const e = t.smallRadius, o = t.radius, r = Math.sqrt(e * e + o * o), s = e + o, h = t.arrowLength + r * (1 - o / s), n = e * o / s, c = [
|
|
572
572
|
{ x: t.arrowLength, y: w.y },
|
|
573
573
|
{ x: h, y: n },
|
|
574
574
|
{ x: h, y: -n }
|
|
575
575
|
].map(
|
|
576
|
-
(g) =>
|
|
576
|
+
(g) => p(g, t.fromVector, w)
|
|
577
577
|
), a = [
|
|
578
578
|
`M ${c[0].x} ${c[0].y}`,
|
|
579
579
|
`A ${e} ${e} 0 0 1 ${c[1].x} ${c[1].y}`,
|
|
@@ -721,7 +721,7 @@ class Me {
|
|
|
721
721
|
y: h
|
|
722
722
|
};
|
|
723
723
|
let g, y = a, v = -this.arrowLength;
|
|
724
|
-
if (e.from.portId === e.to.portId ? (g =
|
|
724
|
+
if (e.from.portId === e.to.portId ? (g = j({
|
|
725
725
|
fromVector: c,
|
|
726
726
|
arrowLength: this.arrowLength,
|
|
727
727
|
side: this.cycleSquareSide,
|
|
@@ -729,7 +729,7 @@ class Me {
|
|
|
729
729
|
roundness: this.roundness,
|
|
730
730
|
hasSourceArrow: this.hasSourceArrow,
|
|
731
731
|
hasTargetArrow: this.hasTargetArrow
|
|
732
|
-
}), y = c, v = this.arrowLength) : e.from.nodeId === e.to.nodeId ? g =
|
|
732
|
+
}), y = c, v = this.arrowLength) : e.from.nodeId === e.to.nodeId ? g = H({
|
|
733
733
|
to: l,
|
|
734
734
|
fromVector: c,
|
|
735
735
|
toVector: a,
|
|
@@ -772,7 +772,7 @@ class Me {
|
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
774
|
}
|
|
775
|
-
class
|
|
775
|
+
class Ve {
|
|
776
776
|
constructor(e) {
|
|
777
777
|
i(this, "svg", $());
|
|
778
778
|
i(this, "group", W());
|
|
@@ -813,7 +813,7 @@ class Ce {
|
|
|
813
813
|
y: h
|
|
814
814
|
};
|
|
815
815
|
let g, y = a, v = -this.arrowLength;
|
|
816
|
-
if (e.from.portId === e.to.portId ? (g =
|
|
816
|
+
if (e.from.portId === e.to.portId ? (g = j({
|
|
817
817
|
fromVector: c,
|
|
818
818
|
arrowLength: this.arrowLength,
|
|
819
819
|
side: this.cycleSquareSide,
|
|
@@ -821,7 +821,7 @@ class Ce {
|
|
|
821
821
|
roundness: this.roundness,
|
|
822
822
|
hasSourceArrow: this.hasSourceArrow,
|
|
823
823
|
hasTargetArrow: this.hasTargetArrow
|
|
824
|
-
}), y = c, v = this.arrowLength) : e.from.nodeId === e.to.nodeId ? g =
|
|
824
|
+
}), y = c, v = this.arrowLength) : e.from.nodeId === e.to.nodeId ? g = H({
|
|
825
825
|
to: l,
|
|
826
826
|
fromVector: c,
|
|
827
827
|
toVector: a,
|
|
@@ -863,7 +863,7 @@ class Ce {
|
|
|
863
863
|
}
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
class
|
|
866
|
+
class Le {
|
|
867
867
|
constructor(e) {
|
|
868
868
|
i(this, "svg", $());
|
|
869
869
|
i(this, "group", W());
|
|
@@ -904,7 +904,7 @@ class Ve {
|
|
|
904
904
|
y: h
|
|
905
905
|
};
|
|
906
906
|
let g, y = a, v = -this.arrowLength;
|
|
907
|
-
if (e.from.portId === e.to.portId ? (g =
|
|
907
|
+
if (e.from.portId === e.to.portId ? (g = j({
|
|
908
908
|
fromVector: c,
|
|
909
909
|
arrowLength: this.arrowLength,
|
|
910
910
|
side: this.cycleSquareSide,
|
|
@@ -912,7 +912,7 @@ class Ve {
|
|
|
912
912
|
roundness: this.roundness,
|
|
913
913
|
hasSourceArrow: this.hasSourceArrow,
|
|
914
914
|
hasTargetArrow: this.hasTargetArrow
|
|
915
|
-
}), y = c, v = this.arrowLength) : e.from.nodeId === e.to.nodeId ? g =
|
|
915
|
+
}), y = c, v = this.arrowLength) : e.from.nodeId === e.to.nodeId ? g = H({
|
|
916
916
|
to: l,
|
|
917
917
|
fromVector: c,
|
|
918
918
|
toVector: a,
|
|
@@ -955,12 +955,12 @@ class Ve {
|
|
|
955
955
|
}
|
|
956
956
|
}
|
|
957
957
|
}
|
|
958
|
-
const
|
|
958
|
+
const Re = (t) => {
|
|
959
959
|
if (typeof t == "function")
|
|
960
960
|
return t;
|
|
961
961
|
switch (t == null ? void 0 : t.type) {
|
|
962
962
|
case "straight":
|
|
963
|
-
return () => new
|
|
963
|
+
return () => new Ve({
|
|
964
964
|
color: t.color,
|
|
965
965
|
width: t.width,
|
|
966
966
|
arrowLength: t.arrowLength,
|
|
@@ -988,7 +988,7 @@ const Le = (t) => {
|
|
|
988
988
|
detourDirection: t.detourDirection
|
|
989
989
|
});
|
|
990
990
|
case "vertical":
|
|
991
|
-
return () => new
|
|
991
|
+
return () => new Le({
|
|
992
992
|
color: t.color,
|
|
993
993
|
width: t.width,
|
|
994
994
|
arrowLength: t.arrowLength,
|
|
@@ -1016,7 +1016,7 @@ const Le = (t) => {
|
|
|
1016
1016
|
detourDirection: t.detourDirection
|
|
1017
1017
|
});
|
|
1018
1018
|
}
|
|
1019
|
-
},
|
|
1019
|
+
}, Ie = (t) => {
|
|
1020
1020
|
var o, r, s, h, n;
|
|
1021
1021
|
const e = Ee(
|
|
1022
1022
|
(o = t == null ? void 0 : t.nodes) == null ? void 0 : o.priority,
|
|
@@ -1024,14 +1024,14 @@ const Le = (t) => {
|
|
|
1024
1024
|
);
|
|
1025
1025
|
return {
|
|
1026
1026
|
nodes: {
|
|
1027
|
-
centerFn: ((s = t == null ? void 0 : t.nodes) == null ? void 0 : s.centerFn) ??
|
|
1027
|
+
centerFn: ((s = t == null ? void 0 : t.nodes) == null ? void 0 : s.centerFn) ?? xe,
|
|
1028
1028
|
priorityFn: e.nodesPriorityFn
|
|
1029
1029
|
},
|
|
1030
1030
|
ports: {
|
|
1031
1031
|
direction: ((h = t == null ? void 0 : t.ports) == null ? void 0 : h.direction) ?? 0
|
|
1032
1032
|
},
|
|
1033
1033
|
edges: {
|
|
1034
|
-
shapeFactory:
|
|
1034
|
+
shapeFactory: Re(((n = t == null ? void 0 : t.edges) == null ? void 0 : n.shape) ?? {}),
|
|
1035
1035
|
priorityFn: e.edgesPriorityFn
|
|
1036
1036
|
}
|
|
1037
1037
|
};
|
|
@@ -1105,7 +1105,7 @@ class de {
|
|
|
1105
1105
|
* emits event just before destruction of canvas
|
|
1106
1106
|
*/
|
|
1107
1107
|
i(this, "onBeforeDestroy");
|
|
1108
|
-
this.element = e, this.graphStore = o, this.viewportStore = r, this.htmlView = s, this.defaults =
|
|
1108
|
+
this.element = e, this.graphStore = o, this.viewportStore = r, this.htmlView = s, this.defaults = Ie(h), this.graph = new pe(this.graphStore), this.viewport = new ve(this.viewportStore), this.graphStore.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.subscribe(
|
|
1109
1109
|
this.onAfterNodePriorityUpdated
|
|
1110
1110
|
), this.graphStore.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.subscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.subscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.subscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.subscribe(
|
|
1111
1111
|
this.onAfterEdgeShapeUpdated
|
|
@@ -1437,7 +1437,7 @@ const re = (t) => ({
|
|
|
1437
1437
|
x: 0,
|
|
1438
1438
|
y: 0
|
|
1439
1439
|
};
|
|
1440
|
-
class
|
|
1440
|
+
class Be {
|
|
1441
1441
|
constructor() {
|
|
1442
1442
|
i(this, "viewportMatrix", ie);
|
|
1443
1443
|
i(this, "contentMatrix", ie);
|
|
@@ -1468,7 +1468,7 @@ class Ie {
|
|
|
1468
1468
|
}, this.viewportMatrix = re(this.contentMatrix), this.afterUpdateEmitter.emit();
|
|
1469
1469
|
}
|
|
1470
1470
|
}
|
|
1471
|
-
class
|
|
1471
|
+
class G {
|
|
1472
1472
|
constructor(e) {
|
|
1473
1473
|
i(this, "elementToNodeId", /* @__PURE__ */ new Map());
|
|
1474
1474
|
i(this, "nodesResizeObserver");
|
|
@@ -1494,7 +1494,7 @@ class J {
|
|
|
1494
1494
|
}), this.canvas.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.canvas.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1495
1495
|
}
|
|
1496
1496
|
static configure(e) {
|
|
1497
|
-
new
|
|
1497
|
+
new G(e);
|
|
1498
1498
|
}
|
|
1499
1499
|
handleNodeResize(e) {
|
|
1500
1500
|
const o = this.elementToNodeId.get(e);
|
|
@@ -1503,11 +1503,11 @@ class J {
|
|
|
1503
1503
|
});
|
|
1504
1504
|
}
|
|
1505
1505
|
}
|
|
1506
|
-
const
|
|
1507
|
-
var g, y, v, f,
|
|
1506
|
+
const Ue = (t) => {
|
|
1507
|
+
var g, y, v, f, A, x;
|
|
1508
1508
|
const e = ((g = t == null ? void 0 : t.events) == null ? void 0 : g.onNodeDrag) ?? (() => {
|
|
1509
1509
|
}), o = ((y = t == null ? void 0 : t.events) == null ? void 0 : y.onBeforeNodeDrag) ?? (() => !0), r = ((v = t == null ? void 0 : t.events) == null ? void 0 : v.onNodeDragFinished) ?? (() => {
|
|
1510
|
-
}), s = (t == null ? void 0 : t.moveOnTop) === !1, h = (f = t == null ? void 0 : t.mouse) == null ? void 0 : f.dragCursor, n = h !== void 0 ? h : "grab", d = (
|
|
1510
|
+
}), s = (t == null ? void 0 : t.moveOnTop) === !1, h = (f = t == null ? void 0 : t.mouse) == null ? void 0 : f.dragCursor, n = h !== void 0 ? h : "grab", d = (A = t == null ? void 0 : t.mouse) == null ? void 0 : A.mouseDownEventVerifier, c = d !== void 0 ? d : (b) => b.button === 0, a = (x = t == null ? void 0 : t.mouse) == null ? void 0 : x.mouseUpEventVerifier;
|
|
1511
1511
|
return {
|
|
1512
1512
|
freezePriority: s,
|
|
1513
1513
|
dragCursor: n,
|
|
@@ -1517,16 +1517,16 @@ const Be = (t) => {
|
|
|
1517
1517
|
onBeforeNodeDrag: o,
|
|
1518
1518
|
onNodeDragFinished: r
|
|
1519
1519
|
};
|
|
1520
|
-
},
|
|
1520
|
+
}, Ce = (t, e, o) => {
|
|
1521
1521
|
const { x: r, y: s, width: h, height: n } = t.getBoundingClientRect();
|
|
1522
1522
|
return e >= r && e <= r + h && o >= s && o <= s + n;
|
|
1523
|
-
}, $e = (t, e, o) => e >= 0 && e <= t.innerWidth && o >= 0 && o <= t.innerHeight,
|
|
1523
|
+
}, $e = (t, e, o) => e >= 0 && e <= t.innerWidth && o >= 0 && o <= t.innerHeight, L = (t, e, o, r) => Ce(e, o, r) && $e(t, o, r), C = (t, e) => {
|
|
1524
1524
|
e !== null ? t.style.cursor = e : t.style.removeProperty("cursor");
|
|
1525
|
-
},
|
|
1525
|
+
}, V = (t, e) => ({
|
|
1526
1526
|
x: t.scale * e.x + t.x,
|
|
1527
1527
|
y: t.scale * e.y + t.y
|
|
1528
1528
|
});
|
|
1529
|
-
class
|
|
1529
|
+
class J {
|
|
1530
1530
|
constructor(e, o, r, s) {
|
|
1531
1531
|
i(this, "grabbedNodeId", null);
|
|
1532
1532
|
i(this, "maxNodePriority", 0);
|
|
@@ -1554,15 +1554,15 @@ class K {
|
|
|
1554
1554
|
}), this.nodeIds.clear(), this.maxNodePriority = 0;
|
|
1555
1555
|
});
|
|
1556
1556
|
i(this, "onMouseDown", (e) => {
|
|
1557
|
-
if (!this.
|
|
1557
|
+
if (!this.config.mouseDownEventVerifier(e))
|
|
1558
1558
|
return;
|
|
1559
1559
|
const o = e.currentTarget, r = this.nodeIds.get(o), s = this.graph.getNode(r);
|
|
1560
|
-
this.
|
|
1560
|
+
this.config.onBeforeNodeDrag({
|
|
1561
1561
|
nodeId: r,
|
|
1562
1562
|
element: s.element,
|
|
1563
1563
|
x: s.x,
|
|
1564
1564
|
y: s.y
|
|
1565
|
-
}) && (e.stopImmediatePropagation(), this.grabbedNodeId = r,
|
|
1565
|
+
}) && (e.stopImmediatePropagation(), this.grabbedNodeId = r, C(this.element, this.config.dragCursor), this.moveNodeOnTop(r), this.window.addEventListener("mouseup", this.onWindowMouseUp), this.window.addEventListener("mousemove", this.onWindowMouseMove));
|
|
1566
1566
|
});
|
|
1567
1567
|
i(this, "onTouchStart", (e) => {
|
|
1568
1568
|
if (e.touches.length !== 1)
|
|
@@ -1572,7 +1572,7 @@ class K {
|
|
|
1572
1572
|
y: e.touches[0].clientY
|
|
1573
1573
|
};
|
|
1574
1574
|
const o = e.currentTarget, r = this.nodeIds.get(o), s = this.graph.getNode(r);
|
|
1575
|
-
this.
|
|
1575
|
+
this.config.onBeforeNodeDrag({
|
|
1576
1576
|
nodeId: r,
|
|
1577
1577
|
element: s.element,
|
|
1578
1578
|
x: s.x,
|
|
@@ -1580,7 +1580,7 @@ class K {
|
|
|
1580
1580
|
}) && (this.grabbedNodeId = r, this.moveNodeOnTop(r), this.window.addEventListener("touchmove", this.onWindowTouchMove), this.window.addEventListener("touchend", this.onWindowTouchFinish), this.window.addEventListener("touchcancel", this.onWindowTouchFinish));
|
|
1581
1581
|
});
|
|
1582
1582
|
i(this, "onWindowMouseMove", (e) => {
|
|
1583
|
-
if (!
|
|
1583
|
+
if (!L(
|
|
1584
1584
|
this.window,
|
|
1585
1585
|
this.element,
|
|
1586
1586
|
e.clientX,
|
|
@@ -1592,13 +1592,13 @@ class K {
|
|
|
1592
1592
|
this.grabbedNodeId !== null && this.dragNode(this.grabbedNodeId, e.movementX, e.movementY);
|
|
1593
1593
|
});
|
|
1594
1594
|
i(this, "onWindowMouseUp", (e) => {
|
|
1595
|
-
this.
|
|
1595
|
+
this.config.mouseUpEventVerifier(e) && this.cancelMouseDrag();
|
|
1596
1596
|
});
|
|
1597
1597
|
i(this, "onWindowTouchMove", (e) => {
|
|
1598
1598
|
if (e.touches.length !== 1)
|
|
1599
1599
|
return;
|
|
1600
1600
|
const o = e.touches[0];
|
|
1601
|
-
if (!
|
|
1601
|
+
if (!L(
|
|
1602
1602
|
this.window,
|
|
1603
1603
|
this.element,
|
|
1604
1604
|
o.clientX,
|
|
@@ -1618,24 +1618,24 @@ class K {
|
|
|
1618
1618
|
i(this, "onWindowTouchFinish", () => {
|
|
1619
1619
|
this.previousTouchCoordinates = null, this.cancelTouchDrag();
|
|
1620
1620
|
});
|
|
1621
|
-
i(this, "
|
|
1622
|
-
this.canvas = e, this.element = o, this.window = r, this.
|
|
1621
|
+
i(this, "config");
|
|
1622
|
+
this.canvas = e, this.element = o, this.window = r, this.config = Ue(s), this.graph = e.graph, this.graph.onAfterNodeAdded.subscribe(this.onAfterNodeAdded), this.graph.onAfterNodeUpdated.subscribe(this.onAfterNodeUpdated), this.graph.onBeforeNodeRemoved.subscribe(this.onBeforeNodeRemoved), this.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1623
1623
|
}
|
|
1624
1624
|
static configure(e, o, r, s) {
|
|
1625
|
-
new
|
|
1625
|
+
new J(e, o, r, s);
|
|
1626
1626
|
}
|
|
1627
1627
|
dragNode(e, o, r) {
|
|
1628
1628
|
const s = this.graph.getNode(e);
|
|
1629
1629
|
if (s === null)
|
|
1630
1630
|
return;
|
|
1631
|
-
const h = this.canvas.viewport.getContentMatrix(), n =
|
|
1631
|
+
const h = this.canvas.viewport.getContentMatrix(), n = V(h, {
|
|
1632
1632
|
x: s.x,
|
|
1633
1633
|
y: s.y
|
|
1634
|
-
}), d =
|
|
1634
|
+
}), d = V(
|
|
1635
1635
|
{ scale: 1, x: o, y: r },
|
|
1636
1636
|
n
|
|
1637
|
-
), c = this.canvas.viewport.getViewportMatrix(), a =
|
|
1638
|
-
this.canvas.updateNode(e, { x: a.x, y: a.y }), this.
|
|
1637
|
+
), c = this.canvas.viewport.getViewportMatrix(), a = V(c, d);
|
|
1638
|
+
this.canvas.updateNode(e, { x: a.x, y: a.y }), this.config.onNodeDrag({
|
|
1639
1639
|
nodeId: e,
|
|
1640
1640
|
element: s.element,
|
|
1641
1641
|
x: a.x,
|
|
@@ -1643,7 +1643,7 @@ class K {
|
|
|
1643
1643
|
});
|
|
1644
1644
|
}
|
|
1645
1645
|
moveNodeOnTop(e) {
|
|
1646
|
-
if (this.
|
|
1646
|
+
if (this.config.freezePriority)
|
|
1647
1647
|
return;
|
|
1648
1648
|
this.maxNodePriority += 2, this.canvas.updateNode(e, { priority: this.maxNodePriority });
|
|
1649
1649
|
const o = this.maxNodePriority - 1;
|
|
@@ -1653,12 +1653,12 @@ class K {
|
|
|
1653
1653
|
}
|
|
1654
1654
|
cancelMouseDrag() {
|
|
1655
1655
|
const e = this.graph.getNode(this.grabbedNodeId);
|
|
1656
|
-
e !== null && this.
|
|
1656
|
+
e !== null && this.config.onNodeDragFinished({
|
|
1657
1657
|
nodeId: this.grabbedNodeId,
|
|
1658
1658
|
element: e.element,
|
|
1659
1659
|
x: e.x,
|
|
1660
1660
|
y: e.y
|
|
1661
|
-
}), this.grabbedNodeId = null,
|
|
1661
|
+
}), this.grabbedNodeId = null, C(this.element, null), this.removeMouseDragListeners();
|
|
1662
1662
|
}
|
|
1663
1663
|
removeMouseDragListeners() {
|
|
1664
1664
|
this.window.removeEventListener("mouseup", this.onWindowMouseUp), this.window.removeEventListener("mousemove", this.onWindowMouseMove);
|
|
@@ -1666,7 +1666,7 @@ class K {
|
|
|
1666
1666
|
cancelTouchDrag() {
|
|
1667
1667
|
this.previousTouchCoordinates = null;
|
|
1668
1668
|
const e = this.graph.getNode(this.grabbedNodeId);
|
|
1669
|
-
e !== null && this.
|
|
1669
|
+
e !== null && this.config.onNodeDragFinished({
|
|
1670
1670
|
nodeId: this.grabbedNodeId,
|
|
1671
1671
|
element: e.element,
|
|
1672
1672
|
x: e.x,
|
|
@@ -1738,7 +1738,7 @@ const We = (t) => {
|
|
|
1738
1738
|
});
|
|
1739
1739
|
}
|
|
1740
1740
|
}, ke = (t) => {
|
|
1741
|
-
var f,
|
|
1741
|
+
var f, A, x, b, D, m, R, I, _, q, ee, te;
|
|
1742
1742
|
const e = (f = t == null ? void 0 : t.scale) == null ? void 0 : f.mouseWheelSensitivity, o = e !== void 0 ? e : 1.2, r = t == null ? void 0 : t.transformPreprocessor;
|
|
1743
1743
|
let s;
|
|
1744
1744
|
r !== void 0 ? Array.isArray(r) ? s = ze(
|
|
@@ -1746,14 +1746,14 @@ const We = (t) => {
|
|
|
1746
1746
|
(M) => se(M)
|
|
1747
1747
|
)
|
|
1748
1748
|
) : s = se(r) : s = (M) => M.nextTransform;
|
|
1749
|
-
const h = ((
|
|
1749
|
+
const h = ((A = t == null ? void 0 : t.shift) == null ? void 0 : A.cursor) !== void 0 ? t.shift.cursor : "grab", n = ((x = t == null ? void 0 : t.events) == null ? void 0 : x.onBeforeTransformChange) ?? (() => {
|
|
1750
1750
|
}), d = ((b = t == null ? void 0 : t.events) == null ? void 0 : b.onTransformChange) ?? (() => {
|
|
1751
|
-
}), c = (D = t == null ? void 0 : t.shift) == null ? void 0 : D.mouseDownEventVerifier, a = c !== void 0 ? c : (M) => M.button === 0, l = (m = t == null ? void 0 : t.shift) == null ? void 0 : m.mouseUpEventVerifier, g = l !== void 0 ? l : (M) => M.button === 0, y = (
|
|
1751
|
+
}), c = (D = t == null ? void 0 : t.shift) == null ? void 0 : D.mouseDownEventVerifier, a = c !== void 0 ? c : (M) => M.button === 0, l = (m = t == null ? void 0 : t.shift) == null ? void 0 : m.mouseUpEventVerifier, g = l !== void 0 ? l : (M) => M.button === 0, y = (R = t == null ? void 0 : t.scale) == null ? void 0 : R.mouseWheelEventVerifier, v = y !== void 0 ? y : () => !0;
|
|
1752
1752
|
return {
|
|
1753
1753
|
wheelSensitivity: o,
|
|
1754
|
-
onTransformStarted: ((
|
|
1754
|
+
onTransformStarted: ((I = t == null ? void 0 : t.events) == null ? void 0 : I.onTransformStarted) ?? (() => {
|
|
1755
1755
|
}),
|
|
1756
|
-
onTransformFinished: ((
|
|
1756
|
+
onTransformFinished: ((_ = t == null ? void 0 : t.events) == null ? void 0 : _.onTransformFinished) ?? (() => {
|
|
1757
1757
|
}),
|
|
1758
1758
|
onBeforeTransformChange: n,
|
|
1759
1759
|
onTransformChange: d,
|
|
@@ -1762,7 +1762,7 @@ const We = (t) => {
|
|
|
1762
1762
|
mouseDownEventVerifier: a,
|
|
1763
1763
|
mouseUpEventVerifier: g,
|
|
1764
1764
|
mouseWheelEventVerifier: v,
|
|
1765
|
-
scaleWheelFinishTimeout: ((
|
|
1765
|
+
scaleWheelFinishTimeout: ((q = t == null ? void 0 : t.scale) == null ? void 0 : q.wheelFinishTimeout) ?? 500,
|
|
1766
1766
|
onResizeTransformStarted: ((ee = t == null ? void 0 : t.events) == null ? void 0 : ee.onResizeTransformStarted) ?? (() => {
|
|
1767
1767
|
}),
|
|
1768
1768
|
onResizeTransformFinished: ((te = t == null ? void 0 : t.events) == null ? void 0 : te.onResizeTransformFinished) ?? (() => {
|
|
@@ -1772,11 +1772,11 @@ const We = (t) => {
|
|
|
1772
1772
|
scale: t.scale,
|
|
1773
1773
|
x: t.x + t.scale * e,
|
|
1774
1774
|
y: t.y + t.scale * o
|
|
1775
|
-
}),
|
|
1775
|
+
}), Oe = (t, e, o, r) => ({
|
|
1776
1776
|
scale: t.scale * e,
|
|
1777
1777
|
x: t.scale * (1 - e) * o + t.x,
|
|
1778
1778
|
y: t.scale * (1 - e) * r + t.y
|
|
1779
|
-
}),
|
|
1779
|
+
}), U = (t) => {
|
|
1780
1780
|
const e = [], o = t.touches.length;
|
|
1781
1781
|
for (let d = 0; d < o; d++)
|
|
1782
1782
|
e.push([t.touches[d].clientX, t.touches[d].clientY]);
|
|
@@ -1805,10 +1805,10 @@ class k {
|
|
|
1805
1805
|
this.removeMouseDragListeners(), this.removeTouchDragListeners(), this.observer.unobserve(this.element), this.element.removeEventListener("mousedown", this.onMouseDown), this.element.removeEventListener("wheel", this.onWheelScroll), this.element.removeEventListener("touchstart", this.onTouchStart), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
1806
1806
|
});
|
|
1807
1807
|
i(this, "onMouseDown", (e) => {
|
|
1808
|
-
this.element === null || !this.
|
|
1808
|
+
this.element === null || !this.config.mouseDownEventVerifier(e) || (C(this.element, this.config.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove), this.window.addEventListener("mouseup", this.onWindowMouseUp), this.startRegisteredTransform());
|
|
1809
1809
|
});
|
|
1810
1810
|
i(this, "onWindowMouseMove", (e) => {
|
|
1811
|
-
const o =
|
|
1811
|
+
const o = L(
|
|
1812
1812
|
this.window,
|
|
1813
1813
|
this.element,
|
|
1814
1814
|
e.clientX,
|
|
@@ -1822,28 +1822,28 @@ class k {
|
|
|
1822
1822
|
this.moveViewport(r, s);
|
|
1823
1823
|
});
|
|
1824
1824
|
i(this, "onWindowMouseUp", (e) => {
|
|
1825
|
-
this.element === null || !this.
|
|
1825
|
+
this.element === null || !this.config.mouseUpEventVerifier(e) || this.stopMouseDrag();
|
|
1826
1826
|
});
|
|
1827
1827
|
i(this, "onWheelScroll", (e) => {
|
|
1828
|
-
if (!this.
|
|
1828
|
+
if (!this.config.mouseWheelEventVerifier(e))
|
|
1829
1829
|
return;
|
|
1830
1830
|
e.preventDefault();
|
|
1831
|
-
const { left: o, top: r } = this.element.getBoundingClientRect(), s = e.clientX - o, h = e.clientY - r, d = 1 / (e.deltaY < 0 ? this.
|
|
1832
|
-
this.wheelFinishTimer === null && this.
|
|
1833
|
-
this.transformInProgress || this.
|
|
1834
|
-
}, this.
|
|
1831
|
+
const { left: o, top: r } = this.element.getBoundingClientRect(), s = e.clientX - o, h = e.clientY - r, d = 1 / (e.deltaY < 0 ? this.config.wheelSensitivity : 1 / this.config.wheelSensitivity);
|
|
1832
|
+
this.wheelFinishTimer === null && this.config.onTransformStarted(), this.scaleViewport(d, s, h), this.wheelFinishTimer !== null && clearTimeout(this.wheelFinishTimer), this.wheelFinishTimer = setTimeout(() => {
|
|
1833
|
+
this.transformInProgress || this.config.onTransformFinished(), this.wheelFinishTimer = null;
|
|
1834
|
+
}, this.config.scaleWheelFinishTimeout);
|
|
1835
1835
|
});
|
|
1836
1836
|
i(this, "onTouchStart", (e) => {
|
|
1837
1837
|
if (this.prevTouches !== null) {
|
|
1838
|
-
this.prevTouches =
|
|
1838
|
+
this.prevTouches = U(e);
|
|
1839
1839
|
return;
|
|
1840
1840
|
}
|
|
1841
|
-
this.prevTouches =
|
|
1841
|
+
this.prevTouches = U(e), this.window.addEventListener("touchmove", this.onWindowTouchMove), this.window.addEventListener("touchend", this.onWindowTouchFinish), this.window.addEventListener("touchcancel", this.onWindowTouchFinish), this.startRegisteredTransform();
|
|
1842
1842
|
});
|
|
1843
1843
|
i(this, "onWindowTouchMove", (e) => {
|
|
1844
|
-
const o =
|
|
1844
|
+
const o = U(e);
|
|
1845
1845
|
if (!o.touches.every(
|
|
1846
|
-
(s) =>
|
|
1846
|
+
(s) => L(this.window, this.element, s[0], s[1])
|
|
1847
1847
|
)) {
|
|
1848
1848
|
this.stopTouchDrag();
|
|
1849
1849
|
return;
|
|
@@ -1858,19 +1858,19 @@ class k {
|
|
|
1858
1858
|
this.prevTouches = o;
|
|
1859
1859
|
});
|
|
1860
1860
|
i(this, "onWindowTouchFinish", (e) => {
|
|
1861
|
-
e.touches.length > 0 ? this.prevTouches =
|
|
1861
|
+
e.touches.length > 0 ? this.prevTouches = U(e) : this.stopTouchDrag();
|
|
1862
1862
|
});
|
|
1863
1863
|
i(this, "observer", new ResizeObserver(() => {
|
|
1864
|
-
const e = this.viewport.getViewportMatrix(), { width: o, height: r } = this.element.getBoundingClientRect(), s = this.
|
|
1864
|
+
const e = this.viewport.getViewportMatrix(), { width: o, height: r } = this.element.getBoundingClientRect(), s = this.config.transformPreprocessor({
|
|
1865
1865
|
prevTransform: e,
|
|
1866
1866
|
nextTransform: e,
|
|
1867
1867
|
canvasWidth: o,
|
|
1868
1868
|
canvasHeight: r
|
|
1869
1869
|
});
|
|
1870
|
-
this.
|
|
1870
|
+
this.config.onResizeTransformStarted(), this.canvas.patchViewportMatrix(s), this.config.onResizeTransformFinished();
|
|
1871
1871
|
}));
|
|
1872
|
-
i(this, "
|
|
1873
|
-
this.canvas = e, this.element = o, this.window = r, this.
|
|
1872
|
+
i(this, "config");
|
|
1873
|
+
this.canvas = e, this.element = o, this.window = r, this.config = ke(s), this.viewport = e.viewport, this.observer.observe(this.element), this.element.addEventListener("mousedown", this.onMouseDown), this.element.addEventListener("wheel", this.onWheelScroll), this.element.addEventListener("touchstart", this.onTouchStart), e.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1874
1874
|
}
|
|
1875
1875
|
static configure(e, o, r, s) {
|
|
1876
1876
|
new k(
|
|
@@ -1881,7 +1881,7 @@ class k {
|
|
|
1881
1881
|
);
|
|
1882
1882
|
}
|
|
1883
1883
|
moveViewport(e, o) {
|
|
1884
|
-
const r = this.viewport.getViewportMatrix(), s = Ye(r, e, o), { width: h, height: n } = this.element.getBoundingClientRect(), d = this.
|
|
1884
|
+
const r = this.viewport.getViewportMatrix(), s = Ye(r, e, o), { width: h, height: n } = this.element.getBoundingClientRect(), d = this.config.transformPreprocessor({
|
|
1885
1885
|
prevTransform: r,
|
|
1886
1886
|
nextTransform: s,
|
|
1887
1887
|
canvasWidth: h,
|
|
@@ -1890,7 +1890,7 @@ class k {
|
|
|
1890
1890
|
this.performTransform(d);
|
|
1891
1891
|
}
|
|
1892
1892
|
scaleViewport(e, o, r) {
|
|
1893
|
-
const s = this.canvas.viewport.getViewportMatrix(), h =
|
|
1893
|
+
const s = this.canvas.viewport.getViewportMatrix(), h = Oe(s, e, o, r), { width: n, height: d } = this.element.getBoundingClientRect(), c = this.config.transformPreprocessor({
|
|
1894
1894
|
prevTransform: s,
|
|
1895
1895
|
nextTransform: h,
|
|
1896
1896
|
canvasWidth: n,
|
|
@@ -1899,7 +1899,7 @@ class k {
|
|
|
1899
1899
|
this.performTransform(c);
|
|
1900
1900
|
}
|
|
1901
1901
|
stopMouseDrag() {
|
|
1902
|
-
|
|
1902
|
+
C(this.element, null), this.removeMouseDragListeners(), this.finishRegisteredTransform();
|
|
1903
1903
|
}
|
|
1904
1904
|
removeMouseDragListeners() {
|
|
1905
1905
|
this.window.removeEventListener("mousemove", this.onWindowMouseMove), this.window.removeEventListener("mouseup", this.onWindowMouseUp);
|
|
@@ -1911,16 +1911,16 @@ class k {
|
|
|
1911
1911
|
this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
|
|
1912
1912
|
}
|
|
1913
1913
|
performTransform(e) {
|
|
1914
|
-
this.
|
|
1914
|
+
this.config.onBeforeTransformChange(), this.canvas.patchViewportMatrix(e), this.config.onTransformChange();
|
|
1915
1915
|
}
|
|
1916
1916
|
startRegisteredTransform() {
|
|
1917
|
-
this.transformInProgress = !0, this.
|
|
1917
|
+
this.transformInProgress = !0, this.config.onTransformStarted();
|
|
1918
1918
|
}
|
|
1919
1919
|
finishRegisteredTransform() {
|
|
1920
|
-
this.transformInProgress = !1, this.
|
|
1920
|
+
this.transformInProgress = !1, this.config.onTransformFinished();
|
|
1921
1921
|
}
|
|
1922
1922
|
}
|
|
1923
|
-
class
|
|
1923
|
+
class K {
|
|
1924
1924
|
constructor(e, o, r, s, h, n) {
|
|
1925
1925
|
i(this, "canvasResizeObserver");
|
|
1926
1926
|
i(this, "nodeHorizontal");
|
|
@@ -1952,15 +1952,15 @@ class Q {
|
|
|
1952
1952
|
this.userTransformInProgress || (this.viewportMatrix = this.viewport.getViewportMatrix(), this.loadAreaAroundViewport());
|
|
1953
1953
|
});
|
|
1954
1954
|
i(this, "userTransformInProgress", !1);
|
|
1955
|
-
var v, f,
|
|
1955
|
+
var v, f, A, x, b;
|
|
1956
1956
|
this.canvas = e, this.element = o, this.window = r, this.trigger = h, this.virtualScrollOptions = n, this.nodeHorizontal = this.virtualScrollOptions.nodeContainingRadius.horizontal, this.nodeVertical = this.virtualScrollOptions.nodeContainingRadius.vertical, this.canvasResizeObserver = new ResizeObserver((D) => {
|
|
1957
1957
|
const m = D[0];
|
|
1958
1958
|
this.viewportWidth = m.contentRect.width, this.viewportHeight = m.contentRect.height, this.scheduleLoadAreaAroundViewport();
|
|
1959
1959
|
}), this.viewport = e.viewport;
|
|
1960
1960
|
const d = ((v = s == null ? void 0 : s.events) == null ? void 0 : v.onResizeTransformStarted) ?? (() => {
|
|
1961
1961
|
}), c = ((f = s == null ? void 0 : s.events) == null ? void 0 : f.onResizeTransformFinished) ?? (() => {
|
|
1962
|
-
}), a = ((
|
|
1963
|
-
}), l = ((
|
|
1962
|
+
}), a = ((A = s == null ? void 0 : s.events) == null ? void 0 : A.onTransformChange) ?? (() => {
|
|
1963
|
+
}), l = ((x = s == null ? void 0 : s.events) == null ? void 0 : x.onBeforeTransformChange) ?? (() => {
|
|
1964
1964
|
}), g = ((b = s == null ? void 0 : s.events) == null ? void 0 : b.onTransformFinished) ?? (() => {
|
|
1965
1965
|
}), y = {
|
|
1966
1966
|
...s,
|
|
@@ -1993,7 +1993,7 @@ class Q {
|
|
|
1993
1993
|
), this.viewportMatrix = this.viewport.getViewportMatrix(), this.trigger.subscribe(this.updateLoadedArea), this.canvasResizeObserver.observe(this.element), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
1994
1994
|
}
|
|
1995
1995
|
static configure(e, o, r, s, h, n) {
|
|
1996
|
-
new
|
|
1996
|
+
new K(
|
|
1997
1997
|
e,
|
|
1998
1998
|
o,
|
|
1999
1999
|
r,
|
|
@@ -2016,29 +2016,29 @@ class Q {
|
|
|
2016
2016
|
this.trigger.emit({ x: r, y: s, width: h, height: n });
|
|
2017
2017
|
}
|
|
2018
2018
|
}
|
|
2019
|
-
const
|
|
2019
|
+
const Xe = () => {
|
|
2020
2020
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
2021
2021
|
return t.style.position = "absolute", t.style.inset = "0", t;
|
|
2022
|
-
},
|
|
2022
|
+
}, He = () => {
|
|
2023
2023
|
const t = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
2024
2024
|
return t.setAttribute("fill", "url(#pattern)"), t;
|
|
2025
|
-
},
|
|
2025
|
+
}, je = () => {
|
|
2026
2026
|
const t = document.createElementNS(
|
|
2027
2027
|
"http://www.w3.org/2000/svg",
|
|
2028
2028
|
"pattern"
|
|
2029
2029
|
);
|
|
2030
2030
|
return t.setAttribute("id", "pattern"), t;
|
|
2031
|
-
},
|
|
2031
|
+
}, Ge = (t, e) => {
|
|
2032
2032
|
const o = document.createElementNS(
|
|
2033
2033
|
"http://www.w3.org/2000/svg",
|
|
2034
2034
|
"circle"
|
|
2035
2035
|
);
|
|
2036
2036
|
return o.setAttribute("cx", "0"), o.setAttribute("cy", "0"), o.setAttribute("r", `${t}`), o.setAttribute("fill", `${e}`), o;
|
|
2037
|
-
},
|
|
2037
|
+
}, Je = (t) => t instanceof SVGElement ? t : Ge(
|
|
2038
2038
|
(t == null ? void 0 : t.radius) ?? 1.5,
|
|
2039
2039
|
(t == null ? void 0 : t.color) ?? "#d8d8d8"
|
|
2040
|
-
),
|
|
2041
|
-
const e = t.tileDimensions, o = (e == null ? void 0 : e.width) ?? 25, r = (e == null ? void 0 : e.height) ?? 25, s =
|
|
2040
|
+
), Ke = (t) => {
|
|
2041
|
+
const e = t.tileDimensions, o = (e == null ? void 0 : e.width) ?? 25, r = (e == null ? void 0 : e.height) ?? 25, s = Je(t.renderer ?? {});
|
|
2042
2042
|
return {
|
|
2043
2043
|
tileWidth: o,
|
|
2044
2044
|
tileHeight: r,
|
|
@@ -2046,11 +2046,11 @@ const He = () => {
|
|
|
2046
2046
|
maxViewportScale: t.maxViewportScale ?? 10
|
|
2047
2047
|
};
|
|
2048
2048
|
};
|
|
2049
|
-
class
|
|
2049
|
+
class Q {
|
|
2050
2050
|
constructor(e, o, r) {
|
|
2051
|
-
i(this, "svg",
|
|
2052
|
-
i(this, "patternRenderingRectangle",
|
|
2053
|
-
i(this, "pattern",
|
|
2051
|
+
i(this, "svg", Xe());
|
|
2052
|
+
i(this, "patternRenderingRectangle", He());
|
|
2053
|
+
i(this, "pattern", je());
|
|
2054
2054
|
i(this, "patternContent");
|
|
2055
2055
|
i(this, "tileWidth");
|
|
2056
2056
|
i(this, "tileHeight");
|
|
@@ -2074,7 +2074,7 @@ class Z {
|
|
|
2074
2074
|
), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
2075
2075
|
});
|
|
2076
2076
|
this.canvas = e, this.host = r;
|
|
2077
|
-
const s =
|
|
2077
|
+
const s = Ke(o);
|
|
2078
2078
|
this.tileWidth = s.tileWidth, this.tileHeight = s.tileHeight, this.halfTileWidth = this.tileWidth / 2, this.halfTileHeight = this.tileHeight / 2, this.patternContent = s.renderer, this.maxViewportScale = s.maxViewportScale;
|
|
2079
2079
|
const h = `translate(${this.halfTileWidth}, ${this.halfTileHeight})`;
|
|
2080
2080
|
this.patternContent.setAttribute("transform", h), this.pattern.appendChild(this.patternContent);
|
|
@@ -2082,26 +2082,26 @@ class Z {
|
|
|
2082
2082
|
n.appendChild(this.pattern), this.svg.appendChild(n), this.svg.appendChild(this.patternRenderingRectangle), this.resizeObserver.observe(this.host), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterTransformUpdated), this.onAfterTransformUpdated(), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2083
2083
|
}
|
|
2084
2084
|
static configure(e, o, r) {
|
|
2085
|
-
new
|
|
2085
|
+
new Q(e, o, r);
|
|
2086
2086
|
}
|
|
2087
2087
|
updateVisibility() {
|
|
2088
2088
|
const o = this.canvas.viewport.getViewportMatrix().scale > this.maxViewportScale;
|
|
2089
2089
|
o && this.visible ? (this.visible = !1, this.host.removeChild(this.svg)) : !o && !this.visible && (this.visible = !0, this.host.appendChild(this.svg));
|
|
2090
2090
|
}
|
|
2091
2091
|
}
|
|
2092
|
-
const
|
|
2092
|
+
const Qe = () => "direct", Ze = (t) => t, _e = (t) => t.button === 0, qe = () => {
|
|
2093
2093
|
}, et = (t) => {
|
|
2094
2094
|
var e;
|
|
2095
2095
|
return {
|
|
2096
|
-
connectionTypeResolver: t.connectionTypeResolver ??
|
|
2097
|
-
connectionPreprocessor: t.connectionPreprocessor ??
|
|
2098
|
-
mouseDownEventVerifier: t.mouseDownEventVerifier ??
|
|
2099
|
-
onAfterEdgeCreated: ((e = t.events) == null ? void 0 : e.onAfterEdgeCreated) ??
|
|
2096
|
+
connectionTypeResolver: t.connectionTypeResolver ?? Qe,
|
|
2097
|
+
connectionPreprocessor: t.connectionPreprocessor ?? Ze,
|
|
2098
|
+
mouseDownEventVerifier: t.mouseDownEventVerifier ?? _e,
|
|
2099
|
+
onAfterEdgeCreated: ((e = t.events) == null ? void 0 : e.onAfterEdgeCreated) ?? qe
|
|
2100
2100
|
};
|
|
2101
2101
|
};
|
|
2102
|
-
class
|
|
2102
|
+
class Z {
|
|
2103
2103
|
constructor(e, o, r, s, h, n) {
|
|
2104
|
-
i(this, "
|
|
2104
|
+
i(this, "config");
|
|
2105
2105
|
i(this, "overlayCanvas");
|
|
2106
2106
|
i(this, "ports", /* @__PURE__ */ new Map());
|
|
2107
2107
|
i(this, "staticOverlayPortId", "static");
|
|
@@ -2118,10 +2118,10 @@ class _ {
|
|
|
2118
2118
|
});
|
|
2119
2119
|
i(this, "onPortMouseDown", (e) => {
|
|
2120
2120
|
const o = e.currentTarget;
|
|
2121
|
-
this.
|
|
2121
|
+
this.config.mouseDownEventVerifier(e) && this.isPortConnectionAllowed(o) && (e.stopPropagation(), this.grabPort(o, { x: e.clientX, y: e.clientY }), this.window.addEventListener("mousemove", this.onWindowMouseMove), this.window.addEventListener("mouseup", this.onWindowMouseUp));
|
|
2122
2122
|
});
|
|
2123
2123
|
i(this, "onWindowMouseMove", (e) => {
|
|
2124
|
-
if (!
|
|
2124
|
+
if (!L(
|
|
2125
2125
|
this.window,
|
|
2126
2126
|
this.overlayLayer,
|
|
2127
2127
|
e.clientX,
|
|
@@ -2145,7 +2145,7 @@ class _ {
|
|
|
2145
2145
|
});
|
|
2146
2146
|
i(this, "onWindowTouchMove", (e) => {
|
|
2147
2147
|
const o = e.touches[0];
|
|
2148
|
-
if (!
|
|
2148
|
+
if (!L(
|
|
2149
2149
|
this.window,
|
|
2150
2150
|
this.overlayLayer,
|
|
2151
2151
|
o.clientX,
|
|
@@ -2171,9 +2171,9 @@ class _ {
|
|
|
2171
2171
|
), this.canvas.graph.onBeforeClear.unsubscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.unsubscribe(this.onBeforeDestroy);
|
|
2172
2172
|
});
|
|
2173
2173
|
i(this, "onEdgeCreated", (e) => {
|
|
2174
|
-
this.
|
|
2174
|
+
this.config.onAfterEdgeCreated(e);
|
|
2175
2175
|
});
|
|
2176
|
-
this.canvas = e, this.overlayLayer = o, this.viewportStore = r, this.window = s, this.
|
|
2176
|
+
this.canvas = e, this.overlayLayer = o, this.viewportStore = r, this.window = s, this.config = et(n);
|
|
2177
2177
|
const d = new ce(), c = new ne(
|
|
2178
2178
|
d,
|
|
2179
2179
|
this.viewportStore,
|
|
@@ -2188,7 +2188,7 @@ class _ {
|
|
|
2188
2188
|
), this.canvas.graph.onAfterPortMarked.subscribe(this.onAfterPortMarked), this.canvas.graph.onBeforePortUnmarked.subscribe(this.onBeforePortUnmarked), this.canvas.graph.onBeforeClear.subscribe(this.onBeforeClear), this.canvas.onBeforeDestroy.subscribe(this.onBeforeDestroy);
|
|
2189
2189
|
}
|
|
2190
2190
|
static configure(e, o, r, s, h, n) {
|
|
2191
|
-
new
|
|
2191
|
+
new Z(
|
|
2192
2192
|
e,
|
|
2193
2193
|
o,
|
|
2194
2194
|
r,
|
|
@@ -2200,10 +2200,10 @@ class _ {
|
|
|
2200
2200
|
grabPort(e, o) {
|
|
2201
2201
|
const r = this.ports.get(e), s = this.canvas.graph.getPort(r);
|
|
2202
2202
|
this.staticPortId = r;
|
|
2203
|
-
const h = this.
|
|
2203
|
+
const h = this.config.connectionTypeResolver(this.staticPortId), n = e.getBoundingClientRect(), d = n.x + n.width / 2, c = n.y + n.height / 2, a = this.overlayLayer.getBoundingClientRect(), l = this.canvas.viewport.getViewportMatrix(), g = V(l, {
|
|
2204
2204
|
x: d - a.x,
|
|
2205
2205
|
y: c - a.y
|
|
2206
|
-
}), y =
|
|
2206
|
+
}), y = V(l, {
|
|
2207
2207
|
x: o.x - a.x,
|
|
2208
2208
|
y: o.y - a.y
|
|
2209
2209
|
}), v = {
|
|
@@ -2216,8 +2216,8 @@ class _ {
|
|
|
2216
2216
|
portDirection: void 0
|
|
2217
2217
|
};
|
|
2218
2218
|
this.isDirect = h === "direct";
|
|
2219
|
-
const
|
|
2220
|
-
this.createOverlayGraph(
|
|
2219
|
+
const A = this.isDirect ? v : f, x = this.isDirect ? f : v;
|
|
2220
|
+
this.createOverlayGraph(A, x);
|
|
2221
2221
|
}
|
|
2222
2222
|
hookPortEvents(e) {
|
|
2223
2223
|
e.addEventListener("mousedown", this.onPortMouseDown), e.addEventListener("touchstart", this.onPortTouchStart);
|
|
@@ -2263,14 +2263,14 @@ class _ {
|
|
|
2263
2263
|
const o = this.findPortAtPoint(e);
|
|
2264
2264
|
if (o === null)
|
|
2265
2265
|
return;
|
|
2266
|
-
const r = this.isDirect ? this.staticPortId : o, s = this.isDirect ? o : this.staticPortId, h = { from: r, to: s }, n = this.
|
|
2266
|
+
const r = this.isDirect ? this.staticPortId : o, s = this.isDirect ? o : this.staticPortId, h = { from: r, to: s }, n = this.config.connectionPreprocessor(h);
|
|
2267
2267
|
n !== null && (this.canvas.graph.onAfterEdgeAdded.subscribe(this.onEdgeCreated), this.canvas.addEdge(n), this.canvas.graph.onAfterEdgeAdded.unsubscribe(this.onEdgeCreated));
|
|
2268
2268
|
}
|
|
2269
2269
|
moveDraggingNode(e) {
|
|
2270
2270
|
const o = this.overlayLayer.getBoundingClientRect(), r = {
|
|
2271
2271
|
x: e.x - o.x,
|
|
2272
2272
|
y: e.y - o.y
|
|
2273
|
-
}, s = this.canvas.viewport.getViewportMatrix(), h =
|
|
2273
|
+
}, s = this.canvas.viewport.getViewportMatrix(), h = V(s, r);
|
|
2274
2274
|
this.overlayCanvas.updateNode(this.draggingOverlayPortId, {
|
|
2275
2275
|
x: h.x,
|
|
2276
2276
|
y: h.y
|
|
@@ -2293,21 +2293,21 @@ class _ {
|
|
|
2293
2293
|
}
|
|
2294
2294
|
isPortConnectionAllowed(e) {
|
|
2295
2295
|
const o = this.ports.get(e);
|
|
2296
|
-
return this.
|
|
2296
|
+
return this.config.connectionTypeResolver(o) !== null;
|
|
2297
2297
|
}
|
|
2298
2298
|
}
|
|
2299
2299
|
const tt = () => {
|
|
2300
2300
|
const t = document.createElement("div");
|
|
2301
2301
|
return t.style.width = "100%", t.style.height = "100%", t.style.position = "relative", t;
|
|
2302
|
-
},
|
|
2302
|
+
}, O = () => {
|
|
2303
2303
|
const t = document.createElement("div");
|
|
2304
2304
|
return t.style.position = "absolute", t.style.inset = "0", t;
|
|
2305
2305
|
};
|
|
2306
2306
|
class ot {
|
|
2307
2307
|
constructor(e) {
|
|
2308
|
-
i(this, "background",
|
|
2309
|
-
i(this, "main",
|
|
2310
|
-
i(this, "overlay",
|
|
2308
|
+
i(this, "background", O());
|
|
2309
|
+
i(this, "main", O());
|
|
2310
|
+
i(this, "overlay", O());
|
|
2311
2311
|
i(this, "host", tt());
|
|
2312
2312
|
this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.overlay.style.pointerEvents = "none", this.host.appendChild(this.overlay);
|
|
2313
2313
|
}
|
|
@@ -2316,14 +2316,14 @@ class ot {
|
|
|
2316
2316
|
}
|
|
2317
2317
|
}
|
|
2318
2318
|
class it {
|
|
2319
|
-
constructor() {
|
|
2319
|
+
constructor(e) {
|
|
2320
2320
|
i(this, "element", null);
|
|
2321
2321
|
i(this, "canvasDefaults", {});
|
|
2322
|
-
i(this, "
|
|
2323
|
-
i(this, "
|
|
2324
|
-
i(this, "
|
|
2325
|
-
i(this, "
|
|
2326
|
-
i(this, "
|
|
2322
|
+
i(this, "dragConfig", {});
|
|
2323
|
+
i(this, "transformConfig", {});
|
|
2324
|
+
i(this, "backgroundConfig", {});
|
|
2325
|
+
i(this, "connectablePortsConfig", {});
|
|
2326
|
+
i(this, "virtualScrollConfig");
|
|
2327
2327
|
i(this, "hasDraggableNode", !1);
|
|
2328
2328
|
i(this, "hasTransformableViewport", !1);
|
|
2329
2329
|
i(this, "hasResizeReactiveNodes", !1);
|
|
@@ -2331,7 +2331,12 @@ class it {
|
|
|
2331
2331
|
i(this, "hasUserConnectablePorts", !1);
|
|
2332
2332
|
i(this, "boxRenderingTrigger");
|
|
2333
2333
|
i(this, "window", window);
|
|
2334
|
+
e !== void 0 && (this.element = e);
|
|
2334
2335
|
}
|
|
2336
|
+
/**
|
|
2337
|
+
* @deprecated
|
|
2338
|
+
* use `new CanvasBuilder(element);` instead
|
|
2339
|
+
*/
|
|
2335
2340
|
setElement(e) {
|
|
2336
2341
|
return this.element = e, this;
|
|
2337
2342
|
}
|
|
@@ -2345,13 +2350,13 @@ class it {
|
|
|
2345
2350
|
* enables nodes draggable by user
|
|
2346
2351
|
*/
|
|
2347
2352
|
enableUserDraggableNodes(e) {
|
|
2348
|
-
return this.hasDraggableNode = !0, this.
|
|
2353
|
+
return this.hasDraggableNode = !0, this.dragConfig = e ?? {}, this;
|
|
2349
2354
|
}
|
|
2350
2355
|
/**
|
|
2351
2356
|
* enables viewport transformable by user
|
|
2352
2357
|
*/
|
|
2353
2358
|
enableUserTransformableViewport(e) {
|
|
2354
|
-
return this.hasTransformableViewport = !0, this.
|
|
2359
|
+
return this.hasTransformableViewport = !0, this.transformConfig = e ?? {}, this;
|
|
2355
2360
|
}
|
|
2356
2361
|
/**
|
|
2357
2362
|
* enables automatic edges update on node resize
|
|
@@ -2370,19 +2375,19 @@ class it {
|
|
|
2370
2375
|
* to viewport are rendered
|
|
2371
2376
|
*/
|
|
2372
2377
|
enableVirtualScroll(e) {
|
|
2373
|
-
return this.
|
|
2378
|
+
return this.virtualScrollConfig = e, this;
|
|
2374
2379
|
}
|
|
2375
2380
|
/**
|
|
2376
2381
|
* enables built-in background rendering
|
|
2377
2382
|
*/
|
|
2378
2383
|
enableBackground(e) {
|
|
2379
|
-
return this.hasBackground = !0, this.
|
|
2384
|
+
return this.hasBackground = !0, this.backgroundConfig = e ?? {}, this;
|
|
2380
2385
|
}
|
|
2381
2386
|
/**
|
|
2382
2387
|
* enables edge creation by dragging one port to another
|
|
2383
2388
|
*/
|
|
2384
2389
|
enableUserConnectablePorts(e) {
|
|
2385
|
-
return this.
|
|
2390
|
+
return this.connectablePortsConfig = e ?? {}, this.hasUserConnectablePorts = !0, this;
|
|
2386
2391
|
}
|
|
2387
2392
|
/**
|
|
2388
2393
|
* builds final canvas
|
|
@@ -2393,8 +2398,8 @@ class it {
|
|
|
2393
2398
|
"unable to build canvas when no attach element specified"
|
|
2394
2399
|
);
|
|
2395
2400
|
let e = this.boxRenderingTrigger;
|
|
2396
|
-
this.
|
|
2397
|
-
const o = new ce(), r = new
|
|
2401
|
+
this.virtualScrollConfig !== void 0 && e === void 0 && (e = new he());
|
|
2402
|
+
const o = new ce(), r = new Be(), s = new ot(this.element);
|
|
2398
2403
|
let h = new ne(
|
|
2399
2404
|
o,
|
|
2400
2405
|
r,
|
|
@@ -2410,34 +2415,34 @@ class it {
|
|
|
2410
2415
|
), d = () => {
|
|
2411
2416
|
s.destroy(), n.onBeforeDestroy.unsubscribe(d);
|
|
2412
2417
|
};
|
|
2413
|
-
return n.onBeforeDestroy.subscribe(d), this.hasBackground &&
|
|
2418
|
+
return n.onBeforeDestroy.subscribe(d), this.hasBackground && Q.configure(
|
|
2414
2419
|
n,
|
|
2415
|
-
this.
|
|
2420
|
+
this.backgroundConfig,
|
|
2416
2421
|
s.background
|
|
2417
|
-
), this.hasResizeReactiveNodes &&
|
|
2422
|
+
), this.hasResizeReactiveNodes && G.configure(n), this.hasDraggableNode && J.configure(
|
|
2418
2423
|
n,
|
|
2419
2424
|
s.main,
|
|
2420
2425
|
this.window,
|
|
2421
|
-
this.
|
|
2422
|
-
), this.hasUserConnectablePorts &&
|
|
2426
|
+
this.dragConfig
|
|
2427
|
+
), this.hasUserConnectablePorts && Z.configure(
|
|
2423
2428
|
n,
|
|
2424
2429
|
s.overlay,
|
|
2425
2430
|
r,
|
|
2426
2431
|
this.window,
|
|
2427
2432
|
this.canvasDefaults,
|
|
2428
|
-
this.
|
|
2429
|
-
), this.
|
|
2433
|
+
this.connectablePortsConfig
|
|
2434
|
+
), this.virtualScrollConfig !== void 0 ? K.configure(
|
|
2430
2435
|
n,
|
|
2431
2436
|
s.main,
|
|
2432
2437
|
this.window,
|
|
2433
|
-
this.
|
|
2438
|
+
this.transformConfig,
|
|
2434
2439
|
e,
|
|
2435
|
-
this.
|
|
2440
|
+
this.virtualScrollConfig
|
|
2436
2441
|
) : this.hasTransformableViewport && k.configure(
|
|
2437
2442
|
n,
|
|
2438
2443
|
s.main,
|
|
2439
2444
|
this.window,
|
|
2440
|
-
this.
|
|
2445
|
+
this.transformConfig
|
|
2441
2446
|
), this.reset(), n;
|
|
2442
2447
|
}
|
|
2443
2448
|
/**
|
|
@@ -2445,7 +2450,7 @@ class it {
|
|
|
2445
2450
|
* CanvasBuilder should be single use object
|
|
2446
2451
|
*/
|
|
2447
2452
|
reset() {
|
|
2448
|
-
this.element = null, this.canvasDefaults = {}, this.
|
|
2453
|
+
this.element = null, this.canvasDefaults = {}, this.dragConfig = {}, this.transformConfig = {}, this.backgroundConfig = {}, this.virtualScrollConfig = void 0, this.hasDraggableNode = !1, this.hasTransformableViewport = !1, this.hasResizeReactiveNodes = !1, this.hasBackground = !1, this.boxRenderingTrigger = void 0, this.hasUserConnectablePorts = !1;
|
|
2449
2454
|
}
|
|
2450
2455
|
}
|
|
2451
2456
|
export {
|
|
@@ -2454,6 +2459,6 @@ export {
|
|
|
2454
2459
|
he as EventSubject,
|
|
2455
2460
|
Me as HorizontalEdgeShape,
|
|
2456
2461
|
S as HtmlGraphError,
|
|
2457
|
-
|
|
2458
|
-
|
|
2462
|
+
Ve as StraightEdgeShape,
|
|
2463
|
+
Le as VerticalEdgeShape
|
|
2459
2464
|
};
|