@finos/legend-extension-dsl-diagram 1.0.28 → 1.0.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. package/lib/DiagramRenderer.d.ts +1 -1
  2. package/lib/DiagramRenderer.d.ts.map +1 -1
  3. package/lib/DiagramRenderer.js +52 -51
  4. package/lib/DiagramRenderer.js.map +1 -1
  5. package/lib/components/studio/DiagramEditor.d.ts.map +1 -1
  6. package/lib/components/studio/DiagramEditor.js +4 -3
  7. package/lib/components/studio/DiagramEditor.js.map +1 -1
  8. package/lib/helpers/DiagramHelper.d.ts.map +1 -1
  9. package/lib/helpers/DiagramHelper.js +4 -3
  10. package/lib/helpers/DiagramHelper.js.map +1 -1
  11. package/lib/index.css +1 -1
  12. package/lib/index.d.ts +2 -1
  13. package/lib/index.d.ts.map +1 -1
  14. package/lib/index.js +2 -1
  15. package/lib/index.js.map +1 -1
  16. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.d.ts +0 -3
  17. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.d.ts.map +1 -1
  18. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.js +1 -13
  19. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.js.map +1 -1
  20. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.d.ts +0 -1
  21. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.d.ts.map +1 -1
  22. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.js +1 -6
  23. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.js.map +1 -1
  24. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.d.ts +0 -11
  25. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.d.ts.map +1 -1
  26. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.js +2 -46
  27. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.js.map +1 -1
  28. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.d.ts +35 -0
  29. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.d.ts.map +1 -0
  30. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.js +118 -0
  31. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.js.map +1 -0
  32. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.d.ts +0 -2
  33. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.d.ts.map +1 -1
  34. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.js +1 -9
  35. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.js.map +1 -1
  36. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.d.ts +0 -17
  37. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.d.ts.map +1 -1
  38. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.js +6 -109
  39. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.js.map +1 -1
  40. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.d.ts +0 -8
  41. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.d.ts.map +1 -1
  42. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.js +1 -16
  43. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.js.map +1 -1
  44. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.d.ts.map +1 -1
  45. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.js +3 -2
  46. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.js.map +1 -1
  47. package/lib/package.json +4 -4
  48. package/lib/stores/studio/DSLDiagram_ModifierHelper.d.ts +54 -0
  49. package/lib/stores/studio/DSLDiagram_ModifierHelper.d.ts.map +1 -0
  50. package/lib/stores/studio/DSLDiagram_ModifierHelper.js +87 -0
  51. package/lib/stores/studio/DSLDiagram_ModifierHelper.js.map +1 -0
  52. package/package.json +10 -10
  53. package/src/DiagramRenderer.ts +122 -54
  54. package/src/components/studio/DiagramEditor.tsx +8 -3
  55. package/src/helpers/DiagramHelper.ts +4 -3
  56. package/src/index.ts +2 -4
  57. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.ts +1 -14
  58. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.ts +1 -7
  59. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.ts +2 -52
  60. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.ts +165 -0
  61. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.ts +1 -10
  62. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.ts +6 -147
  63. package/src/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.ts +1 -17
  64. package/src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.ts +3 -2
  65. package/src/stores/studio/DSLDiagram_ModifierHelper.ts +148 -0
  66. package/tsconfig.json +2 -0
