@metadev/daga 4.2.7 → 4.2.9
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/Changelog.md +12 -0
- package/index.cjs.js +629 -216
- package/index.esm.js +629 -216
- package/package.json +1 -1
- package/src/lib/diagram/canvas/diagram-user-selection.d.ts +4 -3
- package/src/lib/diagram/config/diagram-components-config.d.ts +5 -0
- package/src/lib/diagram/config/diagram-config.d.ts +6 -0
- package/src/lib/diagram/config/diagram-look-config.d.ts +1 -0
- package/src/lib/diagram/model/diagram-connection.d.ts +36 -3
- package/src/lib/diagram/model/diagram-node.d.ts +14 -1
- package/src/lib/diagram/model/diagram-port.d.ts +12 -1
- package/src/lib/diagram/model/diagram-section.d.ts +12 -1
package/index.cjs.js
CHANGED
|
@@ -402,7 +402,20 @@ const linePath = (shape, points, startDirection, endDirection, minimumDistanceBe
|
|
|
402
402
|
result += `M ${points[0][0]} ${points[0][1]}`;
|
|
403
403
|
for (let i = 1; i < points.length; ++i) {
|
|
404
404
|
if (i + 1 >= points.length) {
|
|
405
|
-
|
|
405
|
+
switch (endDirection) {
|
|
406
|
+
case exports.Side.Bottom:
|
|
407
|
+
nextDirection = exports.Side.Top;
|
|
408
|
+
break;
|
|
409
|
+
case exports.Side.Top:
|
|
410
|
+
nextDirection = exports.Side.Bottom;
|
|
411
|
+
break;
|
|
412
|
+
case exports.Side.Right:
|
|
413
|
+
nextDirection = exports.Side.Left;
|
|
414
|
+
break;
|
|
415
|
+
case exports.Side.Left:
|
|
416
|
+
nextDirection = exports.Side.Right;
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
406
419
|
} else {
|
|
407
420
|
if (Math.abs(points[i][0] - points[i - 1][0]) < Math.abs(points[i][1] - points[i - 1][1])) {
|
|
408
421
|
if (points[i][1] > points[i - 1][1]) {
|
|
@@ -438,16 +451,16 @@ const linePath = (shape, points, startDirection, endDirection, minimumDistanceBe
|
|
|
438
451
|
}
|
|
439
452
|
if (nextDirection !== undefined) {
|
|
440
453
|
switch (nextDirection) {
|
|
441
|
-
case exports.Side.
|
|
454
|
+
case exports.Side.Top:
|
|
442
455
|
controlPoint2 = `${points[i][0]} ${points[i][1] + controlPointDistance}`;
|
|
443
456
|
break;
|
|
444
|
-
case exports.Side.
|
|
457
|
+
case exports.Side.Bottom:
|
|
445
458
|
controlPoint2 = `${points[i][0]} ${points[i][1] - controlPointDistance}`;
|
|
446
459
|
break;
|
|
447
|
-
case exports.Side.
|
|
460
|
+
case exports.Side.Left:
|
|
448
461
|
controlPoint2 = `${points[i][0] + controlPointDistance} ${points[i][1]}`;
|
|
449
462
|
break;
|
|
450
|
-
case exports.Side.
|
|
463
|
+
case exports.Side.Right:
|
|
451
464
|
controlPoint2 = `${points[i][0] - controlPointDistance} ${points[i][1]}`;
|
|
452
465
|
break;
|
|
453
466
|
}
|
|
@@ -460,16 +473,16 @@ const linePath = (shape, points, startDirection, endDirection, minimumDistanceBe
|
|
|
460
473
|
let controlPoint = '';
|
|
461
474
|
const controlPointDistance = (Math.abs(points[i][0] - points[i - 1][0]) + Math.abs(points[i][1] - points[i - 1][1])) / 2;
|
|
462
475
|
switch (nextDirection) {
|
|
463
|
-
case exports.Side.
|
|
476
|
+
case exports.Side.Top:
|
|
464
477
|
controlPoint = `${points[i][0]} ${points[i][1] + controlPointDistance}`;
|
|
465
478
|
break;
|
|
466
|
-
case exports.Side.
|
|
479
|
+
case exports.Side.Bottom:
|
|
467
480
|
controlPoint = `${points[i][0]} ${points[i][1] - controlPointDistance}`;
|
|
468
481
|
break;
|
|
469
|
-
case exports.Side.
|
|
482
|
+
case exports.Side.Left:
|
|
470
483
|
controlPoint = `${points[i][0] + controlPointDistance} ${points[i][1]}`;
|
|
471
484
|
break;
|
|
472
|
-
case exports.Side.
|
|
485
|
+
case exports.Side.Right:
|
|
473
486
|
controlPoint = `${points[i][0] - controlPointDistance} ${points[i][1]}`;
|
|
474
487
|
break;
|
|
475
488
|
}
|
|
@@ -482,152 +495,443 @@ const linePath = (shape, points, startDirection, endDirection, minimumDistanceBe
|
|
|
482
495
|
}
|
|
483
496
|
break;
|
|
484
497
|
case exports.LineShape.Square:
|
|
498
|
+
currentDirection = startDirection;
|
|
485
499
|
result += `M ${points[0][0]} ${points[0][1]}`;
|
|
486
|
-
if (startDirection) {
|
|
487
|
-
switch (startDirection) {
|
|
488
|
-
case exports.Side.Bottom:
|
|
489
|
-
points.splice(1, 0, [points[0][0], points[0][1] + minimumDistanceBeforeTurn]);
|
|
490
|
-
break;
|
|
491
|
-
case exports.Side.Top:
|
|
492
|
-
points.splice(1, 0, [points[0][0], points[0][1] - minimumDistanceBeforeTurn]);
|
|
493
|
-
break;
|
|
494
|
-
case exports.Side.Right:
|
|
495
|
-
points.splice(1, 0, [points[0][0] + minimumDistanceBeforeTurn, points[0][1]]);
|
|
496
|
-
break;
|
|
497
|
-
case exports.Side.Left:
|
|
498
|
-
points.splice(1, 0, [points[0][0] - minimumDistanceBeforeTurn, points[0][1]]);
|
|
499
|
-
break;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
if (endDirection) {
|
|
503
|
-
switch (endDirection) {
|
|
504
|
-
case exports.Side.Bottom:
|
|
505
|
-
points.splice(points.length - 1, 0, [points[points.length - 1][0], points[points.length - 1][1] + minimumDistanceBeforeTurn]);
|
|
506
|
-
break;
|
|
507
|
-
case exports.Side.Top:
|
|
508
|
-
points.splice(points.length - 1, 0, [points[points.length - 1][0], points[points.length - 1][1] - minimumDistanceBeforeTurn]);
|
|
509
|
-
break;
|
|
510
|
-
case exports.Side.Right:
|
|
511
|
-
points.splice(points.length - 1, 0, [points[points.length - 1][0] + minimumDistanceBeforeTurn, points[points.length - 1][1]]);
|
|
512
|
-
break;
|
|
513
|
-
case exports.Side.Left:
|
|
514
|
-
points.splice(points.length - 1, 0, [points[points.length - 1][0] - minimumDistanceBeforeTurn, points[points.length - 1][1]]);
|
|
515
|
-
break;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
500
|
for (let i = 1; i < points.length; ++i) {
|
|
519
|
-
if (
|
|
520
|
-
switch (
|
|
501
|
+
if (i + 1 >= points.length) {
|
|
502
|
+
switch (endDirection) {
|
|
521
503
|
case exports.Side.Bottom:
|
|
522
|
-
|
|
523
|
-
// next point is behind, we turn around
|
|
524
|
-
result += ` H ${points[i][0]}`;
|
|
525
|
-
result += ` V ${points[i][1]}`;
|
|
526
|
-
currentDirection = exports.Side.Top;
|
|
527
|
-
} else if (points[i][1] < points[i - 1][1] && points[i][0] === points[i - 1][0]) {
|
|
528
|
-
// next point is behind on the same line, we turn around
|
|
529
|
-
result += ` H ${points[i][0] + minimumDistanceBeforeTurn}`;
|
|
530
|
-
result += ` V ${points[i][1]}`;
|
|
531
|
-
result += ` H ${points[i][0]}`;
|
|
532
|
-
currentDirection = exports.Side.Left;
|
|
533
|
-
} else if (points[i][1] === points[i - 1][1] && points[i][0] !== points[i - 1][0]) {
|
|
534
|
-
// next point is perpendicular to us
|
|
535
|
-
result += ` H ${points[i][0]}`;
|
|
536
|
-
currentDirection = points[i][0] > points[i - 1][0] ? exports.Side.Right : exports.Side.Left;
|
|
537
|
-
} else if (points[i][1] > points[i - 1][1] && points[i][0] !== points[i - 1][0]) {
|
|
538
|
-
// next point is after us, we turn and continue
|
|
539
|
-
result += ` H ${points[i][0]}`;
|
|
540
|
-
result += ` V ${points[i][1]}`;
|
|
541
|
-
} else if (points[i][1] > points[i - 1][1] && points[i][0] === points[i - 1][0]) {
|
|
542
|
-
// next point is in the same direction, we continue straight
|
|
543
|
-
result += ` V ${points[i][1]}`;
|
|
544
|
-
}
|
|
504
|
+
nextDirection = exports.Side.Top;
|
|
545
505
|
break;
|
|
546
506
|
case exports.Side.Top:
|
|
547
|
-
|
|
548
|
-
// next point is behind, we turn around
|
|
549
|
-
result += ` H ${points[i][0]}`;
|
|
550
|
-
result += ` V ${points[i][1]}`;
|
|
551
|
-
currentDirection = exports.Side.Bottom;
|
|
552
|
-
} else if (points[i][1] > points[i - 1][1] && points[i][0] === points[i - 1][0]) {
|
|
553
|
-
// next point is behind on the same line, we turn around
|
|
554
|
-
result += ` H ${points[i][0] - minimumDistanceBeforeTurn}`;
|
|
555
|
-
result += ` V ${points[i][1]}`;
|
|
556
|
-
result += ` H ${points[i][0]}`;
|
|
557
|
-
currentDirection = exports.Side.Right;
|
|
558
|
-
} else if (points[i][1] === points[i - 1][1] && points[i][0] !== points[i - 1][0]) {
|
|
559
|
-
// next point is perpendicular to us
|
|
560
|
-
result += ` H ${points[i][0]}`;
|
|
561
|
-
currentDirection = points[i][0] > points[i - 1][0] ? exports.Side.Right : exports.Side.Left;
|
|
562
|
-
} else if (points[i][1] < points[i - 1][1] && points[i][0] !== points[i - 1][0]) {
|
|
563
|
-
// next point is after us, we turn and continue
|
|
564
|
-
result += ` H ${points[i][0]}`;
|
|
565
|
-
result += ` V ${points[i][1]}`;
|
|
566
|
-
} else if (points[i][1] < points[i - 1][1] && points[i][0] === points[i - 1][0]) {
|
|
567
|
-
// next point is in the same direction, we continue straight
|
|
568
|
-
result += ` V ${points[i][1]}`;
|
|
569
|
-
}
|
|
507
|
+
nextDirection = exports.Side.Bottom;
|
|
570
508
|
break;
|
|
571
509
|
case exports.Side.Right:
|
|
572
|
-
|
|
573
|
-
// next point is behind, we turn around
|
|
574
|
-
result += ` V ${points[i][1]}`;
|
|
575
|
-
result += ` H ${points[i][0]}`;
|
|
576
|
-
currentDirection = exports.Side.Left;
|
|
577
|
-
} else if (points[i][0] < points[i - 1][0] && points[i][1] === points[i - 1][1]) {
|
|
578
|
-
// next point is behind on the same line, we turn around
|
|
579
|
-
result += ` V ${points[i][1] + minimumDistanceBeforeTurn}`;
|
|
580
|
-
result += ` H ${points[i][0]}`;
|
|
581
|
-
result += ` V ${points[i][1]}`;
|
|
582
|
-
currentDirection = exports.Side.Top;
|
|
583
|
-
} else if (points[i][0] === points[i - 1][0] && points[i][1] !== points[i - 1][1]) {
|
|
584
|
-
// next point is perpendicular to us
|
|
585
|
-
result += ` V ${points[i][1]}`;
|
|
586
|
-
currentDirection = points[i][1] > points[i - 1][1] ? exports.Side.Bottom : exports.Side.Top;
|
|
587
|
-
} else if (points[i][0] > points[i - 1][0] && points[i][1] !== points[i - 1][1]) {
|
|
588
|
-
// next point is after us, we turn and continue
|
|
589
|
-
result += ` V ${points[i][1]}`;
|
|
590
|
-
result += ` H ${points[i][0]}`;
|
|
591
|
-
} else if (points[i][0] > points[i - 1][0] && points[i][1] === points[i - 1][1]) {
|
|
592
|
-
// next point is in the same direction, we continue straight
|
|
593
|
-
result += ` H ${points[i][0]}`;
|
|
594
|
-
}
|
|
510
|
+
nextDirection = exports.Side.Left;
|
|
595
511
|
break;
|
|
596
512
|
case exports.Side.Left:
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
513
|
+
nextDirection = exports.Side.Right;
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
switch (currentDirection) {
|
|
518
|
+
case exports.Side.Bottom:
|
|
519
|
+
switch (nextDirection) {
|
|
520
|
+
case exports.Side.Bottom:
|
|
521
|
+
if (points[i][1] > points[i - 1][1]) {
|
|
522
|
+
if (points[i][0] !== points[i - 1][0]) {
|
|
523
|
+
result += ` V ${(points[i][1] + points[i - 1][1]) / 2}`;
|
|
524
|
+
result += ` H ${points[i][0]}`;
|
|
525
|
+
result += ` V ${points[i][1]}`;
|
|
526
|
+
} else {
|
|
527
|
+
result += ` V ${points[i][1]}`;
|
|
528
|
+
}
|
|
529
|
+
currentDirection = nextDirection;
|
|
530
|
+
} else {
|
|
531
|
+
if (points[i][0] > points[i - 1][0]) {
|
|
532
|
+
result += ` V ${points[i - 1][1] + minimumDistanceBeforeTurn}`;
|
|
533
|
+
result += ` H ${Math.max(points[i - 1][0], points[i][0]) + minimumDistanceBeforeTurn}`;
|
|
534
|
+
result += ` V ${points[i][1] - minimumDistanceBeforeTurn}`;
|
|
535
|
+
result += ` H ${points[i][0]}`;
|
|
536
|
+
result += ` V ${points[i][1]}`;
|
|
537
|
+
} else {
|
|
538
|
+
result += ` V ${points[i - 1][1] + minimumDistanceBeforeTurn}`;
|
|
539
|
+
result += ` H ${Math.min(points[i - 1][0], points[i][0]) - minimumDistanceBeforeTurn}`;
|
|
540
|
+
result += ` V ${points[i][1] - minimumDistanceBeforeTurn}`;
|
|
541
|
+
result += ` H ${points[i][0]}`;
|
|
542
|
+
result += ` V ${points[i][1]}`;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
break;
|
|
546
|
+
case exports.Side.Top:
|
|
547
|
+
result += ` V ${Math.max(points[i - 1][1], points[i][1]) + minimumDistanceBeforeTurn}`;
|
|
605
548
|
result += ` H ${points[i][0]}`;
|
|
606
549
|
result += ` V ${points[i][1]}`;
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
550
|
+
break;
|
|
551
|
+
case exports.Side.Left:
|
|
552
|
+
if (points[i][1] > points[i - 1][1] + minimumDistanceBeforeTurn) {
|
|
553
|
+
if (points[i][0] < points[i - 1][0] - minimumDistanceBeforeTurn) {
|
|
554
|
+
result += ` V ${points[i][1]}`;
|
|
555
|
+
result += ` H ${points[i][0]}`;
|
|
556
|
+
} else {
|
|
557
|
+
result += ` V ${(points[i - 1][1] + points[i][1]) / 2}`;
|
|
558
|
+
result += ` H ${points[i][0] + minimumDistanceBeforeTurn}`;
|
|
559
|
+
result += ` V ${points[i][1]}`;
|
|
560
|
+
result += ` H ${points[i][0]}`;
|
|
561
|
+
}
|
|
562
|
+
} else {
|
|
563
|
+
if (points[i][0] < points[i - 1][0] - minimumDistanceBeforeTurn) {
|
|
564
|
+
result += ` V ${points[i - 1][1] + minimumDistanceBeforeTurn}`;
|
|
565
|
+
result += ` H ${(points[i - 1][0] + points[i][0]) / 2}`;
|
|
566
|
+
result += ` V ${points[i][1]}`;
|
|
567
|
+
result += ` H ${points[i][0]}`;
|
|
568
|
+
} else {
|
|
569
|
+
result += ` V ${points[i - 1][1] + minimumDistanceBeforeTurn}`;
|
|
570
|
+
result += ` H ${points[i][0] + minimumDistanceBeforeTurn}`;
|
|
571
|
+
result += ` V ${points[i][1]}`;
|
|
572
|
+
result += ` H ${points[i][0]}`;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
break;
|
|
576
|
+
case exports.Side.Right:
|
|
577
|
+
if (points[i][1] > points[i - 1][1] + minimumDistanceBeforeTurn) {
|
|
578
|
+
if (points[i][0] > points[i - 1][0] + minimumDistanceBeforeTurn) {
|
|
579
|
+
result += ` V ${points[i][1]}`;
|
|
580
|
+
result += ` H ${points[i][0]}`;
|
|
581
|
+
} else {
|
|
582
|
+
result += ` V ${(points[i - 1][1] + points[i][1]) / 2}`;
|
|
583
|
+
result += ` H ${points[i][0] - minimumDistanceBeforeTurn}`;
|
|
584
|
+
result += ` V ${points[i][1]}`;
|
|
585
|
+
result += ` H ${points[i][0]}`;
|
|
586
|
+
}
|
|
587
|
+
} else {
|
|
588
|
+
if (points[i][0] > points[i - 1][0] + minimumDistanceBeforeTurn) {
|
|
589
|
+
result += ` V ${points[i - 1][1] + minimumDistanceBeforeTurn}`;
|
|
590
|
+
result += ` H ${(points[i - 1][0] + points[i][0]) / 2}`;
|
|
591
|
+
result += ` V ${points[i][1]}`;
|
|
592
|
+
result += ` H ${points[i][0]}`;
|
|
593
|
+
} else {
|
|
594
|
+
result += ` V ${points[i - 1][1] + minimumDistanceBeforeTurn}`;
|
|
595
|
+
result += ` H ${points[i][0] - minimumDistanceBeforeTurn}`;
|
|
596
|
+
result += ` V ${points[i][1]}`;
|
|
597
|
+
result += ` H ${points[i][0]}`;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
break;
|
|
601
|
+
default:
|
|
602
|
+
if (points[i][1] < points[i - 1][1] + minimumDistanceBeforeTurn) {
|
|
603
|
+
result += ` V ${points[i - 1][1] + minimumDistanceBeforeTurn}`;
|
|
604
|
+
if (points[i][0] !== points[i - 1][0]) {
|
|
605
|
+
result += ` H ${points[i][0]}`;
|
|
606
|
+
}
|
|
607
|
+
result += ` V ${points[i][1]}`;
|
|
608
|
+
currentDirection = exports.Side.Top;
|
|
609
|
+
} else {
|
|
610
|
+
result += ` V ${points[i][1]}`;
|
|
611
|
+
currentDirection = exports.Side.Bottom;
|
|
612
|
+
if (points[i][0] !== points[i - 1][0]) {
|
|
613
|
+
result += ` H ${points[i][0]}`;
|
|
614
|
+
currentDirection = points[i][0] > points[i - 1][0] ? exports.Side.Right : exports.Side.Left;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
break;
|
|
620
|
+
case exports.Side.Top:
|
|
621
|
+
switch (nextDirection) {
|
|
622
|
+
case exports.Side.Top:
|
|
623
|
+
if (points[i][1] < points[i - 1][1]) {
|
|
624
|
+
if (points[i][0] !== points[i - 1][0]) {
|
|
625
|
+
result += ` V ${(points[i][1] + points[i - 1][1]) / 2}`;
|
|
626
|
+
result += ` H ${points[i][0]}`;
|
|
627
|
+
result += ` V ${points[i][1]}`;
|
|
628
|
+
} else {
|
|
629
|
+
result += ` V ${points[i][1]}`;
|
|
630
|
+
}
|
|
631
|
+
currentDirection = nextDirection;
|
|
632
|
+
} else {
|
|
633
|
+
if (points[i][0] < points[i - 1][0]) {
|
|
634
|
+
result += ` V ${points[i - 1][1] - minimumDistanceBeforeTurn}`;
|
|
635
|
+
result += ` H ${Math.min(points[i - 1][0], points[i][0]) - minimumDistanceBeforeTurn}`;
|
|
636
|
+
result += ` V ${points[i][1] + minimumDistanceBeforeTurn}`;
|
|
637
|
+
result += ` H ${points[i][0]}`;
|
|
638
|
+
result += ` V ${points[i][1]}`;
|
|
639
|
+
} else {
|
|
640
|
+
result += ` V ${points[i - 1][1] - minimumDistanceBeforeTurn}`;
|
|
641
|
+
result += ` H ${Math.max(points[i - 1][0], points[i][0]) + minimumDistanceBeforeTurn}`;
|
|
642
|
+
result += ` V ${points[i][1] + minimumDistanceBeforeTurn}`;
|
|
643
|
+
result += ` H ${points[i][0]}`;
|
|
644
|
+
result += ` V ${points[i][1]}`;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
break;
|
|
648
|
+
case exports.Side.Bottom:
|
|
649
|
+
result += ` V ${Math.min(points[i - 1][1], points[i][1]) - minimumDistanceBeforeTurn}`;
|
|
650
|
+
result += ` H ${points[i][0]}`;
|
|
610
651
|
result += ` V ${points[i][1]}`;
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
652
|
+
break;
|
|
653
|
+
case exports.Side.Right:
|
|
654
|
+
if (points[i][1] < points[i - 1][1] - minimumDistanceBeforeTurn) {
|
|
655
|
+
if (points[i][0] > points[i - 1][0] + minimumDistanceBeforeTurn) {
|
|
656
|
+
result += ` V ${points[i][1]}`;
|
|
657
|
+
result += ` H ${points[i][0]}`;
|
|
658
|
+
} else {
|
|
659
|
+
result += ` V ${(points[i - 1][1] + points[i][1]) / 2}`;
|
|
660
|
+
result += ` H ${points[i][0] - minimumDistanceBeforeTurn}`;
|
|
661
|
+
result += ` V ${points[i][1]}`;
|
|
662
|
+
result += ` H ${points[i][0]}`;
|
|
663
|
+
}
|
|
664
|
+
} else {
|
|
665
|
+
if (points[i][0] > points[i - 1][0] + minimumDistanceBeforeTurn) {
|
|
666
|
+
result += ` V ${points[i - 1][1] - minimumDistanceBeforeTurn}`;
|
|
667
|
+
result += ` H ${(points[i - 1][0] + points[i][0]) / 2}`;
|
|
668
|
+
result += ` V ${points[i][1]}`;
|
|
669
|
+
result += ` H ${points[i][0]}`;
|
|
670
|
+
} else {
|
|
671
|
+
result += ` V ${points[i - 1][1] - minimumDistanceBeforeTurn}`;
|
|
672
|
+
result += ` H ${points[i][0] - minimumDistanceBeforeTurn}`;
|
|
673
|
+
result += ` V ${points[i][1]}`;
|
|
674
|
+
result += ` H ${points[i][0]}`;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
break;
|
|
678
|
+
case exports.Side.Left:
|
|
679
|
+
if (points[i][1] < points[i - 1][1] - minimumDistanceBeforeTurn) {
|
|
680
|
+
if (points[i][0] < points[i - 1][0] - minimumDistanceBeforeTurn) {
|
|
681
|
+
result += ` V ${points[i][1]}`;
|
|
682
|
+
result += ` H ${points[i][0]}`;
|
|
683
|
+
} else {
|
|
684
|
+
result += ` V ${(points[i - 1][1] + points[i][1]) / 2}`;
|
|
685
|
+
result += ` H ${points[i][0] + minimumDistanceBeforeTurn}`;
|
|
686
|
+
result += ` V ${points[i][1]}`;
|
|
687
|
+
result += ` H ${points[i][0]}`;
|
|
688
|
+
}
|
|
689
|
+
} else {
|
|
690
|
+
if (points[i][0] < points[i - 1][0] - minimumDistanceBeforeTurn) {
|
|
691
|
+
result += ` V ${points[i - 1][1] - minimumDistanceBeforeTurn}`;
|
|
692
|
+
result += ` H ${(points[i - 1][0] + points[i][0]) / 2}`;
|
|
693
|
+
result += ` V ${points[i][1]}`;
|
|
694
|
+
result += ` H ${points[i][0]}`;
|
|
695
|
+
} else {
|
|
696
|
+
result += ` V ${points[i - 1][1] - minimumDistanceBeforeTurn}`;
|
|
697
|
+
result += ` H ${points[i][0] + minimumDistanceBeforeTurn}`;
|
|
698
|
+
result += ` V ${points[i][1]}`;
|
|
699
|
+
result += ` H ${points[i][0]}`;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
break;
|
|
703
|
+
default:
|
|
704
|
+
if (points[i][1] > points[i - 1][1] - minimumDistanceBeforeTurn) {
|
|
705
|
+
result += ` V ${points[i - 1][1] - minimumDistanceBeforeTurn}`;
|
|
706
|
+
if (points[i][0] !== points[i - 1][0]) {
|
|
707
|
+
result += ` H ${points[i][0]}`;
|
|
708
|
+
}
|
|
709
|
+
result += ` V ${points[i][1]}`;
|
|
710
|
+
currentDirection = exports.Side.Bottom;
|
|
711
|
+
} else {
|
|
712
|
+
result += ` V ${points[i][1]}`;
|
|
713
|
+
currentDirection = exports.Side.Top;
|
|
714
|
+
if (points[i][0] !== points[i - 1][0]) {
|
|
715
|
+
result += ` H ${points[i][0]}`;
|
|
716
|
+
currentDirection = points[i][0] > points[i - 1][0] ? exports.Side.Right : exports.Side.Left;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
721
|
+
break;
|
|
722
|
+
case exports.Side.Left:
|
|
723
|
+
switch (nextDirection) {
|
|
724
|
+
case exports.Side.Left:
|
|
725
|
+
if (points[i][0] < points[i - 1][0]) {
|
|
726
|
+
if (points[i][1] !== points[i - 1][1]) {
|
|
727
|
+
result += ` H ${(points[i][0] + points[i - 1][0]) / 2}`;
|
|
728
|
+
result += ` V ${points[i][1]}`;
|
|
729
|
+
result += ` H ${points[i][0]}`;
|
|
730
|
+
} else {
|
|
731
|
+
result += ` H ${points[i][0]}`;
|
|
732
|
+
}
|
|
733
|
+
currentDirection = nextDirection;
|
|
734
|
+
} else {
|
|
735
|
+
if (points[i][1] < points[i - 1][1]) {
|
|
736
|
+
result += ` H ${points[i - 1][0] - minimumDistanceBeforeTurn}`;
|
|
737
|
+
result += ` V ${Math.min(points[i - 1][1], points[i][1]) - minimumDistanceBeforeTurn}`;
|
|
738
|
+
result += ` H ${points[i][0] + minimumDistanceBeforeTurn}`;
|
|
739
|
+
result += ` V ${points[i][1]}`;
|
|
740
|
+
result += ` H ${points[i][0]}`;
|
|
741
|
+
} else {
|
|
742
|
+
result += ` H ${points[i - 1][0] - minimumDistanceBeforeTurn}`;
|
|
743
|
+
result += ` V ${Math.max(points[i - 1][1], points[i][1]) + minimumDistanceBeforeTurn}`;
|
|
744
|
+
result += ` H ${points[i][0] + minimumDistanceBeforeTurn}`;
|
|
745
|
+
result += ` V ${points[i][1]}`;
|
|
746
|
+
result += ` H ${points[i][0]}`;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
break;
|
|
750
|
+
case exports.Side.Right:
|
|
751
|
+
result += ` H ${Math.min(points[i - 1][0], points[i][0]) - minimumDistanceBeforeTurn}`;
|
|
614
752
|
result += ` V ${points[i][1]}`;
|
|
615
753
|
result += ` H ${points[i][0]}`;
|
|
616
|
-
|
|
617
|
-
|
|
754
|
+
break;
|
|
755
|
+
case exports.Side.Bottom:
|
|
756
|
+
if (points[i][0] < points[i - 1][0] - minimumDistanceBeforeTurn) {
|
|
757
|
+
if (points[i][1] > points[i - 1][1] + minimumDistanceBeforeTurn) {
|
|
758
|
+
result += ` H ${points[i][0]}`;
|
|
759
|
+
result += ` V ${points[i][1]}`;
|
|
760
|
+
} else {
|
|
761
|
+
result += ` H ${(points[i - 1][0] + points[i][0]) / 2}`;
|
|
762
|
+
result += ` V ${points[i][1] - minimumDistanceBeforeTurn}`;
|
|
763
|
+
result += ` H ${points[i][0]}`;
|
|
764
|
+
result += ` V ${points[i][1]}`;
|
|
765
|
+
}
|
|
766
|
+
} else {
|
|
767
|
+
if (points[i][1] > points[i - 1][1] + minimumDistanceBeforeTurn) {
|
|
768
|
+
result += ` H ${points[i - 1][0] - minimumDistanceBeforeTurn}`;
|
|
769
|
+
result += ` V ${(points[i - 1][1] + points[i][1]) / 2}`;
|
|
770
|
+
result += ` H ${points[i][0]}`;
|
|
771
|
+
result += ` V ${points[i][1]}`;
|
|
772
|
+
} else {
|
|
773
|
+
result += ` H ${points[i - 1][0] - minimumDistanceBeforeTurn}`;
|
|
774
|
+
result += ` V ${points[i][1] - minimumDistanceBeforeTurn}`;
|
|
775
|
+
result += ` H ${points[i][0]}`;
|
|
776
|
+
result += ` V ${points[i][1]}`;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
break;
|
|
780
|
+
case exports.Side.Top:
|
|
781
|
+
if (points[i][0] < points[i - 1][0] - minimumDistanceBeforeTurn) {
|
|
782
|
+
if (points[i][1] < points[i - 1][1] - minimumDistanceBeforeTurn) {
|
|
783
|
+
result += ` H ${points[i][0]}`;
|
|
784
|
+
result += ` V ${points[i][1]}`;
|
|
785
|
+
} else {
|
|
786
|
+
result += ` H ${(points[i - 1][0] + points[i][0]) / 2}`;
|
|
787
|
+
result += ` V ${points[i][1] + minimumDistanceBeforeTurn}`;
|
|
788
|
+
result += ` H ${points[i][0]}`;
|
|
789
|
+
result += ` V ${points[i][1]}`;
|
|
790
|
+
}
|
|
791
|
+
} else {
|
|
792
|
+
if (points[i][1] < points[i - 1][1] - minimumDistanceBeforeTurn) {
|
|
793
|
+
result += ` H ${points[i - 1][0] - minimumDistanceBeforeTurn}`;
|
|
794
|
+
result += ` V ${(points[i - 1][1] + points[i][1]) / 2}`;
|
|
795
|
+
result += ` H ${points[i][0]}`;
|
|
796
|
+
result += ` V ${points[i][1]}`;
|
|
797
|
+
} else {
|
|
798
|
+
result += ` H ${points[i - 1][0] - minimumDistanceBeforeTurn}`;
|
|
799
|
+
result += ` V ${points[i][1] + minimumDistanceBeforeTurn}`;
|
|
800
|
+
result += ` H ${points[i][0]}`;
|
|
801
|
+
result += ` V ${points[i][1]}`;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
break;
|
|
805
|
+
default:
|
|
806
|
+
if (points[i][0] > points[i - 1][0] - minimumDistanceBeforeTurn) {
|
|
807
|
+
result += ` H ${points[i - 1][0] - minimumDistanceBeforeTurn}`;
|
|
808
|
+
if (points[i][1] !== points[i - 1][1]) {
|
|
809
|
+
result += ` V ${points[i][1]}`;
|
|
810
|
+
}
|
|
811
|
+
result += ` H ${points[i][0]}`;
|
|
812
|
+
currentDirection = exports.Side.Right;
|
|
813
|
+
} else {
|
|
814
|
+
result += ` H ${points[i][0]}`;
|
|
815
|
+
currentDirection = exports.Side.Left;
|
|
816
|
+
if (points[i][1] !== points[i - 1][1]) {
|
|
817
|
+
result += ` V ${points[i][1]}`;
|
|
818
|
+
currentDirection = points[i][1] > points[i - 1][1] ? exports.Side.Bottom : exports.Side.Top;
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
break;
|
|
822
|
+
}
|
|
823
|
+
break;
|
|
824
|
+
case exports.Side.Right:
|
|
825
|
+
switch (nextDirection) {
|
|
826
|
+
case exports.Side.Right:
|
|
827
|
+
if (points[i][0] > points[i - 1][0]) {
|
|
828
|
+
if (points[i][1] !== points[i - 1][1]) {
|
|
829
|
+
result += ` H ${(points[i][0] + points[i - 1][0]) / 2}`;
|
|
830
|
+
result += ` V ${points[i][1]}`;
|
|
831
|
+
result += ` H ${points[i][0]}`;
|
|
832
|
+
} else {
|
|
833
|
+
result += ` H ${points[i][0]}`;
|
|
834
|
+
}
|
|
835
|
+
currentDirection = nextDirection;
|
|
836
|
+
} else {
|
|
837
|
+
if (points[i][1] > points[i - 1][1]) {
|
|
838
|
+
result += ` H ${points[i - 1][0] + minimumDistanceBeforeTurn}`;
|
|
839
|
+
result += ` V ${Math.max(points[i - 1][1], points[i][1]) + minimumDistanceBeforeTurn}`;
|
|
840
|
+
result += ` H ${points[i][0] - minimumDistanceBeforeTurn}`;
|
|
841
|
+
result += ` V ${points[i][1]}`;
|
|
842
|
+
result += ` H ${points[i][0]}`;
|
|
843
|
+
} else {
|
|
844
|
+
result += ` H ${points[i - 1][0] + minimumDistanceBeforeTurn}`;
|
|
845
|
+
result += ` V ${Math.min(points[i - 1][1], points[i][1]) - minimumDistanceBeforeTurn}`;
|
|
846
|
+
result += ` H ${points[i][0] - minimumDistanceBeforeTurn}`;
|
|
847
|
+
result += ` V ${points[i][1]}`;
|
|
848
|
+
result += ` H ${points[i][0]}`;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
break;
|
|
852
|
+
case exports.Side.Left:
|
|
853
|
+
result += ` H ${Math.max(points[i - 1][0], points[i][0]) + minimumDistanceBeforeTurn}`;
|
|
854
|
+
result += ` V ${points[i][1]}`;
|
|
618
855
|
result += ` H ${points[i][0]}`;
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
856
|
+
break;
|
|
857
|
+
case exports.Side.Top:
|
|
858
|
+
if (points[i][0] > points[i - 1][0] + minimumDistanceBeforeTurn) {
|
|
859
|
+
if (points[i][1] < points[i - 1][1] - minimumDistanceBeforeTurn) {
|
|
860
|
+
result += ` H ${points[i][0]}`;
|
|
861
|
+
result += ` V ${points[i][1]}`;
|
|
862
|
+
} else {
|
|
863
|
+
result += ` H ${(points[i - 1][0] + points[i][0]) / 2}`;
|
|
864
|
+
result += ` V ${points[i][1] + minimumDistanceBeforeTurn}`;
|
|
865
|
+
result += ` H ${points[i][0]}`;
|
|
866
|
+
result += ` V ${points[i][1]}`;
|
|
867
|
+
}
|
|
868
|
+
} else {
|
|
869
|
+
if (points[i][1] < points[i - 1][1] - minimumDistanceBeforeTurn) {
|
|
870
|
+
result += ` H ${points[i - 1][0] + minimumDistanceBeforeTurn}`;
|
|
871
|
+
result += ` V ${(points[i - 1][1] + points[i][1]) / 2}`;
|
|
872
|
+
result += ` H ${points[i][0]}`;
|
|
873
|
+
result += ` V ${points[i][1]}`;
|
|
874
|
+
} else {
|
|
875
|
+
result += ` H ${points[i - 1][0] + minimumDistanceBeforeTurn}`;
|
|
876
|
+
result += ` V ${points[i][1] + minimumDistanceBeforeTurn}`;
|
|
877
|
+
result += ` H ${points[i][0]}`;
|
|
878
|
+
result += ` V ${points[i][1]}`;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
break;
|
|
882
|
+
case exports.Side.Bottom:
|
|
883
|
+
if (points[i][0] > points[i - 1][0] + minimumDistanceBeforeTurn) {
|
|
884
|
+
if (points[i][1] > points[i - 1][1] + minimumDistanceBeforeTurn) {
|
|
885
|
+
result += ` H ${points[i][0]}`;
|
|
886
|
+
result += ` V ${points[i][1]}`;
|
|
887
|
+
} else {
|
|
888
|
+
result += ` H ${(points[i - 1][0] + points[i][0]) / 2}`;
|
|
889
|
+
result += ` V ${points[i][1] - minimumDistanceBeforeTurn}`;
|
|
890
|
+
result += ` H ${points[i][0]}`;
|
|
891
|
+
result += ` V ${points[i][1]}`;
|
|
892
|
+
}
|
|
893
|
+
} else {
|
|
894
|
+
if (points[i][1] > points[i - 1][1] + minimumDistanceBeforeTurn) {
|
|
895
|
+
result += ` H ${points[i - 1][0] + minimumDistanceBeforeTurn}`;
|
|
896
|
+
result += ` V ${(points[i - 1][1] + points[i][1]) / 2}`;
|
|
897
|
+
result += ` H ${points[i][0]}`;
|
|
898
|
+
result += ` V ${points[i][1]}`;
|
|
899
|
+
} else {
|
|
900
|
+
result += ` H ${points[i - 1][0] + minimumDistanceBeforeTurn}`;
|
|
901
|
+
result += ` V ${points[i][1] - minimumDistanceBeforeTurn}`;
|
|
902
|
+
result += ` H ${points[i][0]}`;
|
|
903
|
+
result += ` V ${points[i][1]}`;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
break;
|
|
907
|
+
default:
|
|
908
|
+
if (points[i][0] < points[i - 1][0] + minimumDistanceBeforeTurn) {
|
|
909
|
+
result += ` H ${points[i - 1][0] + minimumDistanceBeforeTurn}`;
|
|
910
|
+
if (points[i][1] !== points[i - 1][1]) {
|
|
911
|
+
result += ` V ${points[i][1]}`;
|
|
912
|
+
}
|
|
913
|
+
result += ` H ${points[i][0]}`;
|
|
914
|
+
currentDirection = exports.Side.Left;
|
|
915
|
+
} else {
|
|
916
|
+
result += ` H ${points[i][0]}`;
|
|
917
|
+
currentDirection = exports.Side.Right;
|
|
918
|
+
if (points[i][1] !== points[i - 1][1]) {
|
|
919
|
+
result += ` V ${points[i][1]}`;
|
|
920
|
+
currentDirection = points[i][1] > points[i - 1][1] ? exports.Side.Bottom : exports.Side.Top;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
break;
|
|
924
|
+
}
|
|
925
|
+
break;
|
|
926
|
+
default:
|
|
927
|
+
if (points[i][0] !== points[i - 1][0]) {
|
|
928
|
+
result += ` H ${points[i][0]}`;
|
|
929
|
+
currentDirection = points[i][0] > points[i - 1][0] ? exports.Side.Right : exports.Side.Left;
|
|
930
|
+
}
|
|
931
|
+
if (points[i][1] !== points[i - 1][1]) {
|
|
932
|
+
result += ` V ${points[i][1]}`;
|
|
933
|
+
currentDirection = points[i][1] > points[i - 1][1] ? exports.Side.Bottom : exports.Side.Top;
|
|
934
|
+
}
|
|
631
935
|
}
|
|
632
936
|
}
|
|
633
937
|
break;
|
|
@@ -925,13 +1229,14 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
925
1229
|
const extractLooksFromConfig = lookConfig => {
|
|
926
1230
|
const {
|
|
927
1231
|
selected,
|
|
928
|
-
highlighted
|
|
1232
|
+
highlighted,
|
|
1233
|
+
selectedAndHighlighted
|
|
929
1234
|
} = lookConfig,
|
|
930
|
-
rest = __rest(lookConfig, ["selected", "highlighted"]);
|
|
1235
|
+
rest = __rest(lookConfig, ["selected", "highlighted", "selectedAndHighlighted"]);
|
|
931
1236
|
const defaultLook = rest;
|
|
932
1237
|
const selectedLook = Object.assign(Object.assign({}, defaultLook), selected);
|
|
933
1238
|
const highlightedLook = Object.assign(Object.assign({}, defaultLook), highlighted);
|
|
934
|
-
const selectedAndHighlightedLook = Object.assign(Object.assign(Object.assign({}, defaultLook), highlighted), selected);
|
|
1239
|
+
const selectedAndHighlightedLook = Object.assign(Object.assign(Object.assign(Object.assign({}, defaultLook), highlighted), selected), selectedAndHighlighted);
|
|
935
1240
|
return {
|
|
936
1241
|
defaultLook,
|
|
937
1242
|
selectedLook,
|
|
@@ -1943,23 +2248,38 @@ class DiagramConnection extends DiagramElement {
|
|
|
1943
2248
|
}
|
|
1944
2249
|
}
|
|
1945
2250
|
}
|
|
2251
|
+
/**
|
|
2252
|
+
* An alias for the `lookConfig` attribute.
|
|
2253
|
+
* @private
|
|
2254
|
+
*/
|
|
2255
|
+
set look(look) {
|
|
2256
|
+
this.lookConfig = look;
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Look configuration used to derive the current look of this connection.
|
|
2260
|
+
* @private
|
|
2261
|
+
*/
|
|
2262
|
+
get lookConfig() {
|
|
2263
|
+
return this._lookConfig;
|
|
2264
|
+
}
|
|
1946
2265
|
/**
|
|
1947
2266
|
* Sets the look configuration of the connection to override the one determined by the type.
|
|
1948
2267
|
* `undefined` resets it to the one determined by the type.
|
|
1949
2268
|
* @private
|
|
1950
2269
|
*/
|
|
1951
|
-
set
|
|
1952
|
-
|
|
1953
|
-
|
|
2270
|
+
set lookConfig(lookConfig) {
|
|
2271
|
+
this._lookConfig = lookConfig;
|
|
2272
|
+
if (lookConfig) {
|
|
2273
|
+
const looks = extractLooksFromConfig(lookConfig);
|
|
1954
2274
|
this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
|
|
1955
2275
|
this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
|
|
1956
2276
|
this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
|
|
1957
2277
|
this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
|
|
1958
2278
|
} else {
|
|
1959
|
-
this._defaultLook =
|
|
1960
|
-
this._selectedLook =
|
|
1961
|
-
this._highlightedLook =
|
|
1962
|
-
this._selectedAndHighlightedLook =
|
|
2279
|
+
this._defaultLook = lookConfig;
|
|
2280
|
+
this._selectedLook = lookConfig;
|
|
2281
|
+
this._highlightedLook = lookConfig;
|
|
2282
|
+
this._selectedAndHighlightedLook = lookConfig;
|
|
1963
2283
|
}
|
|
1964
2284
|
}
|
|
1965
2285
|
/**
|
|
@@ -1981,23 +2301,38 @@ class DiagramConnection extends DiagramElement {
|
|
|
1981
2301
|
}
|
|
1982
2302
|
}
|
|
1983
2303
|
}
|
|
2304
|
+
/**
|
|
2305
|
+
* An alias for the `lookConfig` attribute.
|
|
2306
|
+
* @private
|
|
2307
|
+
*/
|
|
2308
|
+
set startMarkerLook(startMarkerLook) {
|
|
2309
|
+
this.startMarkerLookConfig = startMarkerLook;
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* Look configuration used to derive the current look of the start marker of this connection.
|
|
2313
|
+
* @private
|
|
2314
|
+
*/
|
|
2315
|
+
get startMarkerLookConfig() {
|
|
2316
|
+
return this._startMarkerLookConfig;
|
|
2317
|
+
}
|
|
1984
2318
|
/**
|
|
1985
2319
|
* Sets the look configuration of the start marker to override the one determined by the type.
|
|
1986
2320
|
* `null` stands for no marker and `undefined` resets it to the one determined by the type.
|
|
1987
2321
|
* @private
|
|
1988
2322
|
*/
|
|
1989
|
-
set
|
|
1990
|
-
|
|
1991
|
-
|
|
2323
|
+
set startMarkerLookConfig(startMarkerLookConfig) {
|
|
2324
|
+
this._startMarkerLookConfig = startMarkerLookConfig;
|
|
2325
|
+
if (startMarkerLookConfig) {
|
|
2326
|
+
const looks = extractLooksFromConfig(startMarkerLookConfig);
|
|
1992
2327
|
this._defaultStartMarkerLook = Object.assign(Object.assign({}, this._defaultStartMarkerLook), looks.defaultLook);
|
|
1993
2328
|
this._selectedStartMarkerLook = Object.assign(Object.assign({}, this._selectedStartMarkerLook), looks.selectedLook);
|
|
1994
2329
|
this._highlightedStartMarkerLook = Object.assign(Object.assign({}, this._highlightedStartMarkerLook), looks.highlightedLook);
|
|
1995
2330
|
this._selectedAndHighlightedStartMarkerLook = Object.assign(Object.assign({}, this._selectedAndHighlightedStartMarkerLook), looks.selectedAndHighlightedLook);
|
|
1996
2331
|
} else {
|
|
1997
|
-
this._defaultStartMarkerLook =
|
|
1998
|
-
this._selectedStartMarkerLook =
|
|
1999
|
-
this._highlightedStartMarkerLook =
|
|
2000
|
-
this._selectedAndHighlightedStartMarkerLook =
|
|
2332
|
+
this._defaultStartMarkerLook = startMarkerLookConfig;
|
|
2333
|
+
this._selectedStartMarkerLook = startMarkerLookConfig;
|
|
2334
|
+
this._highlightedStartMarkerLook = startMarkerLookConfig;
|
|
2335
|
+
this._selectedAndHighlightedStartMarkerLook = startMarkerLookConfig;
|
|
2001
2336
|
}
|
|
2002
2337
|
}
|
|
2003
2338
|
/**
|
|
@@ -2019,23 +2354,38 @@ class DiagramConnection extends DiagramElement {
|
|
|
2019
2354
|
}
|
|
2020
2355
|
}
|
|
2021
2356
|
}
|
|
2357
|
+
/**
|
|
2358
|
+
* An alias for the `lookConfig` attribute.
|
|
2359
|
+
* @private
|
|
2360
|
+
*/
|
|
2361
|
+
set endMarkerLook(endMarkerLook) {
|
|
2362
|
+
this.endMarkerLookConfig = endMarkerLook;
|
|
2363
|
+
}
|
|
2364
|
+
/**
|
|
2365
|
+
* Look configuration used to derive the current look of the end marker of this connection.
|
|
2366
|
+
* @private
|
|
2367
|
+
*/
|
|
2368
|
+
get endMarkerLookConfig() {
|
|
2369
|
+
return this._endMarkerLookConfig;
|
|
2370
|
+
}
|
|
2022
2371
|
/**
|
|
2023
2372
|
* Sets the look configuration of the end marker to override the one determined by the type.
|
|
2024
2373
|
* `null` stands for no marker and `undefined` resets it to the one determined by the type.
|
|
2025
2374
|
* @private
|
|
2026
2375
|
*/
|
|
2027
|
-
set
|
|
2028
|
-
|
|
2029
|
-
|
|
2376
|
+
set endMarkerLookConfig(endMarkerLookConfig) {
|
|
2377
|
+
this._endMarkerLookConfig = endMarkerLookConfig;
|
|
2378
|
+
if (endMarkerLookConfig) {
|
|
2379
|
+
const looks = extractLooksFromConfig(endMarkerLookConfig);
|
|
2030
2380
|
this._defaultEndMarkerLook = Object.assign(Object.assign({}, this._defaultEndMarkerLook), looks.defaultLook);
|
|
2031
2381
|
this._selectedEndMarkerLook = Object.assign(Object.assign({}, this._selectedEndMarkerLook), looks.selectedLook);
|
|
2032
2382
|
this._highlightedEndMarkerLook = Object.assign(Object.assign({}, this._highlightedEndMarkerLook), looks.highlightedLook);
|
|
2033
2383
|
this._selectedAndHighlightedEndMarkerLook = Object.assign(Object.assign({}, this._selectedAndHighlightedEndMarkerLook), looks.selectedAndHighlightedLook);
|
|
2034
2384
|
} else {
|
|
2035
|
-
this._defaultEndMarkerLook =
|
|
2036
|
-
this._selectedEndMarkerLook =
|
|
2037
|
-
this._highlightedEndMarkerLook =
|
|
2038
|
-
this._selectedAndHighlightedEndMarkerLook =
|
|
2385
|
+
this._defaultEndMarkerLook = endMarkerLookConfig;
|
|
2386
|
+
this._selectedEndMarkerLook = endMarkerLookConfig;
|
|
2387
|
+
this._highlightedEndMarkerLook = endMarkerLookConfig;
|
|
2388
|
+
this._selectedAndHighlightedEndMarkerLook = endMarkerLookConfig;
|
|
2039
2389
|
}
|
|
2040
2390
|
}
|
|
2041
2391
|
constructor(model, type, start, end, id) {
|
|
@@ -2710,23 +3060,38 @@ class DiagramSection extends DiagramElement {
|
|
|
2710
3060
|
}
|
|
2711
3061
|
}
|
|
2712
3062
|
}
|
|
3063
|
+
/**
|
|
3064
|
+
* An alias for the `lookConfig` attribute.
|
|
3065
|
+
* @private
|
|
3066
|
+
*/
|
|
3067
|
+
set look(look) {
|
|
3068
|
+
this.lookConfig = look;
|
|
3069
|
+
}
|
|
3070
|
+
/**
|
|
3071
|
+
* Look configuration used to derive the current look of this section.
|
|
3072
|
+
* @private
|
|
3073
|
+
*/
|
|
3074
|
+
get lookConfig() {
|
|
3075
|
+
return this._lookConfig;
|
|
3076
|
+
}
|
|
2713
3077
|
/**
|
|
2714
3078
|
* Sets the look configuration of the look to override the one determined by the type.
|
|
2715
3079
|
* `undefined` resets it to the one determined by the type.
|
|
2716
3080
|
* @private
|
|
2717
3081
|
*/
|
|
2718
|
-
set
|
|
2719
|
-
|
|
2720
|
-
|
|
3082
|
+
set lookConfig(lookConfig) {
|
|
3083
|
+
this._lookConfig = lookConfig;
|
|
3084
|
+
if (lookConfig) {
|
|
3085
|
+
const looks = extractLooksFromConfig(lookConfig);
|
|
2721
3086
|
this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
|
|
2722
3087
|
this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
|
|
2723
3088
|
this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
|
|
2724
3089
|
this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
|
|
2725
3090
|
} else {
|
|
2726
|
-
this._defaultLook =
|
|
2727
|
-
this._selectedLook =
|
|
2728
|
-
this._highlightedLook =
|
|
2729
|
-
this._selectedAndHighlightedLook =
|
|
3091
|
+
this._defaultLook = lookConfig;
|
|
3092
|
+
this._selectedLook = lookConfig;
|
|
3093
|
+
this._highlightedLook = lookConfig;
|
|
3094
|
+
this._selectedAndHighlightedLook = lookConfig;
|
|
2730
3095
|
}
|
|
2731
3096
|
}
|
|
2732
3097
|
constructor(model, node, indexXInNode, indexYInNode, coords, width, height, id) {
|
|
@@ -3109,6 +3474,7 @@ const DIAGRAM_NODE_TYPE_DEFAULTS = {
|
|
|
3109
3474
|
minHeight: 1,
|
|
3110
3475
|
resizableX: false,
|
|
3111
3476
|
resizableY: false,
|
|
3477
|
+
snapToGridOffset: [0, 0, 0, 0],
|
|
3112
3478
|
padding: 0,
|
|
3113
3479
|
label: null,
|
|
3114
3480
|
ports: [],
|
|
@@ -3137,6 +3503,7 @@ class DiagramNodeType {
|
|
|
3137
3503
|
this.minHeight = values.minHeight;
|
|
3138
3504
|
this.resizableX = values.resizableX;
|
|
3139
3505
|
this.resizableY = values.resizableY;
|
|
3506
|
+
this.snapToGridOffset = values.snapToGridOffset;
|
|
3140
3507
|
this.bottomPadding = getBottomPadding(values);
|
|
3141
3508
|
this.leftPadding = getLeftPadding(values);
|
|
3142
3509
|
this.rightPadding = getRightPadding(values);
|
|
@@ -3222,23 +3589,38 @@ class DiagramNode extends DiagramElement {
|
|
|
3222
3589
|
}
|
|
3223
3590
|
}
|
|
3224
3591
|
}
|
|
3592
|
+
/**
|
|
3593
|
+
* An alias for the `lookConfig` attribute.
|
|
3594
|
+
* @private
|
|
3595
|
+
*/
|
|
3596
|
+
set look(look) {
|
|
3597
|
+
this.lookConfig = look;
|
|
3598
|
+
}
|
|
3599
|
+
/**
|
|
3600
|
+
* Look configuration used to derive the current look of this node.
|
|
3601
|
+
* @private
|
|
3602
|
+
*/
|
|
3603
|
+
get lookConfig() {
|
|
3604
|
+
return this._lookConfig;
|
|
3605
|
+
}
|
|
3225
3606
|
/**
|
|
3226
3607
|
* Sets the look configuration of the look to override the one determined by the type.
|
|
3227
3608
|
* `undefined` resets it to the one determined by the type.
|
|
3228
3609
|
* @private
|
|
3229
3610
|
*/
|
|
3230
|
-
set
|
|
3231
|
-
|
|
3232
|
-
|
|
3611
|
+
set lookConfig(lookConfig) {
|
|
3612
|
+
this._lookConfig = lookConfig;
|
|
3613
|
+
if (lookConfig) {
|
|
3614
|
+
const looks = extractLooksFromConfig(lookConfig);
|
|
3233
3615
|
this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
|
|
3234
3616
|
this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
|
|
3235
3617
|
this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
|
|
3236
3618
|
this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
|
|
3237
3619
|
} else {
|
|
3238
|
-
this._defaultLook =
|
|
3239
|
-
this._selectedLook =
|
|
3240
|
-
this._highlightedLook =
|
|
3241
|
-
this._selectedAndHighlightedLook =
|
|
3620
|
+
this._defaultLook = lookConfig;
|
|
3621
|
+
this._selectedLook = lookConfig;
|
|
3622
|
+
this._highlightedLook = lookConfig;
|
|
3623
|
+
this._selectedAndHighlightedLook = lookConfig;
|
|
3242
3624
|
}
|
|
3243
3625
|
}
|
|
3244
3626
|
constructor(model, type, coords = [0, 0], id) {
|
|
@@ -4250,23 +4632,38 @@ class DiagramPort extends DiagramElement {
|
|
|
4250
4632
|
}
|
|
4251
4633
|
}
|
|
4252
4634
|
}
|
|
4635
|
+
/**
|
|
4636
|
+
* An alias for the `lookConfig` attribute.
|
|
4637
|
+
* @private
|
|
4638
|
+
*/
|
|
4639
|
+
set look(look) {
|
|
4640
|
+
this.lookConfig = look;
|
|
4641
|
+
}
|
|
4642
|
+
/**
|
|
4643
|
+
* Look configuration used to derive the current look of this port.
|
|
4644
|
+
* @private
|
|
4645
|
+
*/
|
|
4646
|
+
get lookConfig() {
|
|
4647
|
+
return this._lookConfig;
|
|
4648
|
+
}
|
|
4253
4649
|
/**
|
|
4254
4650
|
* Sets the look configuration of the look to override the one determined by the type.
|
|
4255
4651
|
* `undefined` resets it to the one determined by the type.
|
|
4256
4652
|
* @private
|
|
4257
4653
|
*/
|
|
4258
|
-
set
|
|
4259
|
-
|
|
4260
|
-
|
|
4654
|
+
set lookConfig(lookConfig) {
|
|
4655
|
+
this._lookConfig = lookConfig;
|
|
4656
|
+
if (lookConfig) {
|
|
4657
|
+
const looks = extractLooksFromConfig(lookConfig);
|
|
4261
4658
|
this._defaultLook = Object.assign(Object.assign({}, this._defaultLook), looks.defaultLook);
|
|
4262
4659
|
this._selectedLook = Object.assign(Object.assign({}, this._selectedLook), looks.selectedLook);
|
|
4263
4660
|
this._highlightedLook = Object.assign(Object.assign({}, this._highlightedLook), looks.highlightedLook);
|
|
4264
4661
|
this._selectedAndHighlightedLook = Object.assign(Object.assign({}, this._selectedAndHighlightedLook), looks.selectedAndHighlightedLook);
|
|
4265
4662
|
} else {
|
|
4266
|
-
this._defaultLook =
|
|
4267
|
-
this._selectedLook =
|
|
4268
|
-
this._highlightedLook =
|
|
4269
|
-
this._selectedAndHighlightedLook =
|
|
4663
|
+
this._defaultLook = lookConfig;
|
|
4664
|
+
this._selectedLook = lookConfig;
|
|
4665
|
+
this._highlightedLook = lookConfig;
|
|
4666
|
+
this._selectedAndHighlightedLook = lookConfig;
|
|
4270
4667
|
}
|
|
4271
4668
|
}
|
|
4272
4669
|
/**
|
|
@@ -6708,12 +7105,12 @@ class DagaExporter {
|
|
|
6708
7105
|
}
|
|
6709
7106
|
|
|
6710
7107
|
/**
|
|
6711
|
-
* Text to display as the title of the property editor when editing the properties of a diagram's value set.
|
|
7108
|
+
* Text to display by default as the title of the property editor when editing the properties of a diagram's value set.
|
|
6712
7109
|
* @private
|
|
6713
7110
|
* @see PropertyEditorComponent
|
|
6714
7111
|
* @see ValueSet
|
|
6715
7112
|
*/
|
|
6716
|
-
const
|
|
7113
|
+
const DIAGRAM_PROPERTIES_DEFAULT_TEXT = 'Diagram properties';
|
|
6717
7114
|
/**
|
|
6718
7115
|
* Stores the functionality regarding the user highlight of a diagram canvas.
|
|
6719
7116
|
* @public
|
|
@@ -6725,12 +7122,14 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
6725
7122
|
* @public
|
|
6726
7123
|
* @param canvas A canvas.
|
|
6727
7124
|
*/
|
|
6728
|
-
constructor(canvas) {
|
|
7125
|
+
constructor(canvas, diagramPropertiesText) {
|
|
6729
7126
|
super();
|
|
6730
7127
|
this.canvas = canvas;
|
|
6731
7128
|
this.canvas.propertyEditorChanges$.pipe(rxjs.debounceTime(2000)).subscribe(() => {
|
|
6732
7129
|
this.makeUpdateValuesAction();
|
|
6733
7130
|
});
|
|
7131
|
+
console.log(diagramPropertiesText);
|
|
7132
|
+
this.diagramPropertiesText = diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT;
|
|
6734
7133
|
}
|
|
6735
7134
|
add(element) {
|
|
6736
7135
|
if (this.contains(element.id)) {
|
|
@@ -6925,7 +7324,7 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
6925
7324
|
propertyEditor.valueSet = undefined;
|
|
6926
7325
|
propertyEditor.valueSet = selectedValueSet;
|
|
6927
7326
|
} else {
|
|
6928
|
-
propertyEditor.title =
|
|
7327
|
+
propertyEditor.title = this.diagramPropertiesText;
|
|
6929
7328
|
// force the update of the valueSet
|
|
6930
7329
|
propertyEditor.valueSet = undefined;
|
|
6931
7330
|
propertyEditor.valueSet = selectedValueSet;
|
|
@@ -7015,7 +7414,7 @@ class DiagramCanvas {
|
|
|
7015
7414
|
* @param config The configuration object used to set the parameters of this canvas.
|
|
7016
7415
|
*/
|
|
7017
7416
|
constructor(parentComponent, config) {
|
|
7018
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
7417
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
7019
7418
|
this.backgroundPatternId = `daga-background-pattern-id-${DiagramCanvas.canvasCount++}`;
|
|
7020
7419
|
this.zoomTransform = d3__namespace.zoomIdentity;
|
|
7021
7420
|
// used to distinguish drags from clicks when dragging elements and during multiple selection
|
|
@@ -7030,25 +7429,25 @@ class DiagramCanvas {
|
|
|
7030
7429
|
this.propertyEditorChanges$ = new rxjs.Subject();
|
|
7031
7430
|
this.parentComponent = parentComponent;
|
|
7032
7431
|
this.model = new DiagramModel(this, undefined, config.name || 'unnamed', '', config.type || '', config.properties || []);
|
|
7033
|
-
this.userSelection = new DiagramUserSelection(this);
|
|
7034
|
-
this.userHighlight = new DiagramUserHighlight(this, ((
|
|
7035
|
-
this.contextMenu = new DiagramContextMenu(this, (
|
|
7036
|
-
this.backgroundColor = ((
|
|
7037
|
-
this.gridStyle = (
|
|
7038
|
-
this.gridSize = ((
|
|
7039
|
-
this.gridThickness = Math.abs(((
|
|
7040
|
-
this.gridColor = ((
|
|
7041
|
-
this.snapToGrid = ((
|
|
7042
|
-
this.zoomFactor = ((
|
|
7043
|
-
this.panRate = ((
|
|
7044
|
-
this.inferConnectionType = ((
|
|
7045
|
-
this.autoTightenConnections = ((
|
|
7046
|
-
this.allowConnectionLoops = ((
|
|
7047
|
-
this.allowSharingPorts = ((
|
|
7048
|
-
this.allowSharingBothPorts = ((
|
|
7049
|
-
this.portHighlightRadius = ((
|
|
7432
|
+
this.userSelection = new DiagramUserSelection(this, (_b = (_a = config.components) === null || _a === void 0 ? void 0 : _a.propertyEditor) === null || _b === void 0 ? void 0 : _b.title);
|
|
7433
|
+
this.userHighlight = new DiagramUserHighlight(this, ((_c = config.canvas) === null || _c === void 0 ? void 0 : _c.highlightSections) !== false);
|
|
7434
|
+
this.contextMenu = new DiagramContextMenu(this, (_d = config.canvas) === null || _d === void 0 ? void 0 : _d.contextMenu);
|
|
7435
|
+
this.backgroundColor = ((_e = config.canvas) === null || _e === void 0 ? void 0 : _e.backgroundColor) || '#FFFFFF';
|
|
7436
|
+
this.gridStyle = (_h = (_g = (_f = config.canvas) === null || _f === void 0 ? void 0 : _f.grid) === null || _g === void 0 ? void 0 : _g.style) !== null && _h !== void 0 ? _h : GRID_DEFAULTS.style;
|
|
7437
|
+
this.gridSize = ((_k = (_j = config.canvas) === null || _j === void 0 ? void 0 : _j.grid) === null || _k === void 0 ? void 0 : _k.enabled) === false || ((_l = config.canvas) === null || _l === void 0 ? void 0 : _l.grid) === undefined ? 0 : Math.abs(((_o = (_m = config.canvas) === null || _m === void 0 ? void 0 : _m.grid) === null || _o === void 0 ? void 0 : _o.spacing) || GRID_DEFAULTS.spacing);
|
|
7438
|
+
this.gridThickness = Math.abs(((_q = (_p = config.canvas) === null || _p === void 0 ? void 0 : _p.grid) === null || _q === void 0 ? void 0 : _q.thickness) || GRID_DEFAULTS.thickness);
|
|
7439
|
+
this.gridColor = ((_s = (_r = config.canvas) === null || _r === void 0 ? void 0 : _r.grid) === null || _s === void 0 ? void 0 : _s.color) || GRID_DEFAULTS.color;
|
|
7440
|
+
this.snapToGrid = ((_u = (_t = config.canvas) === null || _t === void 0 ? void 0 : _t.grid) === null || _u === void 0 ? void 0 : _u.enabled) === false || ((_v = config.canvas) === null || _v === void 0 ? void 0 : _v.grid) === undefined ? false : ((_x = (_w = config.canvas) === null || _w === void 0 ? void 0 : _w.grid) === null || _x === void 0 ? void 0 : _x.snap) || GRID_DEFAULTS.snap;
|
|
7441
|
+
this.zoomFactor = ((_y = config.canvas) === null || _y === void 0 ? void 0 : _y.zoomFactor) || 2;
|
|
7442
|
+
this.panRate = ((_z = config.canvas) === null || _z === void 0 ? void 0 : _z.panRate) || 100;
|
|
7443
|
+
this.inferConnectionType = ((_0 = config.connectionSettings) === null || _0 === void 0 ? void 0 : _0.inferConnectionType) || false;
|
|
7444
|
+
this.autoTightenConnections = ((_1 = config.connectionSettings) === null || _1 === void 0 ? void 0 : _1.autoTighten) !== false;
|
|
7445
|
+
this.allowConnectionLoops = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.allowLoops) || false;
|
|
7446
|
+
this.allowSharingPorts = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.sharePorts) !== false;
|
|
7447
|
+
this.allowSharingBothPorts = ((_4 = config.connectionSettings) === null || _4 === void 0 ? void 0 : _4.shareBothPorts) || false;
|
|
7448
|
+
this.portHighlightRadius = ((_5 = config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.portHighlightRadius) || 100;
|
|
7050
7449
|
this.multipleSelectionOn = false;
|
|
7051
|
-
this.priorityThresholds = ((
|
|
7450
|
+
this.priorityThresholds = ((_6 = config.canvas) === null || _6 === void 0 ? void 0 : _6.priorityThresholds) || [];
|
|
7052
7451
|
this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
|
|
7053
7452
|
this.layoutFormat = config.layoutFormat;
|
|
7054
7453
|
this.userActions = config.userActions || {};
|
|
@@ -7075,7 +7474,7 @@ class DiagramCanvas {
|
|
|
7075
7474
|
const connectionType = new DiagramConnectionType(Object.assign(Object.assign({}, config.connectionTypeDefaults), connectionTypeConfig));
|
|
7076
7475
|
this.model.connections.types.add(connectionType);
|
|
7077
7476
|
}
|
|
7078
|
-
this._connectionType = ((
|
|
7477
|
+
this._connectionType = ((_7 = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _7 === void 0 ? void 0 : _7.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined;
|
|
7079
7478
|
}
|
|
7080
7479
|
}
|
|
7081
7480
|
addValidator(validator) {
|
|
@@ -7302,8 +7701,8 @@ class DiagramCanvas {
|
|
|
7302
7701
|
const deselectedElements = this.userSelection.all();
|
|
7303
7702
|
this.userSelection.clear();
|
|
7304
7703
|
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
7305
|
-
this.userSelection.openInPropertyEditor(this.model);
|
|
7306
7704
|
}
|
|
7705
|
+
this.userSelection.openInPropertyEditor(this.model);
|
|
7307
7706
|
}).call(d3__namespace.drag().filter(event => {
|
|
7308
7707
|
return this.multipleSelectionOn || isSecondaryButton(event);
|
|
7309
7708
|
}).on(exports.DragEvents.Start, event => {
|
|
@@ -7510,7 +7909,9 @@ class DiagramCanvas {
|
|
|
7510
7909
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.type.resizableX && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
|
|
7511
7910
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7512
7911
|
if (this.snapToGrid) {
|
|
7513
|
-
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
7912
|
+
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
7913
|
+
pointerCoords[0] += d.type.snapToGridOffset[0];
|
|
7914
|
+
pointerCoords[1] += d.type.snapToGridOffset[1];
|
|
7514
7915
|
}
|
|
7515
7916
|
d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
|
|
7516
7917
|
this.currentAction.to = d.getGeometry();
|
|
@@ -7544,7 +7945,9 @@ class DiagramCanvas {
|
|
|
7544
7945
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.type.resizableY && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
|
|
7545
7946
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7546
7947
|
if (this.snapToGrid) {
|
|
7547
|
-
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
7948
|
+
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
7949
|
+
pointerCoords[0] += d.type.snapToGridOffset[0];
|
|
7950
|
+
pointerCoords[1] += d.type.snapToGridOffset[1];
|
|
7548
7951
|
}
|
|
7549
7952
|
d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
|
|
7550
7953
|
this.currentAction.to = d.getGeometry();
|
|
@@ -7578,7 +7981,9 @@ class DiagramCanvas {
|
|
|
7578
7981
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.type.resizableX && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
|
|
7579
7982
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7580
7983
|
if (this.snapToGrid) {
|
|
7581
|
-
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
7984
|
+
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
|
|
7985
|
+
pointerCoords[0] += d.type.snapToGridOffset[2];
|
|
7986
|
+
pointerCoords[1] += d.type.snapToGridOffset[3];
|
|
7582
7987
|
}
|
|
7583
7988
|
d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
7584
7989
|
this.currentAction.to = d.getGeometry();
|
|
@@ -7612,7 +8017,11 @@ class DiagramCanvas {
|
|
|
7612
8017
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.type.resizableY && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
|
|
7613
8018
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7614
8019
|
if (this.snapToGrid) {
|
|
7615
|
-
|
|
8020
|
+
if (this.snapToGrid) {
|
|
8021
|
+
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
|
|
8022
|
+
pointerCoords[0] += d.type.snapToGridOffset[2];
|
|
8023
|
+
pointerCoords[1] += d.type.snapToGridOffset[3];
|
|
8024
|
+
}
|
|
7616
8025
|
}
|
|
7617
8026
|
d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
7618
8027
|
this.currentAction.to = d.getGeometry();
|
|
@@ -8862,7 +9271,9 @@ class DiagramCanvas {
|
|
|
8862
9271
|
if (this.draggingFrom[0] !== event.x || this.draggingFrom[1] !== event.y) {
|
|
8863
9272
|
let newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
8864
9273
|
if (this.snapToGrid) {
|
|
8865
|
-
newNodeCoords = this.getClosestGridPoint(newNodeCoords);
|
|
9274
|
+
newNodeCoords = this.getClosestGridPoint([newNodeCoords[0] - d.type.snapToGridOffset[0], newNodeCoords[1] - d.type.snapToGridOffset[1]]);
|
|
9275
|
+
newNodeCoords[0] += d.type.snapToGridOffset[0];
|
|
9276
|
+
newNodeCoords[1] += d.type.snapToGridOffset[1];
|
|
8866
9277
|
}
|
|
8867
9278
|
if (this.currentAction instanceof MoveAction) {
|
|
8868
9279
|
const movingFrom = this.currentAction.delta;
|
|
@@ -9556,7 +9967,9 @@ class ForceLayout {
|
|
|
9556
9967
|
}
|
|
9557
9968
|
if (model.canvas && model.canvas.snapToGrid) {
|
|
9558
9969
|
for (const node of model.nodes) {
|
|
9559
|
-
const snappedCoords = model.canvas.getClosestGridPoint(node.coords);
|
|
9970
|
+
const snappedCoords = model.canvas.getClosestGridPoint([node.coords[0] - node.type.snapToGridOffset[0], node.coords[1] - node.type.snapToGridOffset[1]]);
|
|
9971
|
+
snappedCoords[0] += node.type.snapToGridOffset[0];
|
|
9972
|
+
snappedCoords[1] += node.type.snapToGridOffset[1];
|
|
9560
9973
|
node.move(snappedCoords);
|
|
9561
9974
|
}
|
|
9562
9975
|
}
|