@metadev/daga 1.5.5 → 1.5.6
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 +9 -0
- package/fesm2022/metadev-daga.mjs +593 -181
- package/fesm2022/metadev-daga.mjs.map +1 -1
- package/index.d.ts +2 -1
- package/lib/diagram-editor/diagram/diagram-config.d.ts +4 -4
- package/lib/diagram-editor/diagram/diagram-connection.d.ts +3 -2
- package/lib/diagram-editor/diagram/diagram-decorator.d.ts +2 -2
- package/lib/diagram-editor/diagram/diagram-element.d.ts +16 -91
- package/lib/diagram-editor/diagram/diagram-entity.d.ts +109 -0
- package/lib/diagram-editor/diagram/diagram-field.d.ts +11 -2
- package/lib/diagram-editor/diagram/diagram-node.d.ts +7 -6
- package/lib/diagram-editor/diagram/diagram-object.d.ts +2 -2
- package/lib/diagram-editor/diagram/diagram-port.d.ts +2 -2
- package/lib/diagram-editor/diagram/diagram-section.d.ts +5 -5
- package/package.json +1 -1
|
@@ -655,60 +655,6 @@ const addIfNotExists = (arr, obj) => {
|
|
|
655
655
|
return arr;
|
|
656
656
|
};
|
|
657
657
|
|
|
658
|
-
/**
|
|
659
|
-
* Default priority value for diagram elements.
|
|
660
|
-
* @private
|
|
661
|
-
*/
|
|
662
|
-
const DEFAULT_PRIORITY = 0;
|
|
663
|
-
/**
|
|
664
|
-
* Represents an object which exists as part of a specific diagram model and has a visual representation in a diagram canvas.
|
|
665
|
-
* @public
|
|
666
|
-
* @see DiagramModel
|
|
667
|
-
* @see DiagramCanvas
|
|
668
|
-
*/
|
|
669
|
-
class DiagramElement {
|
|
670
|
-
get id() {
|
|
671
|
-
return this._id;
|
|
672
|
-
}
|
|
673
|
-
constructor(model, id) {
|
|
674
|
-
/**
|
|
675
|
-
* Whether this diagram element is currently highlighted by the user.
|
|
676
|
-
* @private
|
|
677
|
-
*/
|
|
678
|
-
this.highlighted = false;
|
|
679
|
-
/**
|
|
680
|
-
* Whether this diagram element is currently selected by the user.
|
|
681
|
-
* @private
|
|
682
|
-
*/
|
|
683
|
-
this.selected = false;
|
|
684
|
-
/**
|
|
685
|
-
* Whether this diagram element has itself been explicitly removed.
|
|
686
|
-
*
|
|
687
|
-
* Override the `removed` getter so that it returns true if and only if:
|
|
688
|
-
* - `selfRemoved` is true, or
|
|
689
|
-
* - `removed` is true for any of this element's dependencies.
|
|
690
|
-
*
|
|
691
|
-
* For example, a DiagramConnection is removed if either of its ports are removed,
|
|
692
|
-
* even if the connection's own `selfRemoved` field is false.
|
|
693
|
-
* @private
|
|
694
|
-
*/
|
|
695
|
-
this.selfRemoved = false;
|
|
696
|
-
/**
|
|
697
|
-
* Collaborative timestamp for selfRemoved.
|
|
698
|
-
* @private
|
|
699
|
-
*/
|
|
700
|
-
this.selfRemovedTimestamp = null;
|
|
701
|
-
this.model = model;
|
|
702
|
-
this._id = id;
|
|
703
|
-
}
|
|
704
|
-
/**
|
|
705
|
-
* Obtain the selection of this element.
|
|
706
|
-
* @private
|
|
707
|
-
*/
|
|
708
|
-
select() {
|
|
709
|
-
return this.model.canvas?.selectCanvasView()?.select(`g#${this.id}`);
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
658
|
/**
|
|
713
659
|
* Represents a collection of diagram entities of a type that exists as part of a diagram model.
|
|
714
660
|
* @public
|
|
@@ -729,11 +675,11 @@ class DiagramEntitySet {
|
|
|
729
675
|
this.entityMap = {};
|
|
730
676
|
}
|
|
731
677
|
/**
|
|
732
|
-
* The number of entities
|
|
678
|
+
* The number of entities in this set.
|
|
733
679
|
* @public
|
|
734
680
|
*/
|
|
735
681
|
get length() {
|
|
736
|
-
return this.
|
|
682
|
+
return this.size();
|
|
737
683
|
}
|
|
738
684
|
/**
|
|
739
685
|
* Gets all of the entities of this set.
|
|
@@ -774,6 +720,14 @@ class DiagramEntitySet {
|
|
|
774
720
|
contains(id) {
|
|
775
721
|
return this.entityMap[id] !== undefined;
|
|
776
722
|
}
|
|
723
|
+
/**
|
|
724
|
+
* Counts the number of entities of this set following the given criteria.
|
|
725
|
+
* @public
|
|
726
|
+
* @returns The number of entities of this set following the given criteria.
|
|
727
|
+
*/
|
|
728
|
+
count(predicate) {
|
|
729
|
+
return this.entities.filter(predicate).length;
|
|
730
|
+
}
|
|
777
731
|
/**
|
|
778
732
|
* Gets all of the entities of this set filtered following given criteria.
|
|
779
733
|
* @public
|
|
@@ -799,6 +753,14 @@ class DiagramEntitySet {
|
|
|
799
753
|
get(id) {
|
|
800
754
|
return this.entityMap[id];
|
|
801
755
|
}
|
|
756
|
+
/**
|
|
757
|
+
* Gets all of the entities of this set mapped to the result of the given function applied to them.
|
|
758
|
+
* @public
|
|
759
|
+
* @returns An array containing the entities of this set that meet the given criteria.
|
|
760
|
+
*/
|
|
761
|
+
map(callback) {
|
|
762
|
+
return this.entities.map(callback);
|
|
763
|
+
}
|
|
802
764
|
/**
|
|
803
765
|
* Attempts to find and remove an entity with the given id. Has no effect if there are no entities with the given id.
|
|
804
766
|
* @public
|
|
@@ -811,15 +773,159 @@ class DiagramEntitySet {
|
|
|
811
773
|
removeIfExists(this.entities, entity);
|
|
812
774
|
}
|
|
813
775
|
}
|
|
776
|
+
/**
|
|
777
|
+
* Gets the number of entities in this set.
|
|
778
|
+
* @public
|
|
779
|
+
*/
|
|
780
|
+
size() {
|
|
781
|
+
return this.entities.length;
|
|
782
|
+
}
|
|
814
783
|
/**
|
|
815
784
|
* Iterator to iterate over the entities of this set.
|
|
816
785
|
* @public
|
|
817
786
|
*/
|
|
818
787
|
*[Symbol.iterator]() {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
788
|
+
for (const entity of this.entities) {
|
|
789
|
+
yield entity;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Default priority value for diagram elements.
|
|
796
|
+
* @private
|
|
797
|
+
*/
|
|
798
|
+
const DEFAULT_PRIORITY = 0;
|
|
799
|
+
/**
|
|
800
|
+
* Represents an object which exists as part of a specific diagram model and has a visual representation in a diagram canvas.
|
|
801
|
+
* @public
|
|
802
|
+
* @see DiagramModel
|
|
803
|
+
* @see DiagramCanvas
|
|
804
|
+
*/
|
|
805
|
+
class DiagramElement {
|
|
806
|
+
get id() {
|
|
807
|
+
return this._id;
|
|
808
|
+
}
|
|
809
|
+
constructor(model, id) {
|
|
810
|
+
/**
|
|
811
|
+
* Whether this diagram element is currently highlighted by the user.
|
|
812
|
+
* @private
|
|
813
|
+
*/
|
|
814
|
+
this.highlighted = false;
|
|
815
|
+
/**
|
|
816
|
+
* Whether this diagram element is currently selected by the user.
|
|
817
|
+
* @private
|
|
818
|
+
*/
|
|
819
|
+
this.selected = false;
|
|
820
|
+
/**
|
|
821
|
+
* Whether this diagram element has itself been explicitly removed.
|
|
822
|
+
*
|
|
823
|
+
* Override the `removed` getter so that it returns true if and only if:
|
|
824
|
+
* - `selfRemoved` is true, or
|
|
825
|
+
* - `removed` is true for any of this element's dependencies.
|
|
826
|
+
*
|
|
827
|
+
* For example, a DiagramConnection is removed if either of its ports are removed,
|
|
828
|
+
* even if the connection's own `selfRemoved` field is false.
|
|
829
|
+
* @private
|
|
830
|
+
*/
|
|
831
|
+
this.selfRemoved = false;
|
|
832
|
+
/**
|
|
833
|
+
* Collaborative timestamp for selfRemoved.
|
|
834
|
+
* @private
|
|
835
|
+
*/
|
|
836
|
+
this.selfRemovedTimestamp = null;
|
|
837
|
+
this.model = model;
|
|
838
|
+
this._id = id;
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Obtain the selection of this element.
|
|
842
|
+
* @private
|
|
843
|
+
*/
|
|
844
|
+
select() {
|
|
845
|
+
return this.model.canvas?.selectCanvasView()?.select(`g#${this.id}`);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
class DiagramElementSet extends DiagramEntitySet {
|
|
849
|
+
all(includeRemoved = false) {
|
|
850
|
+
if (includeRemoved) {
|
|
851
|
+
return super.all();
|
|
852
|
+
}
|
|
853
|
+
else {
|
|
854
|
+
return super.filter((e) => !e.removed);
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
contains(id, includeRemoved = false) {
|
|
858
|
+
if (includeRemoved) {
|
|
859
|
+
return super.contains(id);
|
|
860
|
+
}
|
|
861
|
+
else {
|
|
862
|
+
return super.contains(id) && !this.entityMap[id].removed;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
count(predicate, includeRemoved = false) {
|
|
866
|
+
if (includeRemoved) {
|
|
867
|
+
return super.count(predicate);
|
|
868
|
+
}
|
|
869
|
+
else {
|
|
870
|
+
return super.count((e, i, a) => predicate(e, i, a) && !e.removed);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
filter(predicate, includeRemoved = false) {
|
|
874
|
+
if (includeRemoved) {
|
|
875
|
+
return super.filter(predicate);
|
|
876
|
+
}
|
|
877
|
+
else {
|
|
878
|
+
return super.filter((e, i, a) => predicate(e, i, a) && !e.removed);
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
find(predicate, includeRemoved = false) {
|
|
882
|
+
if (includeRemoved) {
|
|
883
|
+
return super.find(predicate);
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
return super.find((e, i, a) => predicate(e, i, a) && !e.removed);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
get(id, includeRemoved = false) {
|
|
890
|
+
if (includeRemoved) {
|
|
891
|
+
return super.get(id);
|
|
892
|
+
}
|
|
893
|
+
else {
|
|
894
|
+
return super.contains(id) && !this.entityMap[id].removed
|
|
895
|
+
? super.get(id)
|
|
896
|
+
: undefined;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
map(callback, includeRemoved = false) {
|
|
900
|
+
if (includeRemoved) {
|
|
901
|
+
return super.map(callback);
|
|
902
|
+
}
|
|
903
|
+
else {
|
|
904
|
+
return super.filter((e) => !e.removed).map(callback);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Gets the number of entities in this set.
|
|
909
|
+
* @public
|
|
910
|
+
*/
|
|
911
|
+
size(includeRemoved = false) {
|
|
912
|
+
if (includeRemoved) {
|
|
913
|
+
return super.size();
|
|
914
|
+
}
|
|
915
|
+
else {
|
|
916
|
+
return super.filter((e) => !e.removed).length;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
*[Symbol.iterator](includeRemoved = false) {
|
|
920
|
+
if (includeRemoved) {
|
|
921
|
+
for (const entity of this.entities) {
|
|
922
|
+
yield entity;
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
else {
|
|
926
|
+
for (const entity of this.entities.filter((e) => !e.removed)) {
|
|
927
|
+
yield entity;
|
|
928
|
+
}
|
|
823
929
|
}
|
|
824
930
|
}
|
|
825
931
|
}
|
|
@@ -1692,7 +1798,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
1692
1798
|
}
|
|
1693
1799
|
}
|
|
1694
1800
|
}
|
|
1695
|
-
class DiagramConnectionSet extends
|
|
1801
|
+
class DiagramConnectionSet extends DiagramElementSet {
|
|
1696
1802
|
/**
|
|
1697
1803
|
* Instance a set of connections for the given model. This method is used internally.
|
|
1698
1804
|
* @private
|
|
@@ -2263,10 +2369,13 @@ class DiagramSection extends DiagramElement {
|
|
|
2263
2369
|
* @public
|
|
2264
2370
|
* @returns A list of connections.
|
|
2265
2371
|
*/
|
|
2266
|
-
getIncomingConnections() {
|
|
2372
|
+
getIncomingConnections(includeRemoved = false) {
|
|
2267
2373
|
const result = [];
|
|
2268
2374
|
for (const port of this.ports) {
|
|
2269
2375
|
for (const incomingConnection of port.incomingConnections) {
|
|
2376
|
+
if (!includeRemoved && incomingConnection.removed) {
|
|
2377
|
+
continue;
|
|
2378
|
+
}
|
|
2270
2379
|
result.push(incomingConnection);
|
|
2271
2380
|
}
|
|
2272
2381
|
}
|
|
@@ -2277,10 +2386,13 @@ class DiagramSection extends DiagramElement {
|
|
|
2277
2386
|
* @public
|
|
2278
2387
|
* @returns A list of connections.
|
|
2279
2388
|
*/
|
|
2280
|
-
getOutgoingConnections() {
|
|
2389
|
+
getOutgoingConnections(includeRemoved = false) {
|
|
2281
2390
|
const result = [];
|
|
2282
2391
|
for (const port of this.ports) {
|
|
2283
2392
|
for (const outgoingConnection of port.outgoingConnections) {
|
|
2393
|
+
if (!includeRemoved && outgoingConnection.removed) {
|
|
2394
|
+
continue;
|
|
2395
|
+
}
|
|
2284
2396
|
result.push(outgoingConnection);
|
|
2285
2397
|
}
|
|
2286
2398
|
}
|
|
@@ -2291,13 +2403,19 @@ class DiagramSection extends DiagramElement {
|
|
|
2291
2403
|
* @public
|
|
2292
2404
|
* @returns A list of connections.
|
|
2293
2405
|
*/
|
|
2294
|
-
getConnections() {
|
|
2406
|
+
getConnections(includeRemoved = false) {
|
|
2295
2407
|
const result = [];
|
|
2296
2408
|
for (const port of this.ports) {
|
|
2297
2409
|
for (const incomingConnection of port.incomingConnections) {
|
|
2410
|
+
if (!includeRemoved && incomingConnection.removed) {
|
|
2411
|
+
continue;
|
|
2412
|
+
}
|
|
2298
2413
|
result.push(incomingConnection);
|
|
2299
2414
|
}
|
|
2300
2415
|
for (const outgoingConnection of port.outgoingConnections) {
|
|
2416
|
+
if (!includeRemoved && outgoingConnection.removed) {
|
|
2417
|
+
continue;
|
|
2418
|
+
}
|
|
2301
2419
|
result.push(outgoingConnection);
|
|
2302
2420
|
}
|
|
2303
2421
|
}
|
|
@@ -2392,13 +2510,17 @@ class DiagramSection extends DiagramElement {
|
|
|
2392
2510
|
// Set label's dimensions as a function of ours.
|
|
2393
2511
|
if (this.label) {
|
|
2394
2512
|
this.label.coords = [
|
|
2395
|
-
this.coords[0] + (this.getConfig()?.label
|
|
2396
|
-
this.coords[1] + (this.getConfig()?.label
|
|
2513
|
+
this.coords[0] + getLeftMargin(this.getConfig()?.label),
|
|
2514
|
+
this.coords[1] + getTopMargin(this.getConfig()?.label)
|
|
2397
2515
|
];
|
|
2398
|
-
|
|
2399
|
-
this.width -
|
|
2400
|
-
|
|
2401
|
-
|
|
2516
|
+
this.label.width =
|
|
2517
|
+
this.width -
|
|
2518
|
+
getLeftMargin(this.getConfig()?.label) -
|
|
2519
|
+
getRightMargin(this.getConfig()?.label);
|
|
2520
|
+
this.label.height =
|
|
2521
|
+
this.height -
|
|
2522
|
+
getTopMargin(this.getConfig()?.label) -
|
|
2523
|
+
getBottomMargin(this.getConfig()?.label);
|
|
2402
2524
|
this.label.updateInView();
|
|
2403
2525
|
}
|
|
2404
2526
|
// Move decorators to match the new coords.
|
|
@@ -2410,7 +2532,7 @@ class DiagramSection extends DiagramElement {
|
|
|
2410
2532
|
this.updateInView();
|
|
2411
2533
|
}
|
|
2412
2534
|
}
|
|
2413
|
-
class DiagramSectionSet extends
|
|
2535
|
+
class DiagramSectionSet extends DiagramElementSet {
|
|
2414
2536
|
/**
|
|
2415
2537
|
* Instance a set of sections for the given model. This method is used internally.
|
|
2416
2538
|
* @private
|
|
@@ -2480,9 +2602,13 @@ class DiagramSectionSet extends DiagramEntitySet {
|
|
|
2480
2602
|
...sectionLabel
|
|
2481
2603
|
};
|
|
2482
2604
|
this.model.fields.new(section, [
|
|
2483
|
-
section.coords[0] + labelConfiguration
|
|
2484
|
-
section.coords[1] + labelConfiguration
|
|
2485
|
-
], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, section.width -
|
|
2605
|
+
section.coords[0] + getLeftMargin(labelConfiguration),
|
|
2606
|
+
section.coords[1] + getTopMargin(labelConfiguration)
|
|
2607
|
+
], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, section.width -
|
|
2608
|
+
getLeftMargin(labelConfiguration) -
|
|
2609
|
+
getRightMargin(labelConfiguration), section.height -
|
|
2610
|
+
getTopMargin(labelConfiguration) -
|
|
2611
|
+
getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
2486
2612
|
}
|
|
2487
2613
|
return section;
|
|
2488
2614
|
}
|
|
@@ -2656,10 +2782,13 @@ class DiagramNode extends DiagramElement {
|
|
|
2656
2782
|
* @public
|
|
2657
2783
|
* @returns A list of connections.
|
|
2658
2784
|
*/
|
|
2659
|
-
getIncomingConnections() {
|
|
2785
|
+
getIncomingConnections(includeRemoved = false) {
|
|
2660
2786
|
const result = [];
|
|
2661
2787
|
for (const port of this.ports) {
|
|
2662
2788
|
for (const incomingConnection of port.incomingConnections) {
|
|
2789
|
+
if (!includeRemoved && incomingConnection.removed) {
|
|
2790
|
+
continue;
|
|
2791
|
+
}
|
|
2663
2792
|
result.push(incomingConnection);
|
|
2664
2793
|
}
|
|
2665
2794
|
}
|
|
@@ -2670,10 +2799,13 @@ class DiagramNode extends DiagramElement {
|
|
|
2670
2799
|
* @public
|
|
2671
2800
|
* @returns A list of connections.
|
|
2672
2801
|
*/
|
|
2673
|
-
getOutgoingConnections() {
|
|
2802
|
+
getOutgoingConnections(includeRemoved = false) {
|
|
2674
2803
|
const result = [];
|
|
2675
2804
|
for (const port of this.ports) {
|
|
2676
2805
|
for (const outgoingConnection of port.outgoingConnections) {
|
|
2806
|
+
if (!includeRemoved && outgoingConnection.removed) {
|
|
2807
|
+
continue;
|
|
2808
|
+
}
|
|
2677
2809
|
result.push(outgoingConnection);
|
|
2678
2810
|
}
|
|
2679
2811
|
}
|
|
@@ -2684,13 +2816,19 @@ class DiagramNode extends DiagramElement {
|
|
|
2684
2816
|
* @public
|
|
2685
2817
|
* @returns A list of connections.
|
|
2686
2818
|
*/
|
|
2687
|
-
getConnections() {
|
|
2819
|
+
getConnections(includeRemoved = false) {
|
|
2688
2820
|
const result = [];
|
|
2689
2821
|
for (const port of this.ports) {
|
|
2690
2822
|
for (const incomingConnection of port.incomingConnections) {
|
|
2823
|
+
if (!includeRemoved && incomingConnection.removed) {
|
|
2824
|
+
continue;
|
|
2825
|
+
}
|
|
2691
2826
|
result.push(incomingConnection);
|
|
2692
2827
|
}
|
|
2693
2828
|
for (const outgoingConnection of port.outgoingConnections) {
|
|
2829
|
+
if (!includeRemoved && outgoingConnection.removed) {
|
|
2830
|
+
continue;
|
|
2831
|
+
}
|
|
2694
2832
|
result.push(outgoingConnection);
|
|
2695
2833
|
}
|
|
2696
2834
|
}
|
|
@@ -2701,18 +2839,30 @@ class DiagramNode extends DiagramElement {
|
|
|
2701
2839
|
* @public
|
|
2702
2840
|
* @returns A list of nodes.
|
|
2703
2841
|
*/
|
|
2704
|
-
getAdjacentNodes() {
|
|
2842
|
+
getAdjacentNodes(includeRemoved = false) {
|
|
2705
2843
|
const result = [];
|
|
2706
2844
|
for (const port of this.ports) {
|
|
2707
2845
|
for (const incomingConnection of port.incomingConnections) {
|
|
2846
|
+
if (!includeRemoved && incomingConnection.removed) {
|
|
2847
|
+
continue;
|
|
2848
|
+
}
|
|
2708
2849
|
const otherNode = incomingConnection.start?.getNode();
|
|
2709
2850
|
if (otherNode) {
|
|
2851
|
+
if (!includeRemoved && otherNode.removed) {
|
|
2852
|
+
continue;
|
|
2853
|
+
}
|
|
2710
2854
|
result.push(otherNode);
|
|
2711
2855
|
}
|
|
2712
2856
|
}
|
|
2713
2857
|
for (const outgoingConnection of port.outgoingConnections) {
|
|
2858
|
+
if (!includeRemoved && outgoingConnection.removed) {
|
|
2859
|
+
continue;
|
|
2860
|
+
}
|
|
2714
2861
|
const otherNode = outgoingConnection.end?.getNode();
|
|
2715
2862
|
if (otherNode) {
|
|
2863
|
+
if (!includeRemoved && otherNode.removed) {
|
|
2864
|
+
continue;
|
|
2865
|
+
}
|
|
2716
2866
|
result.push(otherNode);
|
|
2717
2867
|
}
|
|
2718
2868
|
}
|
|
@@ -2920,11 +3070,17 @@ class DiagramNode extends DiagramElement {
|
|
|
2920
3070
|
// Set label's dimensions as a function of ours.
|
|
2921
3071
|
if (this.label) {
|
|
2922
3072
|
this.label.coords = [
|
|
2923
|
-
this.coords[0] + (this.type.label
|
|
2924
|
-
this.coords[1] + (this.type.label
|
|
3073
|
+
this.coords[0] + getLeftMargin(this.type.label),
|
|
3074
|
+
this.coords[1] + getTopMargin(this.type.label)
|
|
2925
3075
|
];
|
|
2926
|
-
|
|
2927
|
-
|
|
3076
|
+
this.label.width =
|
|
3077
|
+
this.width -
|
|
3078
|
+
getLeftMargin(this.type.label) -
|
|
3079
|
+
getRightMargin(this.type.label);
|
|
3080
|
+
this.label.height =
|
|
3081
|
+
this.height -
|
|
3082
|
+
getTopMargin(this.type.label) -
|
|
3083
|
+
getBottomMargin(this.type.label);
|
|
2928
3084
|
this.label.updateInView();
|
|
2929
3085
|
}
|
|
2930
3086
|
// Move decorators to match the new coords.
|
|
@@ -2936,7 +3092,7 @@ class DiagramNode extends DiagramElement {
|
|
|
2936
3092
|
this.updateInView();
|
|
2937
3093
|
}
|
|
2938
3094
|
}
|
|
2939
|
-
class DiagramNodeSet extends
|
|
3095
|
+
class DiagramNodeSet extends DiagramElementSet {
|
|
2940
3096
|
/**
|
|
2941
3097
|
* Instance a set of nodes for the given model. This method is used internally.
|
|
2942
3098
|
* @private
|
|
@@ -3042,9 +3198,13 @@ class DiagramNodeSet extends DiagramEntitySet {
|
|
|
3042
3198
|
...nodeType.label
|
|
3043
3199
|
};
|
|
3044
3200
|
this.model.fields.new(node, [
|
|
3045
|
-
node.coords[0] + labelConfiguration
|
|
3046
|
-
node.coords[1] + labelConfiguration
|
|
3047
|
-
], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, node.width -
|
|
3201
|
+
node.coords[0] + getLeftMargin(labelConfiguration),
|
|
3202
|
+
node.coords[1] + getTopMargin(labelConfiguration)
|
|
3203
|
+
], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, node.width -
|
|
3204
|
+
getLeftMargin(labelConfiguration) -
|
|
3205
|
+
getRightMargin(labelConfiguration), node.height -
|
|
3206
|
+
getTopMargin(labelConfiguration) -
|
|
3207
|
+
getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
3048
3208
|
}
|
|
3049
3209
|
node.valueSet.resetValues();
|
|
3050
3210
|
node.model.canvas?.fitNodeInView(node.id);
|
|
@@ -3183,7 +3343,7 @@ class DiagramPort extends DiagramElement {
|
|
|
3183
3343
|
return distanceBetweenPoints(this.coords, coords);
|
|
3184
3344
|
}
|
|
3185
3345
|
}
|
|
3186
|
-
class DiagramPortSet extends
|
|
3346
|
+
class DiagramPortSet extends DiagramElementSet {
|
|
3187
3347
|
/**
|
|
3188
3348
|
* Instance a set of ports for the given model. This method is used internally.
|
|
3189
3349
|
* @private
|
|
@@ -3326,7 +3486,7 @@ class DiagramField extends DiagramElement {
|
|
|
3326
3486
|
return this.rootElement?.getPriority() || DEFAULT_PRIORITY;
|
|
3327
3487
|
}
|
|
3328
3488
|
}
|
|
3329
|
-
class DiagramFieldSet extends
|
|
3489
|
+
class DiagramFieldSet extends DiagramElementSet {
|
|
3330
3490
|
/**
|
|
3331
3491
|
* Instance a set of fields for the given model. This method is used internally.
|
|
3332
3492
|
* @private
|
|
@@ -3367,6 +3527,206 @@ class DiagramFieldSet extends DiagramEntitySet {
|
|
|
3367
3527
|
}
|
|
3368
3528
|
}
|
|
3369
3529
|
}
|
|
3530
|
+
const getBottomMargin = (config) => {
|
|
3531
|
+
if (config?.margin === null || config?.margin === undefined) {
|
|
3532
|
+
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
3533
|
+
}
|
|
3534
|
+
else if (typeof config.margin === 'number') {
|
|
3535
|
+
return config.margin;
|
|
3536
|
+
}
|
|
3537
|
+
else {
|
|
3538
|
+
if (config.margin.length === 0) {
|
|
3539
|
+
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
3540
|
+
}
|
|
3541
|
+
else if (config.margin.length === 1) {
|
|
3542
|
+
return config.margin[0];
|
|
3543
|
+
}
|
|
3544
|
+
else if (config.margin.length === 2) {
|
|
3545
|
+
return config.margin[0];
|
|
3546
|
+
}
|
|
3547
|
+
else if (config.margin.length === 3) {
|
|
3548
|
+
return config.margin[2];
|
|
3549
|
+
}
|
|
3550
|
+
else {
|
|
3551
|
+
return config.margin[2];
|
|
3552
|
+
}
|
|
3553
|
+
}
|
|
3554
|
+
};
|
|
3555
|
+
const getLeftMargin = (config) => {
|
|
3556
|
+
if (config?.margin === null || config?.margin === undefined) {
|
|
3557
|
+
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
3558
|
+
}
|
|
3559
|
+
else if (typeof config.margin === 'number') {
|
|
3560
|
+
return config.margin;
|
|
3561
|
+
}
|
|
3562
|
+
else {
|
|
3563
|
+
if (config.margin.length === 0) {
|
|
3564
|
+
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
3565
|
+
}
|
|
3566
|
+
else if (config.margin.length === 1) {
|
|
3567
|
+
return config.margin[0];
|
|
3568
|
+
}
|
|
3569
|
+
else if (config.margin.length === 2) {
|
|
3570
|
+
return config.margin[1];
|
|
3571
|
+
}
|
|
3572
|
+
else if (config.margin.length === 3) {
|
|
3573
|
+
return config.margin[1];
|
|
3574
|
+
}
|
|
3575
|
+
else {
|
|
3576
|
+
return config.margin[3];
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
};
|
|
3580
|
+
const getRightMargin = (config) => {
|
|
3581
|
+
if (config?.margin === null || config?.margin === undefined) {
|
|
3582
|
+
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
3583
|
+
}
|
|
3584
|
+
else if (typeof config.margin === 'number') {
|
|
3585
|
+
return config.margin;
|
|
3586
|
+
}
|
|
3587
|
+
else {
|
|
3588
|
+
if (config.margin.length === 0) {
|
|
3589
|
+
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
3590
|
+
}
|
|
3591
|
+
else if (config.margin.length === 1) {
|
|
3592
|
+
return config.margin[0];
|
|
3593
|
+
}
|
|
3594
|
+
else if (config.margin.length === 2) {
|
|
3595
|
+
return config.margin[1];
|
|
3596
|
+
}
|
|
3597
|
+
else if (config.margin.length === 3) {
|
|
3598
|
+
return config.margin[1];
|
|
3599
|
+
}
|
|
3600
|
+
else {
|
|
3601
|
+
return config.margin[1];
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
};
|
|
3605
|
+
const getTopMargin = (config) => {
|
|
3606
|
+
if (config?.margin === null || config?.margin === undefined) {
|
|
3607
|
+
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
3608
|
+
}
|
|
3609
|
+
else if (typeof config.margin === 'number') {
|
|
3610
|
+
return config.margin;
|
|
3611
|
+
}
|
|
3612
|
+
else {
|
|
3613
|
+
if (config.margin.length === 0) {
|
|
3614
|
+
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
3615
|
+
}
|
|
3616
|
+
else if (config.margin.length === 1) {
|
|
3617
|
+
return config.margin[0];
|
|
3618
|
+
}
|
|
3619
|
+
else if (config.margin.length === 2) {
|
|
3620
|
+
return config.margin[0];
|
|
3621
|
+
}
|
|
3622
|
+
else if (config.margin.length === 3) {
|
|
3623
|
+
return config.margin[0];
|
|
3624
|
+
}
|
|
3625
|
+
else {
|
|
3626
|
+
return config.margin[0];
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
};
|
|
3630
|
+
const getBottomPadding = (config) => {
|
|
3631
|
+
if (config?.padding === null || config?.padding === undefined) {
|
|
3632
|
+
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
3633
|
+
}
|
|
3634
|
+
else if (typeof config.padding === 'number') {
|
|
3635
|
+
return config.padding;
|
|
3636
|
+
}
|
|
3637
|
+
else {
|
|
3638
|
+
if (config.padding.length === 0) {
|
|
3639
|
+
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
3640
|
+
}
|
|
3641
|
+
else if (config.padding.length === 1) {
|
|
3642
|
+
return config.padding[0];
|
|
3643
|
+
}
|
|
3644
|
+
else if (config.padding.length === 2) {
|
|
3645
|
+
return config.padding[0];
|
|
3646
|
+
}
|
|
3647
|
+
else if (config.padding.length === 3) {
|
|
3648
|
+
return config.padding[2];
|
|
3649
|
+
}
|
|
3650
|
+
else {
|
|
3651
|
+
return config.padding[2];
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
};
|
|
3655
|
+
const getLeftPadding = (config) => {
|
|
3656
|
+
if (config?.padding === null || config?.padding === undefined) {
|
|
3657
|
+
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
3658
|
+
}
|
|
3659
|
+
else if (typeof config.padding === 'number') {
|
|
3660
|
+
return config.padding;
|
|
3661
|
+
}
|
|
3662
|
+
else {
|
|
3663
|
+
if (config.padding.length === 0) {
|
|
3664
|
+
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
3665
|
+
}
|
|
3666
|
+
else if (config.padding.length === 1) {
|
|
3667
|
+
return config.padding[0];
|
|
3668
|
+
}
|
|
3669
|
+
else if (config.padding.length === 2) {
|
|
3670
|
+
return config.padding[1];
|
|
3671
|
+
}
|
|
3672
|
+
else if (config.padding.length === 3) {
|
|
3673
|
+
return config.padding[1];
|
|
3674
|
+
}
|
|
3675
|
+
else {
|
|
3676
|
+
return config.padding[3];
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3679
|
+
};
|
|
3680
|
+
const getRightPadding = (config) => {
|
|
3681
|
+
if (config?.padding === null || config?.padding === undefined) {
|
|
3682
|
+
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
3683
|
+
}
|
|
3684
|
+
else if (typeof config.padding === 'number') {
|
|
3685
|
+
return config.padding;
|
|
3686
|
+
}
|
|
3687
|
+
else {
|
|
3688
|
+
if (config.padding.length === 0) {
|
|
3689
|
+
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
3690
|
+
}
|
|
3691
|
+
else if (config.padding.length === 1) {
|
|
3692
|
+
return config.padding[0];
|
|
3693
|
+
}
|
|
3694
|
+
else if (config.padding.length === 2) {
|
|
3695
|
+
return config.padding[1];
|
|
3696
|
+
}
|
|
3697
|
+
else if (config.padding.length === 3) {
|
|
3698
|
+
return config.padding[1];
|
|
3699
|
+
}
|
|
3700
|
+
else {
|
|
3701
|
+
return config.padding[1];
|
|
3702
|
+
}
|
|
3703
|
+
}
|
|
3704
|
+
};
|
|
3705
|
+
const getTopPadding = (config) => {
|
|
3706
|
+
if (config?.padding === null || config?.padding === undefined) {
|
|
3707
|
+
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
3708
|
+
}
|
|
3709
|
+
else if (typeof config.padding === 'number') {
|
|
3710
|
+
return config.padding;
|
|
3711
|
+
}
|
|
3712
|
+
else {
|
|
3713
|
+
if (config.padding.length === 0) {
|
|
3714
|
+
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
3715
|
+
}
|
|
3716
|
+
else if (config.padding.length === 1) {
|
|
3717
|
+
return config.padding[0];
|
|
3718
|
+
}
|
|
3719
|
+
else if (config.padding.length === 2) {
|
|
3720
|
+
return config.padding[0];
|
|
3721
|
+
}
|
|
3722
|
+
else if (config.padding.length === 3) {
|
|
3723
|
+
return config.padding[0];
|
|
3724
|
+
}
|
|
3725
|
+
else {
|
|
3726
|
+
return config.padding[0];
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
};
|
|
3370
3730
|
|
|
3371
3731
|
/**
|
|
3372
3732
|
* Importer which imports a diagram from its daga model representation.
|
|
@@ -3414,9 +3774,13 @@ class DagaImporter {
|
|
|
3414
3774
|
...newNodeType.label
|
|
3415
3775
|
};
|
|
3416
3776
|
const newField = new DiagramField(model, newNode, [
|
|
3417
|
-
newNode.coords[0] + labelConfiguration
|
|
3418
|
-
newNode.coords[1] + labelConfiguration
|
|
3419
|
-
], newNode.width -
|
|
3777
|
+
newNode.coords[0] + getLeftMargin(labelConfiguration),
|
|
3778
|
+
newNode.coords[1] + getTopMargin(labelConfiguration)
|
|
3779
|
+
], newNode.width -
|
|
3780
|
+
getLeftMargin(labelConfiguration) -
|
|
3781
|
+
getRightMargin(labelConfiguration), newNode.height -
|
|
3782
|
+
getTopMargin(labelConfiguration) -
|
|
3783
|
+
getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
3420
3784
|
newField.text = node.label;
|
|
3421
3785
|
newNode.label = newField;
|
|
3422
3786
|
model.fields.add(newField);
|
|
@@ -3435,9 +3799,13 @@ class DagaImporter {
|
|
|
3435
3799
|
...newNodeType.sectionGrid?.sections?.[section.indexYInNode]?.[section.indexXInNode]?.label
|
|
3436
3800
|
};
|
|
3437
3801
|
const newField = new DiagramField(model, newSection, [
|
|
3438
|
-
newSection.coords[0] + labelConfiguration
|
|
3439
|
-
newSection.coords[1] + labelConfiguration
|
|
3440
|
-
], newSection.width -
|
|
3802
|
+
newSection.coords[0] + getLeftMargin(labelConfiguration),
|
|
3803
|
+
newSection.coords[1] + getTopMargin(labelConfiguration)
|
|
3804
|
+
], newSection.width -
|
|
3805
|
+
getLeftMargin(labelConfiguration) -
|
|
3806
|
+
getRightMargin(labelConfiguration), newSection.height -
|
|
3807
|
+
getTopMargin(labelConfiguration) -
|
|
3808
|
+
getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
3441
3809
|
newField.text = section.label;
|
|
3442
3810
|
newSection.label = newField;
|
|
3443
3811
|
model.fields.add(newField);
|
|
@@ -3654,7 +4022,7 @@ class SetGeometryCollabAction {
|
|
|
3654
4022
|
this.timestamp = timestamp;
|
|
3655
4023
|
}
|
|
3656
4024
|
do() {
|
|
3657
|
-
const node = this.canvas.model.nodes.get(this.nodeId);
|
|
4025
|
+
const node = this.canvas.model.nodes.get(this.nodeId, true);
|
|
3658
4026
|
if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
|
|
3659
4027
|
node.setGeometry(this.to);
|
|
3660
4028
|
// Re-fit the labels, in case their text has changed since `this.to` was measured.
|
|
@@ -3695,8 +4063,8 @@ class AddConnectionCollabAction {
|
|
|
3695
4063
|
this.endId = endId;
|
|
3696
4064
|
}
|
|
3697
4065
|
do() {
|
|
3698
|
-
const start = this.canvas.model.ports.get(this.startId);
|
|
3699
|
-
const end = this.canvas.model.ports.get(this.endId);
|
|
4066
|
+
const start = this.canvas.model.ports.get(this.startId, true);
|
|
4067
|
+
const end = this.canvas.model.ports.get(this.endId, true);
|
|
3700
4068
|
if (start && end) {
|
|
3701
4069
|
this.canvas.model.connections.new(this.typeId, start, end, this.id);
|
|
3702
4070
|
}
|
|
@@ -3727,7 +4095,7 @@ class EditFieldCollabAction {
|
|
|
3727
4095
|
this.timestamp = timestamp;
|
|
3728
4096
|
}
|
|
3729
4097
|
do() {
|
|
3730
|
-
const field = this.canvas.model.fields.get(this.fieldId);
|
|
4098
|
+
const field = this.canvas.model.fields.get(this.fieldId, true);
|
|
3731
4099
|
if (field && timestampWins(this.timestamp, field.textTimestamp)) {
|
|
3732
4100
|
field.text = this.to;
|
|
3733
4101
|
field.textTimestamp = this.timestamp;
|
|
@@ -3762,8 +4130,8 @@ class UpdateValuesCollabAction {
|
|
|
3762
4130
|
return this.canvas.model.valueSet;
|
|
3763
4131
|
}
|
|
3764
4132
|
else {
|
|
3765
|
-
return (this.canvas.model.nodes.get(this.id) ||
|
|
3766
|
-
this.canvas.model.connections.get(this.id))?.valueSet;
|
|
4133
|
+
return (this.canvas.model.nodes.get(this.id, true) ||
|
|
4134
|
+
this.canvas.model.connections.get(this.id, true))?.valueSet;
|
|
3767
4135
|
}
|
|
3768
4136
|
}
|
|
3769
4137
|
do() {
|
|
@@ -3811,19 +4179,19 @@ class SetSelfRemovedCollabAction {
|
|
|
3811
4179
|
}
|
|
3812
4180
|
do() {
|
|
3813
4181
|
for (const nodeId of this.nodeIds) {
|
|
3814
|
-
this.doOne(this.canvas.model.nodes.get(nodeId));
|
|
4182
|
+
this.doOne(this.canvas.model.nodes.get(nodeId, true));
|
|
3815
4183
|
}
|
|
3816
4184
|
for (const sectionId of this.sectionIds) {
|
|
3817
|
-
this.doOne(this.canvas.model.sections.get(sectionId));
|
|
4185
|
+
this.doOne(this.canvas.model.sections.get(sectionId, true));
|
|
3818
4186
|
}
|
|
3819
4187
|
for (const portId of this.portIds) {
|
|
3820
|
-
this.doOne(this.canvas.model.ports.get(portId));
|
|
4188
|
+
this.doOne(this.canvas.model.ports.get(portId, true));
|
|
3821
4189
|
}
|
|
3822
4190
|
for (const connectionId of this.connectionIds) {
|
|
3823
|
-
this.doOne(this.canvas.model.connections.get(connectionId));
|
|
4191
|
+
this.doOne(this.canvas.model.connections.get(connectionId, true));
|
|
3824
4192
|
}
|
|
3825
4193
|
for (const fieldId of this.fieldIds) {
|
|
3826
|
-
this.doOne(this.canvas.model.fields.get(fieldId));
|
|
4194
|
+
this.doOne(this.canvas.model.fields.get(fieldId, true));
|
|
3827
4195
|
}
|
|
3828
4196
|
// update view
|
|
3829
4197
|
this.canvas.updateNodesInView(...this.nodeIds);
|
|
@@ -4478,13 +4846,13 @@ class AdjacencyLayout {
|
|
|
4478
4846
|
}
|
|
4479
4847
|
// arrange nodes
|
|
4480
4848
|
const nodeArrangement = new Grid();
|
|
4481
|
-
const nodesToBeArranged =
|
|
4849
|
+
const nodesToBeArranged = model.nodes.all();
|
|
4482
4850
|
while (nodesToBeArranged.length > 0) {
|
|
4483
4851
|
arrangeNode(nodesToBeArranged[0], nodeArrangement, [0, 0], nodesToBeArranged);
|
|
4484
4852
|
}
|
|
4485
4853
|
// place nodes according to arrangement
|
|
4486
|
-
const maximumWidth = Math.max(...model.nodes.
|
|
4487
|
-
const maximumHeight = Math.max(...model.nodes.
|
|
4854
|
+
const maximumWidth = Math.max(...model.nodes.map((n) => n.width));
|
|
4855
|
+
const maximumHeight = Math.max(...model.nodes.map((n) => n.height));
|
|
4488
4856
|
const gapSize = (model.canvas?.gridSize || 0) * 2;
|
|
4489
4857
|
for (let y = nodeArrangement.minY(); y <= nodeArrangement.maxY(); ++y) {
|
|
4490
4858
|
for (let x = nodeArrangement.minX(); x <= nodeArrangement.maxX(); ++x) {
|
|
@@ -4524,7 +4892,7 @@ class BreadthAdjacencyLayout {
|
|
|
4524
4892
|
}
|
|
4525
4893
|
// arrange nodes
|
|
4526
4894
|
const nodeArrangement = new Grid();
|
|
4527
|
-
const nodesToBeArranged =
|
|
4895
|
+
const nodesToBeArranged = model.nodes.all();
|
|
4528
4896
|
const nodeGridIndices = {};
|
|
4529
4897
|
const firstNode = nodesToBeArranged[0];
|
|
4530
4898
|
let currentNodeLevel = [firstNode];
|
|
@@ -4534,7 +4902,9 @@ class BreadthAdjacencyLayout {
|
|
|
4534
4902
|
for (const nodeInThisLevel of currentNodeLevel) {
|
|
4535
4903
|
nodeArrangement.set(nodeArrangement.getClosestEmptyCoordinate(nodeGridIndices[nodeInThisLevel.id]), nodeInThisLevel);
|
|
4536
4904
|
removeIfExists(nodesToBeArranged, nodeInThisLevel);
|
|
4537
|
-
const nodesAdjacentToThisNode = nodeInThisLevel
|
|
4905
|
+
const nodesAdjacentToThisNode = nodeInThisLevel
|
|
4906
|
+
.getAdjacentNodes()
|
|
4907
|
+
.filter((n) => !n.removed);
|
|
4538
4908
|
for (const adjacentNode of nodesAdjacentToThisNode) {
|
|
4539
4909
|
if (nodesToBeArranged.includes(adjacentNode)) {
|
|
4540
4910
|
nextNodeLevel.push(adjacentNode);
|
|
@@ -4554,8 +4924,8 @@ class BreadthAdjacencyLayout {
|
|
|
4554
4924
|
}
|
|
4555
4925
|
}
|
|
4556
4926
|
// place nodes according to arrangement
|
|
4557
|
-
const maximumWidth = Math.max(...model.nodes.
|
|
4558
|
-
const maximumHeight = Math.max(...model.nodes.
|
|
4927
|
+
const maximumWidth = Math.max(...model.nodes.map((n) => n.width));
|
|
4928
|
+
const maximumHeight = Math.max(...model.nodes.map((n) => n.height));
|
|
4559
4929
|
const gapSize = (model.canvas?.gridSize || 0) * 2;
|
|
4560
4930
|
for (let y = nodeArrangement.minY(); y <= nodeArrangement.maxY(); ++y) {
|
|
4561
4931
|
for (let x = nodeArrangement.minX(); x <= nodeArrangement.maxX(); ++x) {
|
|
@@ -4584,7 +4954,7 @@ class BreadthLayout {
|
|
|
4584
4954
|
return model;
|
|
4585
4955
|
}
|
|
4586
4956
|
const gapSize = (model.canvas?.gridSize || 0) * 2;
|
|
4587
|
-
let nodesToBeArranged =
|
|
4957
|
+
let nodesToBeArranged = model.nodes.all();
|
|
4588
4958
|
// Arrange nodes by a breadth first search
|
|
4589
4959
|
const firstNode = nodesToBeArranged[0];
|
|
4590
4960
|
removeIfExists(nodesToBeArranged, firstNode);
|
|
@@ -4600,7 +4970,9 @@ class BreadthLayout {
|
|
|
4600
4970
|
const lastRowOfNodes = nodeArrangement[nodeArrangement.length - 1];
|
|
4601
4971
|
const nodesInNextRow = [];
|
|
4602
4972
|
for (const nodeInLastRow of lastRowOfNodes) {
|
|
4603
|
-
const nodesAdjacentToThisNode = nodeInLastRow
|
|
4973
|
+
const nodesAdjacentToThisNode = nodeInLastRow
|
|
4974
|
+
.getAdjacentNodes()
|
|
4975
|
+
.filter((n) => !n.removed);
|
|
4604
4976
|
for (const adjacentNode of nodesAdjacentToThisNode) {
|
|
4605
4977
|
if (nodesToBeArranged.includes(adjacentNode)) {
|
|
4606
4978
|
removeIfExists(nodesToBeArranged, adjacentNode);
|
|
@@ -4805,17 +5177,17 @@ class PriorityLayout {
|
|
|
4805
5177
|
// nothing to arrange...
|
|
4806
5178
|
return model;
|
|
4807
5179
|
}
|
|
4808
|
-
const maximumPriority = Math.max(...model.nodes.
|
|
4809
|
-
const minimumPriority = Math.min(...model.nodes.
|
|
5180
|
+
const maximumPriority = Math.max(...model.nodes.map((n) => n.getPriority()));
|
|
5181
|
+
const minimumPriority = Math.min(...model.nodes.map((n) => n.getPriority()));
|
|
4810
5182
|
if (maximumPriority === minimumPriority) {
|
|
4811
5183
|
// if there's no disparity in priorities, just use breadth layout
|
|
4812
5184
|
new BreadthLayout().apply(model);
|
|
4813
5185
|
return model;
|
|
4814
5186
|
}
|
|
4815
5187
|
const gapSize = (model.canvas?.gridSize || 0) * 2;
|
|
4816
|
-
const nodesToBeArranged =
|
|
5188
|
+
const nodesToBeArranged = model.nodes.all();
|
|
4817
5189
|
const nodeArrangement = [];
|
|
4818
|
-
const nodesWithMaximumPriorityToBeArranged = model.nodes.filter((n) =>
|
|
5190
|
+
const nodesWithMaximumPriorityToBeArranged = model.nodes.filter((n) => n.getPriority() >= maximumPriority);
|
|
4819
5191
|
const nodesWithMaximumPriority = [];
|
|
4820
5192
|
if (nodesWithMaximumPriorityToBeArranged.length > 1) {
|
|
4821
5193
|
// use bfs to sort nodes by distance to the first node
|
|
@@ -4831,7 +5203,9 @@ class PriorityLayout {
|
|
|
4831
5203
|
nodesWithMaximumPriority.push(bfsNode);
|
|
4832
5204
|
removeIfExists(nodesWithMaximumPriorityToBeArranged, bfsNode);
|
|
4833
5205
|
}
|
|
4834
|
-
const bfsAdjacentNodes = bfsNode
|
|
5206
|
+
const bfsAdjacentNodes = bfsNode
|
|
5207
|
+
.getAdjacentNodes()
|
|
5208
|
+
.filter((n) => !n.removed);
|
|
4835
5209
|
for (const bfsAdjacentNode of bfsAdjacentNodes) {
|
|
4836
5210
|
if (!bfsExplored.includes(bfsAdjacentNode)) {
|
|
4837
5211
|
bfsQueue.push(bfsAdjacentNode);
|
|
@@ -4871,7 +5245,9 @@ class PriorityLayout {
|
|
|
4871
5245
|
break;
|
|
4872
5246
|
}
|
|
4873
5247
|
else {
|
|
4874
|
-
const bfsAdjacentNodes = bfsNode
|
|
5248
|
+
const bfsAdjacentNodes = bfsNode
|
|
5249
|
+
.getAdjacentNodes()
|
|
5250
|
+
.filter((n) => !n.removed);
|
|
4875
5251
|
for (const bfsAdjacentNode of bfsAdjacentNodes) {
|
|
4876
5252
|
if (!bfsExplored.includes(bfsAdjacentNode)) {
|
|
4877
5253
|
bfsQueue.push(bfsAdjacentNode);
|
|
@@ -4914,8 +5290,8 @@ class TreeLayout {
|
|
|
4914
5290
|
// nothing to arrange...
|
|
4915
5291
|
return model;
|
|
4916
5292
|
}
|
|
4917
|
-
const maximumPriority = Math.max(...model.nodes.
|
|
4918
|
-
const minimumPriority = Math.min(...model.nodes.
|
|
5293
|
+
const maximumPriority = Math.max(...model.nodes.map((n) => n.getPriority()));
|
|
5294
|
+
const minimumPriority = Math.min(...model.nodes.map((n) => n.getPriority()));
|
|
4919
5295
|
if (maximumPriority === minimumPriority) {
|
|
4920
5296
|
// if there's no disparity in priorities, just use breadth layout
|
|
4921
5297
|
new BreadthLayout().apply(model);
|
|
@@ -4936,7 +5312,7 @@ class TreeLayout {
|
|
|
4936
5312
|
branchArrangement.push([branch]);
|
|
4937
5313
|
arrangeBranches(branch, branchArrangement, branchArrangement.length);
|
|
4938
5314
|
}
|
|
4939
|
-
const maximumHeight = Math.max(...model.nodes.
|
|
5315
|
+
const maximumHeight = Math.max(...model.nodes.map((n) => n.height));
|
|
4940
5316
|
let widthAccumulator = 0;
|
|
4941
5317
|
for (let i = 0; i < branchArrangement.length; ++i) {
|
|
4942
5318
|
let heightAccumulator = 0;
|
|
@@ -4957,7 +5333,9 @@ class TreeLayout {
|
|
|
4957
5333
|
}
|
|
4958
5334
|
}
|
|
4959
5335
|
const populateBranches = (branch, nodesToBeArranged) => {
|
|
4960
|
-
for (const adjacentNode of branch.node
|
|
5336
|
+
for (const adjacentNode of branch.node
|
|
5337
|
+
.getAdjacentNodes()
|
|
5338
|
+
.filter((n) => !n.removed)) {
|
|
4961
5339
|
const indexOfAdjacentNode = nodesToBeArranged.indexOf(adjacentNode);
|
|
4962
5340
|
if (indexOfAdjacentNode >= 0) {
|
|
4963
5341
|
nodesToBeArranged.splice(indexOfAdjacentNode, 1);
|
|
@@ -5266,12 +5644,12 @@ class DagaExporter {
|
|
|
5266
5644
|
if (model.description) {
|
|
5267
5645
|
result.description = model.description;
|
|
5268
5646
|
}
|
|
5269
|
-
for (const node of model.nodes) {
|
|
5647
|
+
for (const node of model.nodes.all(true)) {
|
|
5270
5648
|
if (!includeCollabMeta && node.removed)
|
|
5271
5649
|
continue;
|
|
5272
5650
|
result.nodes.push(this.exportNode(node, includeCollabMeta));
|
|
5273
5651
|
}
|
|
5274
|
-
for (const connection of model.connections) {
|
|
5652
|
+
for (const connection of model.connections.all(true)) {
|
|
5275
5653
|
if (!includeCollabMeta && connection.removed)
|
|
5276
5654
|
continue;
|
|
5277
5655
|
result.connections.push(this.exportConnection(connection, includeCollabMeta));
|
|
@@ -5467,7 +5845,7 @@ class DiagramDecorator extends DiagramElement {
|
|
|
5467
5845
|
return this.priority;
|
|
5468
5846
|
}
|
|
5469
5847
|
}
|
|
5470
|
-
class DiagramDecoratorSet extends
|
|
5848
|
+
class DiagramDecoratorSet extends DiagramElementSet {
|
|
5471
5849
|
/**
|
|
5472
5850
|
* Instance a set of decorators for the given model. This method is used internally.
|
|
5473
5851
|
* @private
|
|
@@ -5547,7 +5925,7 @@ class DiagramObject extends DiagramElement {
|
|
|
5547
5925
|
return this.priority;
|
|
5548
5926
|
}
|
|
5549
5927
|
}
|
|
5550
|
-
class DiagramObjectSet extends
|
|
5928
|
+
class DiagramObjectSet extends DiagramElementSet {
|
|
5551
5929
|
/**
|
|
5552
5930
|
* Instance a set of objects for the given model. This method is used internally.
|
|
5553
5931
|
* @private
|
|
@@ -5812,20 +6190,20 @@ class DiagramCanvas {
|
|
|
5812
6190
|
if (event.ctrlKey && event.key === 'a') {
|
|
5813
6191
|
event.preventDefault();
|
|
5814
6192
|
// select all
|
|
5815
|
-
for (const node of this.model.nodes
|
|
6193
|
+
for (const node of this.model.nodes) {
|
|
5816
6194
|
this.addToUserSelection(node);
|
|
5817
6195
|
}
|
|
5818
|
-
for (const connection of this.model.connections
|
|
6196
|
+
for (const connection of this.model.connections) {
|
|
5819
6197
|
this.addToUserSelection(connection);
|
|
5820
6198
|
}
|
|
5821
6199
|
}
|
|
5822
6200
|
if (event.ctrlKey && event.key === 'i') {
|
|
5823
6201
|
event.preventDefault();
|
|
5824
6202
|
// invert selection
|
|
5825
|
-
for (const node of this.model.nodes
|
|
6203
|
+
for (const node of this.model.nodes) {
|
|
5826
6204
|
this.toggleUserSelection(node);
|
|
5827
6205
|
}
|
|
5828
|
-
for (const connection of this.model.connections
|
|
6206
|
+
for (const connection of this.model.connections) {
|
|
5829
6207
|
this.toggleUserSelection(connection);
|
|
5830
6208
|
}
|
|
5831
6209
|
}
|
|
@@ -5853,13 +6231,45 @@ class DiagramCanvas {
|
|
|
5853
6231
|
this.cancelAllUserActions();
|
|
5854
6232
|
}
|
|
5855
6233
|
if (event.ctrlKey && event.key === 'y') {
|
|
6234
|
+
event.preventDefault();
|
|
5856
6235
|
// redo
|
|
5857
6236
|
this.actionQueue.redo();
|
|
5858
6237
|
}
|
|
5859
6238
|
if (event.ctrlKey && event.key === 'z') {
|
|
6239
|
+
event.preventDefault();
|
|
5860
6240
|
// undo
|
|
5861
6241
|
this.actionQueue.undo();
|
|
5862
6242
|
}
|
|
6243
|
+
if (event.key === '+') {
|
|
6244
|
+
event.preventDefault();
|
|
6245
|
+
// zoom in
|
|
6246
|
+
this.parentComponent.diagramButtons.zoomIn();
|
|
6247
|
+
}
|
|
6248
|
+
if (event.key === '-') {
|
|
6249
|
+
event.preventDefault();
|
|
6250
|
+
// zoom out
|
|
6251
|
+
this.parentComponent.diagramButtons.zoomOut();
|
|
6252
|
+
}
|
|
6253
|
+
if (event.key === Keys.ArrowLeft) {
|
|
6254
|
+
event.preventDefault();
|
|
6255
|
+
// move left, faster if we're zoomed out and slower if we're zoomed in
|
|
6256
|
+
this.translateBy(-100 / this.zoomTransform.k, 0);
|
|
6257
|
+
}
|
|
6258
|
+
if (event.key === Keys.ArrowRight) {
|
|
6259
|
+
event.preventDefault();
|
|
6260
|
+
// move right, faster if we're zoomed out and slower if we're zoomed in
|
|
6261
|
+
this.translateBy(100 / this.zoomTransform.k, 0);
|
|
6262
|
+
}
|
|
6263
|
+
if (event.key === Keys.ArrowDown) {
|
|
6264
|
+
event.preventDefault();
|
|
6265
|
+
// move down, faster if we're zoomed out and slower if we're zoomed in
|
|
6266
|
+
this.translateBy(0, -100 / this.zoomTransform.k);
|
|
6267
|
+
}
|
|
6268
|
+
if (event.key === Keys.ArrowUp) {
|
|
6269
|
+
event.preventDefault();
|
|
6270
|
+
// move up, faster if we're zoomed out and slower if we're zoomed in
|
|
6271
|
+
this.translateBy(0, 100 / this.zoomTransform.k);
|
|
6272
|
+
}
|
|
5863
6273
|
});
|
|
5864
6274
|
const canvasView = this.selectRoot()
|
|
5865
6275
|
.append('g')
|
|
@@ -5982,13 +6392,14 @@ class DiagramCanvas {
|
|
|
5982
6392
|
// if there are no nodes, we have nothing to do here
|
|
5983
6393
|
if (this.model.nodes.length > 0) {
|
|
5984
6394
|
const canvasViewBoundingBox = this.selectCanvasView().select('rect').node().getBBox();
|
|
5985
|
-
const
|
|
5986
|
-
const
|
|
6395
|
+
const nonRemovedNodes = this.model.nodes.all();
|
|
6396
|
+
const minimumX = Math.min(...nonRemovedNodes.map((n) => n.coords[0]));
|
|
6397
|
+
const maximumX = Math.max(...nonRemovedNodes.map((n) => n.coords[0] + n.width));
|
|
5987
6398
|
const averageX = (minimumX + maximumX) / 2;
|
|
5988
6399
|
const rangeX = maximumX - minimumX;
|
|
5989
6400
|
const windowRangeX = canvasViewBoundingBox.width;
|
|
5990
|
-
const minimumY = Math.min(...
|
|
5991
|
-
const maximumY = Math.max(...
|
|
6401
|
+
const minimumY = Math.min(...nonRemovedNodes.map((n) => n.coords[1]));
|
|
6402
|
+
const maximumY = Math.max(...nonRemovedNodes.map((n) => n.coords[1] + n.height));
|
|
5992
6403
|
const averageY = (minimumY + maximumY) / 2;
|
|
5993
6404
|
const rangeY = maximumY - minimumY;
|
|
5994
6405
|
const windowRangeY = canvasViewBoundingBox.height;
|
|
@@ -6084,10 +6495,9 @@ class DiagramCanvas {
|
|
|
6084
6495
|
updateNodesInView(...ids) {
|
|
6085
6496
|
let updateSelection = this.selectCanvasNodes()
|
|
6086
6497
|
.selectAll('g.diagram-node')
|
|
6087
|
-
.data(this.model.nodes.filter((e) =>
|
|
6088
|
-
(this.priorityThreshold
|
|
6089
|
-
|
|
6090
|
-
: true)), (d) => d.id);
|
|
6498
|
+
.data(this.model.nodes.filter((e) => this.priorityThreshold !== undefined
|
|
6499
|
+
? e.getPriority() >= this.priorityThreshold
|
|
6500
|
+
: true), (d) => d.id);
|
|
6091
6501
|
const exitSelection = updateSelection.exit();
|
|
6092
6502
|
const enterSelection = updateSelection
|
|
6093
6503
|
.enter()
|
|
@@ -6623,10 +7033,9 @@ class DiagramCanvas {
|
|
|
6623
7033
|
updateSectionsInView(...ids) {
|
|
6624
7034
|
let updateSelection = this.selectCanvasSections()
|
|
6625
7035
|
.selectAll('g.diagram-section')
|
|
6626
|
-
.data(this.model.sections.filter((e) =>
|
|
6627
|
-
(this.priorityThreshold
|
|
6628
|
-
|
|
6629
|
-
: true)), (d) => d.id);
|
|
7036
|
+
.data(this.model.sections.filter((e) => this.priorityThreshold !== undefined
|
|
7037
|
+
? e.getPriority() >= this.priorityThreshold
|
|
7038
|
+
: true), (d) => d.id);
|
|
6630
7039
|
const exitSelection = updateSelection.exit();
|
|
6631
7040
|
const enterSelection = updateSelection
|
|
6632
7041
|
.enter()
|
|
@@ -7181,10 +7590,9 @@ class DiagramCanvas {
|
|
|
7181
7590
|
updatePortsInView(...ids) {
|
|
7182
7591
|
let updateSelection = this.selectCanvasPorts()
|
|
7183
7592
|
.selectAll('g.diagram-port')
|
|
7184
|
-
.data(this.model.ports.filter((e) =>
|
|
7185
|
-
(this.priorityThreshold
|
|
7186
|
-
|
|
7187
|
-
: true)), (d) => d.id);
|
|
7593
|
+
.data(this.model.ports.filter((e) => this.priorityThreshold !== undefined
|
|
7594
|
+
? e.getPriority() >= this.priorityThreshold
|
|
7595
|
+
: true), (d) => d.id);
|
|
7188
7596
|
const exitSelection = updateSelection.exit();
|
|
7189
7597
|
const enterSelection = updateSelection
|
|
7190
7598
|
.enter()
|
|
@@ -7287,7 +7695,7 @@ class DiagramCanvas {
|
|
|
7287
7695
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7288
7696
|
let minDistanceFound = Number.POSITIVE_INFINITY;
|
|
7289
7697
|
let closestPortFound = undefined;
|
|
7290
|
-
for (const port of this.model.ports
|
|
7698
|
+
for (const port of this.model.ports) {
|
|
7291
7699
|
const distance = port.distanceTo(pointerCoords);
|
|
7292
7700
|
if (distance < minDistanceFound) {
|
|
7293
7701
|
minDistanceFound = distance;
|
|
@@ -7359,10 +7767,9 @@ class DiagramCanvas {
|
|
|
7359
7767
|
.attr('opacity', (d) => (d.highlighted || d.selected ? 0.5 : 0));
|
|
7360
7768
|
}
|
|
7361
7769
|
updateConnectionsInView(...ids) {
|
|
7362
|
-
const connectionList = this.model.connections.filter((e) =>
|
|
7363
|
-
(this.priorityThreshold
|
|
7364
|
-
|
|
7365
|
-
: true));
|
|
7770
|
+
const connectionList = this.model.connections.filter((e) => this.priorityThreshold !== undefined
|
|
7771
|
+
? e.getPriority() >= this.priorityThreshold
|
|
7772
|
+
: true);
|
|
7366
7773
|
if (this.unfinishedConnection) {
|
|
7367
7774
|
connectionList.push(this.unfinishedConnection);
|
|
7368
7775
|
}
|
|
@@ -7466,10 +7873,9 @@ class DiagramCanvas {
|
|
|
7466
7873
|
updateFieldsInView(...ids) {
|
|
7467
7874
|
let updateSelection = this.selectCanvasFields()
|
|
7468
7875
|
.selectAll('foreignObject.diagram-field')
|
|
7469
|
-
.data(this.model.fields.filter((e) =>
|
|
7470
|
-
(this.priorityThreshold
|
|
7471
|
-
|
|
7472
|
-
: true)), (d) => d.id);
|
|
7876
|
+
.data(this.model.fields.filter((e) => this.priorityThreshold !== undefined
|
|
7877
|
+
? e.getPriority() >= this.priorityThreshold
|
|
7878
|
+
: true), (d) => d.id);
|
|
7473
7879
|
const exitSelection = updateSelection.exit();
|
|
7474
7880
|
const enterSelection = updateSelection
|
|
7475
7881
|
.enter()
|
|
@@ -7643,10 +8049,9 @@ class DiagramCanvas {
|
|
|
7643
8049
|
updateObjectsInView(...ids) {
|
|
7644
8050
|
let updateSelection = this.selectCanvasObjects()
|
|
7645
8051
|
.selectAll('foreignObject.diagram-object')
|
|
7646
|
-
.data(this.model.objects.filter((e) =>
|
|
7647
|
-
(this.priorityThreshold
|
|
7648
|
-
|
|
7649
|
-
: true)), (d) => d.id);
|
|
8052
|
+
.data(this.model.objects.filter((e) => this.priorityThreshold !== undefined
|
|
8053
|
+
? e.getPriority() >= this.priorityThreshold
|
|
8054
|
+
: true), (d) => d.id);
|
|
7650
8055
|
const exitSelection = updateSelection.exit();
|
|
7651
8056
|
const enterSelection = updateSelection
|
|
7652
8057
|
.enter()
|
|
@@ -7681,10 +8086,9 @@ class DiagramCanvas {
|
|
|
7681
8086
|
updateDecoratorsInView(...ids) {
|
|
7682
8087
|
let updateSelection = this.selectCanvasDecorators()
|
|
7683
8088
|
.selectAll('foreignObject.diagram-decorator')
|
|
7684
|
-
.data(this.model.decorators.filter((e) =>
|
|
7685
|
-
(this.priorityThreshold
|
|
7686
|
-
|
|
7687
|
-
: true)), (d) => d.id);
|
|
8089
|
+
.data(this.model.decorators.filter((e) => this.priorityThreshold !== undefined
|
|
8090
|
+
? e.getPriority() >= this.priorityThreshold
|
|
8091
|
+
: true), (d) => d.id);
|
|
7688
8092
|
const exitSelection = updateSelection.exit();
|
|
7689
8093
|
const enterSelection = updateSelection
|
|
7690
8094
|
.enter()
|
|
@@ -7748,13 +8152,14 @@ class DiagramCanvas {
|
|
|
7748
8152
|
const boundingWidth = !connection.startLabel
|
|
7749
8153
|
? 0
|
|
7750
8154
|
: startLabelBoundingRect.width / this.zoomTransform.k +
|
|
7751
|
-
labelConfiguration
|
|
8155
|
+
getLeftPadding(labelConfiguration) +
|
|
8156
|
+
getRightPadding(labelConfiguration);
|
|
7752
8157
|
const boundingHeight = !connection.startLabel
|
|
7753
8158
|
? 0
|
|
7754
8159
|
: startLabelBoundingRect.height / this.zoomTransform.k +
|
|
7755
|
-
labelConfiguration
|
|
7756
|
-
|
|
7757
|
-
|
|
8160
|
+
getTopPadding(labelConfiguration) +
|
|
8161
|
+
getBottomPadding(labelConfiguration);
|
|
8162
|
+
const pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
7758
8163
|
connectionSelection
|
|
7759
8164
|
.select('g.diagram-connection-start-label path')
|
|
7760
8165
|
.attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight))
|
|
@@ -7788,11 +8193,13 @@ class DiagramCanvas {
|
|
|
7788
8193
|
const boundingWidth = !connection.middleLabel
|
|
7789
8194
|
? 0
|
|
7790
8195
|
: middleLabelBoundingRect.width / this.zoomTransform.k +
|
|
7791
|
-
labelConfiguration
|
|
8196
|
+
getLeftPadding(labelConfiguration) +
|
|
8197
|
+
getRightPadding(labelConfiguration);
|
|
7792
8198
|
const boundingHeight = !connection.middleLabel
|
|
7793
8199
|
? 0
|
|
7794
8200
|
: middleLabelBoundingRect.height / this.zoomTransform.k +
|
|
7795
|
-
labelConfiguration
|
|
8201
|
+
getTopPadding(labelConfiguration) +
|
|
8202
|
+
getBottomPadding(labelConfiguration);
|
|
7796
8203
|
const pathMiddleLabelPoint = pathNode.getPointAtLength(pathLength / 2);
|
|
7797
8204
|
connectionSelection
|
|
7798
8205
|
.select('g.diagram-connection-middle-label path')
|
|
@@ -7827,14 +8234,15 @@ class DiagramCanvas {
|
|
|
7827
8234
|
const boundingWidth = !connection.endLabel
|
|
7828
8235
|
? 0
|
|
7829
8236
|
: endLabelBoundingRect.width / this.zoomTransform.k +
|
|
7830
|
-
labelConfiguration
|
|
8237
|
+
getLeftPadding(labelConfiguration) +
|
|
8238
|
+
getRightPadding(labelConfiguration);
|
|
7831
8239
|
const boundingHeight = !connection.endLabel
|
|
7832
8240
|
? 0
|
|
7833
8241
|
: endLabelBoundingRect.height / this.zoomTransform.k +
|
|
7834
|
-
labelConfiguration
|
|
8242
|
+
getTopPadding(labelConfiguration) +
|
|
8243
|
+
getBottomPadding(labelConfiguration);
|
|
7835
8244
|
const pathEndLabelPoint = pathNode.getPointAtLength(pathLength -
|
|
7836
|
-
labelConfiguration
|
|
7837
|
-
Math.max(boundingWidth / 2, boundingHeight / 2));
|
|
8245
|
+
Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
7838
8246
|
connectionSelection
|
|
7839
8247
|
.select('g.diagram-connection-end-label path')
|
|
7840
8248
|
.attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight))
|
|
@@ -7901,10 +8309,12 @@ class DiagramCanvas {
|
|
|
7901
8309
|
if (field.rootElement instanceof DiagramNode && field.fit) {
|
|
7902
8310
|
const fieldDimensions = this.minimumSizeOfField(field);
|
|
7903
8311
|
let stretchX = fieldDimensions[0] +
|
|
7904
|
-
|
|
8312
|
+
getLeftMargin(field.rootElement.type.label) +
|
|
8313
|
+
getRightMargin(field.rootElement.type.label) -
|
|
7905
8314
|
field.rootElement.width;
|
|
7906
8315
|
let stretchY = fieldDimensions[1] +
|
|
7907
|
-
|
|
8316
|
+
getTopMargin(field.rootElement.type.label) +
|
|
8317
|
+
getBottomMargin(field.rootElement.type.label) -
|
|
7908
8318
|
field.rootElement.height;
|
|
7909
8319
|
if (this.snapToGrid) {
|
|
7910
8320
|
stretchX = Math.ceil(stretchX / this.gridSize) * this.gridSize;
|
|
@@ -7945,10 +8355,12 @@ class DiagramCanvas {
|
|
|
7945
8355
|
fieldDimensions[1] = minimumFieldHeight;
|
|
7946
8356
|
}
|
|
7947
8357
|
let stretchX = fieldDimensions[0] +
|
|
7948
|
-
|
|
8358
|
+
getLeftMargin(field.rootElement?.getConfig()?.label) +
|
|
8359
|
+
getRightMargin(field.rootElement?.getConfig()?.label) -
|
|
7949
8360
|
field.rootElement.width;
|
|
7950
8361
|
let stretchY = fieldDimensions[1] +
|
|
7951
|
-
|
|
8362
|
+
getTopMargin(field.rootElement?.getConfig()?.label) +
|
|
8363
|
+
getBottomMargin(field.rootElement?.getConfig()?.label) -
|
|
7952
8364
|
field.rootElement.height;
|
|
7953
8365
|
if (this.snapToGrid) {
|
|
7954
8366
|
stretchX = Math.ceil(stretchX / this.gridSize) * this.gridSize;
|
|
@@ -9183,7 +9595,7 @@ class PaletteComponent {
|
|
|
9183
9595
|
};
|
|
9184
9596
|
thisComponent
|
|
9185
9597
|
.append('text')
|
|
9186
|
-
.attr('transform', `translate(${type.defaultWidth / 2},${type.defaultHeight / 2
|
|
9598
|
+
.attr('transform', `translate(${(getLeftMargin(labelConfig) + type.defaultWidth) / 2},${(getTopMargin(labelConfig) + type.defaultHeight) / 2})`)
|
|
9187
9599
|
.attr('x', 0)
|
|
9188
9600
|
.attr('y', 0)
|
|
9189
9601
|
.attr('font-size', `${labelConfig.fontSize}px`)
|
|
@@ -10541,5 +10953,5 @@ function now() {
|
|
|
10541
10953
|
* Generated bundle index. Do not edit.
|
|
10542
10954
|
*/
|
|
10543
10955
|
|
|
10544
|
-
export { ACTION_QUEUE_SIZE, ActionQueue, AddConnectionAction, AddNodeAction, AdjacencyLayout, BreadthAdjacencyLayout, BreadthLayout, CanvasProviderService, ClosedShape, CollabClient, CollapseButtonComponent, Corner, DagaConfigurationService, DagaExporter, DagaImporter, DagaModule, DiagramActions, DiagramButtonsComponent, DiagramCanvas, DiagramComponent, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramDecorator, DiagramDecoratorSet, DiagramEditorComponent, DiagramElement, DiagramEntitySet, DiagramEvent, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSection, DiagramSectionSet, EditFieldAction, ErrorsComponent, ForceLayout, HorizontalAlign, HorizontalLayout, LineShape, LineStyle, ObjectEditorComponent, PaletteComponent, PriorityLayout, Property, PropertyEditorComponent, PropertySet, RemoveAction, SetGeometryAction, Side, TextListEditorComponent, TextMapEditorComponent, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, layouts };
|
|
10956
|
+
export { ACTION_QUEUE_SIZE, ActionQueue, AddConnectionAction, AddNodeAction, AdjacencyLayout, BreadthAdjacencyLayout, BreadthLayout, CanvasProviderService, ClosedShape, CollabClient, CollapseButtonComponent, Corner, DagaConfigurationService, DagaExporter, DagaImporter, DagaModule, DiagramActions, DiagramButtonsComponent, DiagramCanvas, DiagramComponent, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramDecorator, DiagramDecoratorSet, DiagramEditorComponent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSection, DiagramSectionSet, EditFieldAction, ErrorsComponent, ForceLayout, HorizontalAlign, HorizontalLayout, LineShape, LineStyle, ObjectEditorComponent, PaletteComponent, PriorityLayout, Property, PropertyEditorComponent, PropertySet, RemoveAction, SetGeometryAction, Side, TextListEditorComponent, TextMapEditorComponent, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, layouts };
|
|
10545
10957
|
//# sourceMappingURL=metadev-daga.mjs.map
|