@@ -45,14 +45,37 @@ import { PositionedRectangle } from './models/metamodels/pure/packageableElement
45
45
  import { ClassView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView';
46
46
  import type { PropertyHolderView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyHolderView';
47
47
  import { GeneralizationView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView';
48
- import {
49
- type RelationshipView,
50
- manageInsidePointsDynamically,
51
- } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView';
48
+ import type { RelationshipView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView';
52
49
  import { PropertyView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView';
53
50
  import { getElementPosition } from './helpers/DiagramHelper';
54
51
  import { AssociationView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView';
55
52
  import { class_addProperty, class_addSuperType } from '@finos/legend-studio';
53
+ import {
54
+ classView_setHideProperties,
55
+ classView_setHideStereotypes,
56
+ classView_setHideTaggedValues,
57
+ diagram_addClassView,
58
+ diagram_addGeneralizationView,
59
+ diagram_addPropertyView,
60
+ diagram_deleteAssociationView,
61
+ diagram_deleteClassView,
62
+ diagram_deleteGeneralizationView,
63
+ diagram_deletePropertyView,
64
+ diagram_setAssociationViews,
65
+ diagram_setClassViews,
66
+ diagram_setGeneralizationViews,
67
+ diagram_setPropertyViews,
68
+ findOrBuildPoint,
69
+ positionedRectangle_forceRefreshHash,
70
+ positionedRectangle_setPosition,
71
+ positionedRectangle_setRectangle,
72
+ relationShipEdgeView_setOffsetX,
73
+ relationShipEdgeView_setOffsetY,
74
+ relationshipView_changePoint,
75
+ relationView_possiblyFlattenPath,
76
+ relationView_setPath,
77
+ } from './stores/studio/DSLDiagram_ModifierHelper';
78
+ import { _relationView_manageInsidePointsDynamically } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper';
56
79
 
57
80
  export enum DIAGRAM_INTERACTION_MODE {
58
81
  LAYOUT,
@@ -601,7 +624,7 @@ export class DiagramRenderer {
601
624
  startClassView,
602
625
  targetClassView,
603
626
  );
604
- this.diagram.addGeneralizationView(gview);
627
+ diagram_addGeneralizationView(this.diagram, gview);
605
628
  return gview;
606
629
  }
607
630
  return undefined;
@@ -632,7 +655,7 @@ export class DiagramRenderer {
632
655
  startClassView,
633
656
  targetClassView,
634
657
  );
635
- this.diagram.addPropertyView(pView);
658
+ diagram_addPropertyView(this.diagram, pView);
636
659
  return pView;
637
660
  }
638
661
  return undefined;
@@ -724,7 +747,7 @@ export class DiagramRenderer {
724
747
  .concat(this.diagram.propertyViews);
725
748
  for (const relationshipView of relationshipViews) {
726
749
  let fullPath = relationshipView.buildFullPath();
727
- fullPath = manageInsidePointsDynamically(
750
+ fullPath = _relationView_manageInsidePointsDynamically(
728
751
  fullPath,
729
752
  relationshipView.from.classView.value,
730
753
  relationshipView.to.classView.value,
@@ -860,7 +883,8 @@ export class DiagramRenderer {
860
883
  id,
861
884
  PackageableElementExplicitReference.create(addedClass),
862
885
  );
863
- newClassView.setPosition(
886
+ positionedRectangle_setPosition(
887
+ newClassView,
864
888
  classViewModelCoordinate ??
865
889
  this.canvasCoordinateToModelCoordinate(
866
890
  new Point(
@@ -871,10 +895,10 @@ export class DiagramRenderer {
871
895
  ),
872
896
  ),
873
897
  );
874
- this.diagram.addClassView(newClassView);
898
+ diagram_addClassView(this.diagram, newClassView);
875
899
  // Refresh hash since ClassView position is not observable
876
900
  // NOTE: here we refresh after adding the class view to the diagram, that way the diagram hash is refreshed
877
- newClassView.forceRefreshHash();
901
+ positionedRectangle_forceRefreshHash(newClassView);
878
902
  this.diagram.classViews
879
903
  .filter((classView) => classView.class.value !== addedClass)
880
904
  .forEach((classView) => {
@@ -885,7 +909,8 @@ export class DiagramRenderer {
885
909
  .map((generalization) => generalization.value.rawType)
886
910
  .includes(_class)
887
911
  ) {
888
- this.diagram.addGeneralizationView(
912
+ diagram_addGeneralizationView(
913
+ this.diagram,
889
914
  new GeneralizationView(this.diagram, newClassView, classView),
890
915
  );
891
916
  }
@@ -894,14 +919,18 @@ export class DiagramRenderer {
894
919
  .map((generalization) => generalization.value.rawType)
895
920
  .includes(addedClass)
896
921
  ) {
897
- this.diagram.addGeneralizationView(
922
+ diagram_addGeneralizationView(
923
+ this.diagram,
924
+
898
925
  new GeneralizationView(this.diagram, classView, newClassView),
899
926
  );
900
927
  }
901
928
  // Add property view
902
929
  addedClass.getAllOwnedProperties().forEach((property) => {
903
930
  if (property.genericType.value.rawType === _class) {
904
- this.diagram.addPropertyView(
931
+ diagram_addPropertyView(
932
+ this.diagram,
933
+
905
934
  new PropertyView(
906
935
  this.diagram,
907
936
  PropertyExplicitReference.create(property),
@@ -913,7 +942,8 @@ export class DiagramRenderer {
913
942
  });
914
943
  _class.getAllOwnedProperties().forEach((property) => {
915
944
  if (property.genericType.value.rawType === addedClass) {
916
- this.diagram.addPropertyView(
945
+ diagram_addPropertyView(
946
+ this.diagram,
917
947
  new PropertyView(
918
948
  this.diagram,
919
949
  PropertyExplicitReference.create(property),
@@ -1452,7 +1482,7 @@ export class DiagramRenderer {
1452
1482
  classView.rectangle.height > classMinHeight
1453
1483
  ? classView.rectangle.height
1454
1484
  : classMinHeight;
1455
- classView.setRectangle(new Rectangle(width, height));
1485
+ positionedRectangle_setRectangle(classView, new Rectangle(width, height));
1456
1486
  }
1457
1487
  }
1458
1488
 
@@ -1630,7 +1660,7 @@ export class DiagramRenderer {
1630
1660
  // NOTE: force hash reload when we redraw class view; this would help with cases where
1631
1661
  // we auto add new properties to the class view, causing the box to expand, hence we need
1632
1662
  // to recompute hash
1633
- classView.forceRefreshHash();
1663
+ positionedRectangle_forceRefreshHash(classView);
1634
1664
  }
1635
1665
 
1636
1666
  private drawLinePropertyNameAndMultiplicity(
@@ -1794,7 +1824,7 @@ export class DiagramRenderer {
1794
1824
 
1795
1825
  private drawPropertyOrAssociation(propertyView: PropertyView): void {
1796
1826
  let fullPath = propertyView.buildFullPath();
1797
- fullPath = manageInsidePointsDynamically(
1827
+ fullPath = _relationView_manageInsidePointsDynamically(
1798
1828
  fullPath,
1799
1829
  propertyView.from.classView.value,
1800
1830
  propertyView.to.classView.value,
@@ -1885,7 +1915,7 @@ export class DiagramRenderer {
1885
1915
  private drawInheritance(inheritance: GeneralizationView): void {
1886
1916
  const rect = inheritance.to.classView.value.rectangle;
1887
1917
  let fullPath = inheritance.buildFullPath();
1888
- fullPath = manageInsidePointsDynamically(
1918
+ fullPath = _relationView_manageInsidePointsDynamically(
1889
1919
  fullPath,
1890
1920
  inheritance.from.classView.value,
1891
1921
  inheritance.to.classView.value,
@@ -2043,7 +2073,8 @@ export class DiagramRenderer {
2043
2073
  selectedClasses.indexOf(assoView.from.classView.value) !== -1 &&
2044
2074
  selectedClasses.indexOf(assoView.to.classView.value) !== -1
2045
2075
  ) {
2046
- assoView.setPath(
2076
+ relationView_setPath(
2077
+ assoView,
2047
2078
  assoView.path.map(
2048
2079
  (point) =>
2049
2080
  new Point(point.x - newMovingDeltaX, point.y - newMovingDeltaY),
@@ -2058,8 +2089,10 @@ export class DiagramRenderer {
2058
2089
  if ('Delete' === e.key) {
2059
2090
  if (!this.isReadOnly) {
2060
2091
  this.selectedClasses.forEach((classView) => {
2061
- this.diagram.deleteClassView(classView);
2062
- this.diagram.setAssociationViews(
2092
+ diagram_deleteClassView(this.diagram, classView);
2093
+ diagram_setAssociationViews(
2094
+ this.diagram,
2095
+
2063
2096
  this.diagram.associationViews.filter(
2064
2097
  (associationView) =>
2065
2098
  !(
@@ -2068,7 +2101,9 @@ export class DiagramRenderer {
2068
2101
  ),
2069
2102
  ),
2070
2103
  );
2071
- this.diagram.setGeneralizationViews(
2104
+ diagram_setGeneralizationViews(
2105
+ this.diagram,
2106
+
2072
2107
  this.diagram.generalizationViews.filter(
2073
2108
  (generalizationView) =>
2074
2109
  !(
@@ -2077,7 +2112,9 @@ export class DiagramRenderer {
2077
2112
  ),
2078
2113
  ),
2079
2114
  );
2080
- this.diagram.setPropertyViews(
2115
+ diagram_setPropertyViews(
2116
+ this.diagram,
2117
+
2081
2118
  this.diagram.propertyViews.filter(
2082
2119
  (propertyView) =>
2083
2120
  !(
@@ -2088,11 +2125,16 @@ export class DiagramRenderer {
2088
2125
  );
2089
2126
  });
2090
2127
  if (this.selectedPropertyOrAssociation instanceof AssociationView) {
2091
- this.diagram.deleteAssociationView(
2128
+ diagram_deleteAssociationView(
2129
+ this.diagram,
2130
+
2092
2131
  this.selectedPropertyOrAssociation,
2093
2132
  );
2094
2133
  } else if (this.selectedPropertyOrAssociation instanceof PropertyView) {
2095
- this.diagram.deletePropertyView(this.selectedPropertyOrAssociation);
2134
+ diagram_deletePropertyView(
2135
+ this.diagram,
2136
+ this.selectedPropertyOrAssociation,
2137
+ );
2096
2138
  }
2097
2139
  if (this.selectedInheritance) {
2098
2140
  if (
@@ -2101,7 +2143,10 @@ export class DiagramRenderer {
2101
2143
  generalizationView === this.selectedInheritance,
2102
2144
  )
2103
2145
  ) {
2104
- this.diagram.deleteGeneralizationView(this.selectedInheritance);
2146
+ diagram_deleteGeneralizationView(
2147
+ this.diagram,
2148
+ this.selectedInheritance,
2149
+ );
2105
2150
  }
2106
2151
  }
2107
2152
  this.selectedClasses = [];
@@ -2208,7 +2253,7 @@ export class DiagramRenderer {
2208
2253
  if (!this.isReadOnly) {
2209
2254
  if (this.selectedClasses.length !== 0) {
2210
2255
  this.selectedClasses.forEach((classView) => {
2211
- classView.setHideProperties(!classView.hideProperties);
2256
+ classView_setHideProperties(classView, !classView.hideProperties);
2212
2257
  });
2213
2258
  this.drawScreen();
2214
2259
  }
@@ -2219,7 +2264,7 @@ export class DiagramRenderer {
2219
2264
  if (!this.isReadOnly) {
2220
2265
  if (this.selectedClasses.length !== 0) {
2221
2266
  this.selectedClasses.forEach((classView) => {
2222
- classView.setHideStereotypes(!classView.hideStereotypes);
2267
+ classView_setHideStereotypes(classView, !classView.hideStereotypes);
2223
2268
  });
2224
2269
  this.drawScreen();
2225
2270
  }
@@ -2230,7 +2275,10 @@ export class DiagramRenderer {
2230
2275
  if (!this.isReadOnly) {
2231
2276
  if (this.selectedClasses.length !== 0) {
2232
2277
  this.selectedClasses.forEach((classView) => {
2233
- classView.setHideTaggedValues(!classView.hideTaggedValues);
2278
+ classView_setHideTaggedValues(
2279
+ classView,
2280
+ !classView.hideTaggedValues,
2281
+ );
2234
2282
  });
2235
2283
  this.drawScreen();
2236
2284
  }
@@ -2285,8 +2333,8 @@ export class DiagramRenderer {
2285
2333
  1,
2286
2334
  );
2287
2335
  const res = this.layoutTaxonomy(views, this.diagram, false, true);
2288
- res[0].forEach((cv) => this.diagram.addClassView(cv));
2289
- res[1].forEach((gv) => this.diagram.addGeneralizationView(gv));
2336
+ res[0].forEach((cv) => diagram_addClassView(this.diagram, cv));
2337
+ res[1].forEach((gv) => diagram_addGeneralizationView(this.diagram, gv));
2290
2338
 
2291
2339
  this.drawScreen();
2292
2340
  }
@@ -2318,8 +2366,8 @@ export class DiagramRenderer {
2318
2366
  false,
2319
2367
  false,
2320
2368
  );
2321
- res[0].forEach((cv) => this.diagram.addClassView(cv));
2322
- res[1].forEach((gv) => this.diagram.addGeneralizationView(gv));
2369
+ res[0].forEach((cv) => diagram_addClassView(this.diagram, cv));
2370
+ res[1].forEach((gv) => diagram_addGeneralizationView(this.diagram, gv));
2323
2371
  }
2324
2372
 
2325
2373
  this.drawScreen();
@@ -2331,13 +2379,13 @@ export class DiagramRenderer {
2331
2379
  switch (this.interactionMode) {
2332
2380
  case DIAGRAM_INTERACTION_MODE.LAYOUT: {
2333
2381
  this.diagram.generalizationViews.forEach((generalizationView) =>
2334
- generalizationView.possiblyFlattenPath(),
2382
+ relationView_possiblyFlattenPath(generalizationView),
2335
2383
  );
2336
2384
  this.diagram.associationViews.forEach((associationView) =>
2337
- associationView.possiblyFlattenPath(),
2385
+ relationView_possiblyFlattenPath(associationView),
2338
2386
  );
2339
2387
  this.diagram.propertyViews.forEach((propertyView) =>
2340
- propertyView.possiblyFlattenPath(),
2388
+ relationView_possiblyFlattenPath(propertyView),
2341
2389
  );
2342
2390
  break;
2343
2391
  }
@@ -2425,28 +2473,32 @@ export class DiagramRenderer {
2425
2473
  );
2426
2474
 
2427
2475
  if (gview) {
2428
- gview.from.setOffsetX(
2476
+ relationShipEdgeView_setOffsetX(
2477
+ gview.from,
2429
2478
  -(
2430
2479
  this.startClassView.position.x +
2431
2480
  this.startClassView.rectangle.width / 2 -
2432
2481
  this.selectionStart.x
2433
2482
  ),
2434
2483
  );
2435
- gview.from.setOffsetY(
2484
+ relationShipEdgeView_setOffsetY(
2485
+ gview.from,
2436
2486
  -(
2437
2487
  this.startClassView.position.y +
2438
2488
  this.startClassView.rectangle.height / 2 -
2439
2489
  this.selectionStart.y
2440
2490
  ),
2441
2491
  );
2442
- gview.to.setOffsetX(
2492
+ relationShipEdgeView_setOffsetX(
2493
+ gview.to,
2443
2494
  -(
2444
2495
  targetClassView.position.x +
2445
2496
  targetClassView.rectangle.width / 2 -
2446
2497
  eventPointInModelCoordinate.x
2447
2498
  ),
2448
2499
  );
2449
- gview.to.setOffsetY(
2500
+ relationShipEdgeView_setOffsetY(
2501
+ gview.to,
2450
2502
  -(
2451
2503
  targetClassView.position.y +
2452
2504
  targetClassView.rectangle.height / 2 -
@@ -2591,7 +2643,8 @@ export class DiagramRenderer {
2591
2643
  this.setSelectedClassCorner(this.diagram.classViews[i]);
2592
2644
  if (!this.isReadOnly) {
2593
2645
  // Bring the class view to front
2594
- this.diagram.setClassViews(
2646
+ diagram_setClassViews(
2647
+ this.diagram,
2595
2648
  this.reorderDiagramDomain(
2596
2649
  guaranteeNonNullable(this.selectedClassCorner),
2597
2650
  this.diagram,
@@ -2631,7 +2684,9 @@ export class DiagramRenderer {
2631
2684
  }
2632
2685
  if (!this.isReadOnly) {
2633
2686
  // Bring the class view to front
2634
- this.diagram.setClassViews(
2687
+ diagram_setClassViews(
2688
+ this.diagram,
2689
+
2635
2690
  this.reorderDiagramDomain(
2636
2691
  this.selectedClasses[0] as ClassView,
2637
2692
  this.diagram,
@@ -2669,7 +2724,8 @@ export class DiagramRenderer {
2669
2724
  // check for selection of inheritance view
2670
2725
  for (const generalizationView of this.diagram
2671
2726
  .generalizationViews) {
2672
- const val = generalizationView.findOrBuildPoint(
2727
+ const val = findOrBuildPoint(
2728
+ generalizationView,
2673
2729
  eventPointInModelCoordinate.x,
2674
2730
  eventPointInModelCoordinate.y,
2675
2731
  this.zoom,
@@ -2685,7 +2741,8 @@ export class DiagramRenderer {
2685
2741
  // check for selection of association view
2686
2742
  if (!this.selectedPoint) {
2687
2743
  for (const associationView of this.diagram.associationViews) {
2688
- const val = associationView.findOrBuildPoint(
2744
+ const val = findOrBuildPoint(
2745
+ associationView,
2689
2746
  eventPointInModelCoordinate.x,
2690
2747
  eventPointInModelCoordinate.y,
2691
2748
  this.zoom,
@@ -2702,7 +2759,8 @@ export class DiagramRenderer {
2702
2759
  // check for selection of property view
2703
2760
  if (!this.selectedPoint) {
2704
2761
  for (const propertyView of this.diagram.propertyViews) {
2705
- const val = propertyView.findOrBuildPoint(
2762
+ const val = findOrBuildPoint(
2763
+ propertyView,
2706
2764
  eventPointInModelCoordinate.x,
2707
2765
  eventPointInModelCoordinate.y,
2708
2766
  this.zoom,
@@ -2810,7 +2868,8 @@ export class DiagramRenderer {
2810
2868
  // Resize class view
2811
2869
  if (this.selectedClassCorner) {
2812
2870
  // Make sure width and height are in range!
2813
- this.selectedClassCorner.setRectangle(
2871
+ positionedRectangle_setRectangle(
2872
+ this.selectedClassCorner,
2814
2873
  new Rectangle(
2815
2874
  eventPointInModelCoordinate.x -
2816
2875
  this.selectedClassCorner.position.x,
@@ -2819,7 +2878,7 @@ export class DiagramRenderer {
2819
2878
  ),
2820
2879
  );
2821
2880
  // Refresh hash since ClassView rectangle is not observable
2822
- this.selectedClassCorner.forceRefreshHash();
2881
+ positionedRectangle_forceRefreshHash(this.selectedClassCorner);
2823
2882
  this.drawClassView(this.selectedClassCorner);
2824
2883
  this.drawScreen();
2825
2884
  }
@@ -2846,9 +2905,12 @@ export class DiagramRenderer {
2846
2905
  (this.clickY - selectedClassOldPosition.oldPos.y);
2847
2906
  newMovingDeltaX = selectedClass.position.x - newMovingX;
2848
2907
  newMovingDeltaY = selectedClass.position.y - newMovingY;
2849
- selectedClass.setPosition(new Point(newMovingX, newMovingY));
2908
+ positionedRectangle_setPosition(
2909
+ selectedClass,
2910
+ new Point(newMovingX, newMovingY),
2911
+ );
2850
2912
  // Refresh hash since ClassView position is not observable
2851
- selectedClass.forceRefreshHash();
2913
+ positionedRectangle_forceRefreshHash(selectedClass);
2852
2914
  }
2853
2915
  });
2854
2916
  this.potentiallyShiftRelationships(
@@ -2876,12 +2938,14 @@ export class DiagramRenderer {
2876
2938
  // Change line (add a new point to the line)
2877
2939
  if (this.selectedPoint) {
2878
2940
  if (this.selectedPropertyOrAssociation) {
2879
- this.selectedPropertyOrAssociation.changePoint(
2941
+ relationshipView_changePoint(
2942
+ this.selectedPropertyOrAssociation,
2880
2943
  this.selectedPoint,
2881
2944
  eventPointInModelCoordinate,
2882
2945
  );
2883
2946
  } else if (this.selectedInheritance) {
2884
- this.selectedInheritance.changePoint(
2947
+ relationshipView_changePoint(
2948
+ this.selectedInheritance,
2885
2949
  this.selectedPoint,
2886
2950
  eventPointInModelCoordinate,
2887
2951
  );
@@ -3101,7 +3165,7 @@ export class DiagramRenderer {
3101
3165
  ];
3102
3166
  for (const propertyHolderView of propertyHolderViews) {
3103
3167
  let fullPath = propertyHolderView.buildFullPath();
3104
- fullPath = manageInsidePointsDynamically(
3168
+ fullPath = _relationView_manageInsidePointsDynamically(
3105
3169
  fullPath,
3106
3170
  propertyHolderView.from.classView.value,
3107
3171
  propertyHolderView.to.classView.value,
@@ -3233,11 +3297,15 @@ export class DiagramRenderer {
3233
3297
 
3234
3298
  // Set layout of current level
3235
3299
  if (positionInitialClass || currentLevelIndex > 0) {
3236
- (levels[0] as ClassView).setPosition(new Point(startX, currentLevelY));
3300
+ positionedRectangle_setPosition(
3301
+ levels[0] as ClassView,
3302
+ new Point(startX, currentLevelY),
3303
+ );
3237
3304
  levels.forEach((view, idx) => {
3238
3305
  if (idx > 0) {
3239
3306
  const precedent = levels[idx - 1] as ClassView;
3240
- view.setPosition(
3307
+ positionedRectangle_setPosition(
3308
+ view,
3241
3309
  new Point(
3242
3310
  precedent.position.x + precedent.rectangle.width + spaceX,
3243
3311
  currentLevelY,
@@ -108,6 +108,11 @@ import {
108
108
  import { cleanUpDeadReferencesInDiagram } from '../../helpers/DiagramHelper';
109
109
  import { Point } from '../../models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Point';
110
110
  import type { DSLDiagram_LegendStudioPlugin_Extension } from './DSLDiagram_LegendStudioPlugin_Extension';
111
+ import {
112
+ classView_setHideProperties,
113
+ classView_setHideStereotypes,
114
+ classView_setHideTaggedValues,
115
+ } from '../../stores/studio/DSLDiagram_ModifierHelper';
111
116
 
112
117
  const DiagramEditorContextMenu = observer(
113
118
  forwardRef<
@@ -519,21 +524,21 @@ const DiagramEditorClassViewEditor = observer(
519
524
  if (isReadOnly) {
520
525
  return;
521
526
  }
522
- classView.setHideProperties(!classView.hideProperties);
527
+ classView_setHideProperties(classView, !classView.hideProperties);
523
528
  diagramEditorState.renderer.render();
524
529
  };
525
530
  const toggleHideTaggedValues = (): void => {
526
531
  if (isReadOnly) {
527
532
  return;
528
533
  }
529
- classView.setHideTaggedValues(!classView.hideTaggedValues);
534
+ classView_setHideTaggedValues(classView, !classView.hideTaggedValues);
530
535
  diagramEditorState.renderer.render();
531
536
  };
532
537
  const toggleHideStereotypes = (): void => {
533
538
  if (isReadOnly) {
534
539
  return;
535
540
  }
536
- classView.setHideStereotypes(!classView.hideStereotypes);
541
+ classView_setHideStereotypes(classView, !classView.hideStereotypes);
537
542
  diagramEditorState.renderer.render();
538
543
  };
539
544
 
@@ -15,6 +15,7 @@
15
15
  */
16
16
 
17
17
  import type { PureModel } from '@finos/legend-graph';
18
+ import { deleteEntry } from '@finos/legend-shared';
18
19
  import type { ClassView } from '../models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView';
19
20
  import type { Diagram } from '../models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram';
20
21
  import { Point } from '../models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Point';
@@ -51,14 +52,14 @@ export const cleanUpDeadReferencesInDiagram = (
51
52
  .includes(propertyView.property.value.name),
52
53
  );
53
54
  propertyViewsToRemove.forEach((propertyView) =>
54
- diagram.deletePropertyView(propertyView),
55
+ deleteEntry(diagram.propertyViews, propertyView),
55
56
  );
56
57
 
57
58
  // Fix orphan class views
58
59
  const classViewsToRemove = diagram.classViews.filter(
59
60
  (cv) => !graph.getNullableClass(cv.class.value.path),
60
61
  );
61
- classViewsToRemove.forEach((cw) => diagram.deleteClassView(cw));
62
+ classViewsToRemove.forEach((cw) => deleteEntry(diagram.classViews, cw));
62
63
 
63
64
  // Fix orphan gneralization views
64
65
  const generalizationViewsToRemove = diagram.generalizationViews.filter(
@@ -74,6 +75,6 @@ export const cleanUpDeadReferencesInDiagram = (
74
75
  },
75
76
  );
76
77
  generalizationViewsToRemove.forEach((g) =>
77
- diagram.deleteGeneralizationView(g),
78
+ deleteEntry(diagram.generalizationViews, g),
78
79
  );
79
80
  };
package/src/index.ts CHANGED
@@ -24,10 +24,8 @@ export { DiagramRenderer, DIAGRAM_INTERACTION_MODE } from './DiagramRenderer';
24
24
 
25
25
  export { Diagram } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram';
26
26
  export { ClassView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView';
27
- export {
28
- RelationshipView,
29
- manageInsidePointsDynamically,
30
- } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView';
27
+ export { RelationshipView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView';
28
+ export { _relationView_manageInsidePointsDynamically } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper';
31
29
  export { PropertyHolderView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyHolderView';
32
30
  export { PropertyView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView';
33
31
  export { AssociationView } from './models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView';
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { computed, observable, action, makeObservable } from 'mobx';
17
+ import { computed, observable, makeObservable } from 'mobx';
18
18
  import { hashArray, type Hashable } from '@finos/legend-shared';
19
19
  import { PositionedRectangle } from './geometry/DSLDiagram_PositionedRectangle';
20
20
  import { Rectangle } from './geometry/DSLDiagram_Rectangle';
@@ -43,9 +43,6 @@ export class ClassView extends PositionedRectangle implements Hashable {
43
43
  hideProperties: observable,
44
44
  hideTaggedValues: observable,
45
45
  hideStereotypes: observable,
46
- setHideProperties: action,
47
- setHideStereotypes: action,
48
- setHideTaggedValues: action,
49
46
  hashCode: computed,
50
47
  });
51
48
 
@@ -54,16 +51,6 @@ export class ClassView extends PositionedRectangle implements Hashable {
54
51
  this.class = _class;
55
52
  }
56
53
 
57
- setHideProperties(val: boolean): void {
58
- this.hideProperties = val;
59
- }
60
- setHideStereotypes(val: boolean): void {
61
- this.hideStereotypes = val;
62
- }
63
- setHideTaggedValues(val: boolean): void {
64
- this.hideTaggedValues = val;
65
- }
66
-
67
54
  override get hashCode(): string {
68
55
  return hashArray([
69
56
  DIAGRAM_HASH_STRUCTURE.CLASS_VIEW,
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { observable, action, makeObservable } from 'mobx';
17
+ import { observable, makeObservable } from 'mobx';
18
18
  import type { Diagram } from './DSLDiagram_Diagram';
19
19
  import type { ClassView } from './DSLDiagram_ClassView';
20
20
  import {
@@ -36,17 +36,11 @@ export abstract class ClassViewReference extends ReferenceWithOwner {
36
36
 
37
37
  makeObservable(this, {
38
38
  value: observable,
39
- setValue: action,
40
39
  });
41
40
 
42
41
  this.ownerReference = ownerReference;
43
42
  this.value = value;
44
43
  }
45
-
46
- setValue(value: ClassView): void {
47
- this.value = value;
48
- this.ownerReference.value = value.owner;
49
- }
50
44
  }
51
45
 
52
46
  export class ClassViewExplicitReference extends ClassViewReference {