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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. package/lib/DiagramRenderer.d.ts +4 -1
  2. package/lib/DiagramRenderer.d.ts.map +1 -1
  3. package/lib/DiagramRenderer.js +21 -23
  4. package/lib/DiagramRenderer.js.map +1 -1
  5. package/lib/components/studio/ClassDiagramPreview.d.ts.map +1 -1
  6. package/lib/components/studio/ClassDiagramPreview.js +3 -1
  7. package/lib/components/studio/ClassDiagramPreview.js.map +1 -1
  8. package/lib/components/studio/DiagramEditor.d.ts.map +1 -1
  9. package/lib/components/studio/DiagramEditor.js +8 -5
  10. package/lib/components/studio/DiagramEditor.js.map +1 -1
  11. package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.d.ts +2 -1
  12. package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.d.ts.map +1 -1
  13. package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.js +11 -0
  14. package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.js.map +1 -1
  15. package/lib/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.d.ts +34 -0
  16. package/lib/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.d.ts.map +1 -0
  17. package/lib/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.js +94 -0
  18. package/lib/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.js.map +1 -0
  19. package/lib/helpers/DiagramHelper.d.ts +16 -1
  20. package/lib/helpers/DiagramHelper.d.ts.map +1 -1
  21. package/lib/helpers/DiagramHelper.js +87 -1
  22. package/lib/helpers/DiagramHelper.js.map +1 -1
  23. package/lib/index.css +1 -1
  24. package/lib/index.d.ts +0 -1
  25. package/lib/index.d.ts.map +1 -1
  26. package/lib/index.js +0 -1
  27. package/lib/index.js.map +1 -1
  28. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.d.ts.map +1 -1
  29. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.js +0 -4
  30. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.js.map +1 -1
  31. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.d.ts.map +1 -1
  32. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.js +0 -8
  33. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.js.map +1 -1
  34. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.d.ts.map +1 -1
  35. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.js +0 -4
  36. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.js.map +1 -1
  37. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.d.ts +0 -1
  38. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.d.ts.map +1 -1
  39. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.js +0 -11
  40. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.js.map +1 -1
  41. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.d.ts +0 -3
  42. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.d.ts.map +1 -1
  43. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.js +0 -7
  44. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.js.map +1 -1
  45. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.d.ts +0 -4
  46. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.d.ts.map +1 -1
  47. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.js +0 -7
  48. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.js.map +1 -1
  49. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.d.ts +6 -1
  50. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.d.ts.map +1 -1
  51. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.js +6 -6
  52. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.js.map +1 -1
  53. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.d.ts +24 -6
  54. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.d.ts.map +1 -1
  55. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.js +58 -27
  56. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.js.map +1 -1
  57. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.d.ts.map +1 -1
  58. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.js +0 -4
  59. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.js.map +1 -1
  60. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Vector.d.ts +3 -3
  61. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Vector.d.ts.map +1 -1
  62. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Vector.js +1 -1
  63. package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Vector.js.map +1 -1
  64. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.d.ts.map +1 -1
  65. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.js +3 -4
  66. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.js.map +1 -1
  67. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.js +2 -2
  68. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.js.map +1 -1
  69. package/lib/package.json +3 -3
  70. package/lib/stores/studio/{DSLDiagram_ModifierHelper.d.ts → DSLDiagram_GraphModifierHelper.d.ts} +10 -7
  71. package/lib/stores/studio/DSLDiagram_GraphModifierHelper.d.ts.map +1 -0
  72. package/lib/stores/studio/{DSLDiagram_ModifierHelper.js → DSLDiagram_GraphModifierHelper.js} +20 -13
  73. package/lib/stores/studio/DSLDiagram_GraphModifierHelper.js.map +1 -0
  74. package/lib/stores/studio/DiagramEditorState.d.ts.map +1 -1
  75. package/lib/stores/studio/DiagramEditorState.js +10 -7
  76. package/lib/stores/studio/DiagramEditorState.js.map +1 -1
  77. package/package.json +10 -10
  78. package/src/DiagramRenderer.ts +31 -34
  79. package/src/components/studio/ClassDiagramPreview.tsx +3 -1
  80. package/src/components/studio/DiagramEditor.tsx +10 -4
  81. package/src/graphManager/DSLDiagram_PureGraphManagerPlugin.ts +17 -0
  82. package/src/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.ts +153 -0
  83. package/src/helpers/DiagramHelper.ts +122 -1
  84. package/src/index.ts +0 -1
  85. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.ts +0 -6
  86. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.ts +0 -10
  87. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.ts +0 -6
  88. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.ts +0 -13
  89. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.ts +0 -11
  90. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.ts +0 -17
  91. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.ts +6 -7
  92. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.ts +77 -34
  93. package/src/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.ts +0 -5
  94. package/src/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Vector.ts +3 -3
  95. package/src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.ts +6 -4
  96. package/src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.ts +4 -4
  97. package/src/stores/studio/{DSLDiagram_ModifierHelper.ts → DSLDiagram_GraphModifierHelper.ts} +34 -18
  98. package/src/stores/studio/DiagramEditorState.ts +26 -7
  99. package/tsconfig.json +2 -2
  100. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.d.ts +0 -35
  101. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.d.ts.map +0 -1
  102. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.js +0 -118
  103. package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.js.map +0 -1
  104. package/lib/stores/studio/DSLDiagram_ModifierHelper.d.ts.map +0 -1
  105. package/lib/stores/studio/DSLDiagram_ModifierHelper.js.map +0 -1
  106. package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.ts +0 -165
@@ -14,30 +14,31 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { observable, computed, makeObservable } from 'mobx';
18
17
  import { hashArray, type Hashable } from '@finos/legend-shared';
19
- import { RelationShipEdgeView as RelationshipEdgeView } from './DSLDiagram_RelationshipEdgeView';
18
+ import { RelationshipEdgeView } from './DSLDiagram_RelationshipEdgeView';
20
19
  import { Point } from './geometry/DSLDiagram_Point';
21
20
  import type { ClassView } from './DSLDiagram_ClassView';
22
21
  import type { Diagram } from './DSLDiagram_Diagram';
23
22
  import { ClassViewExplicitReference } from './DSLDiagram_ClassViewReference';
24
23
  import { DIAGRAM_HASH_STRUCTURE } from '../../../../DSLDiagram_ModelUtils';
25
- import { _relationView_manageInsidePointsDynamically } from './DSLDiagram_GraphModifierHelper';
26
24
 
27
25
  export class RelationshipView implements Hashable {
28
26
  owner: Diagram;
29
27
  from: RelationshipEdgeView;
30
28
  to: RelationshipEdgeView;
31
- // NOTE: to optimize performance for diagram, we have made classview's position and rectangle non-observable
32
- // if we want to further optimize, perhaps we can also remove observability from path
29
+ /**
30
+ * NOTE: Unlike in the protocol model, we don't store the end points in the path but only store the
31
+ * offsets of that point from the center of the end/start classviews. The main purpose here is to
32
+ * make less error. We don't need to bother maintaining these points in the path. They are
33
+ * auto-managed. Even if an erroneous path is set (e.g. an empty list of points), this logic
34
+ * that we have will rectify that and create a sensible path.
35
+ *
36
+ * In exchange, this logic is a little complicated, we have tried to document as much about it as we could
37
+ * but the logic is not straight forward. Perhaps, we could simplify this in the future.
38
+ */
33
39
  path: Point[] = [];
34
40
 
35
41
  constructor(owner: Diagram, from: ClassView, to: ClassView) {
36
- makeObservable(this, {
37
- path: observable,
38
- fullPath: computed,
39
- });
40
-
41
42
  this.owner = owner;
42
43
  this.from = new RelationshipEdgeView(
43
44
  ClassViewExplicitReference.create(from),
@@ -45,29 +46,6 @@ export class RelationshipView implements Hashable {
45
46
  this.to = new RelationshipEdgeView(ClassViewExplicitReference.create(to));
46
47
  }
47
48
 
48
- /**
49
- * Compute the full path for an edge, but notice here that the end points are recomputed every time, as such
50
- * `path` only stores point that matters to the edge but are not end points
51
- */
52
- buildFullPath(allowChange = true): Point[] {
53
- return [
54
- this.computeEdgeEndpoint(this.from, allowChange),
55
- ...this.path,
56
- this.computeEdgeEndpoint(this.to, allowChange),
57
- ];
58
- }
59
-
60
- /**
61
- * This method will compute the full path from the offset within class view for persistence purpose
62
- */
63
- get fullPath(): Point[] {
64
- return _relationView_manageInsidePointsDynamically(
65
- this.buildFullPath(),
66
- this.from.classView.value,
67
- this.to.classView.value,
68
- );
69
- }
70
-
71
49
  /**
72
50
  * Calculate the end points of the edge using offset, otherwise, use the center
73
51
  */
@@ -89,12 +67,77 @@ export class RelationshipView implements Hashable {
89
67
  return new Point(center.x, center.y);
90
68
  }
91
69
 
70
+ /**
71
+ * Compute the full path for the relationship view (including the ends even if these
72
+ * ends lie inside of the classviews)
73
+ *
74
+ * Notice here that the end points are recomputed every time, as such
75
+ * `path` only stores point that matters to the edge but are not end points
76
+ */
77
+ buildFullPath(allowChange = true): Point[] {
78
+ return [
79
+ this.computeEdgeEndpoint(this.from, allowChange),
80
+ ...this.path,
81
+ this.computeEdgeEndpoint(this.to, allowChange),
82
+ ];
83
+ }
84
+
85
+ /**
86
+ * For a path, only keep **at most** 1 point at each end that lies inside the class view.
87
+ * If there is no inside points, none of kept, so the path only contains outside points.
88
+ */
89
+ static pruneUnnecessaryInsidePoints = (
90
+ path: Point[],
91
+ from: ClassView,
92
+ to: ClassView,
93
+ ): Point[] => {
94
+ if (!path.length) {
95
+ return [];
96
+ }
97
+
98
+ let start = 0;
99
+ let startPoint = path[start] as Point;
100
+
101
+ while (
102
+ start < path.length - 1 &&
103
+ from.contains(startPoint.x, startPoint.y)
104
+ ) {
105
+ start++;
106
+ startPoint = path[start] as Point;
107
+ }
108
+
109
+ // NOTE: due to the usage path, we could make sure `end > start`, but maybe this
110
+ // is an improvement to be done
111
+
112
+ let end = path.length - 1;
113
+ let endPoint = path[end] as Point;
114
+
115
+ while (end > 0 && to.contains(endPoint.x, endPoint.y)) {
116
+ end--;
117
+ endPoint = path[end] as Point;
118
+ }
119
+
120
+ // NOTE: slice upper bound is exclusive, hence the +2 instead of +1
121
+ return path.slice(start - 1, end + 2);
122
+ };
123
+
124
+ /**
125
+ * This method will compute the full path from the offset within class view for serialization and persistence purpose
126
+ */
127
+ get pathForSerialization(): Point[] {
128
+ return RelationshipView.pruneUnnecessaryInsidePoints(
129
+ this.buildFullPath(),
130
+ this.from.classView.value,
131
+ this.to.classView.value,
132
+ );
133
+ }
134
+
92
135
  get hashCode(): string {
93
136
  return hashArray([
94
137
  DIAGRAM_HASH_STRUCTURE.RELATIONSHIP_VIEW,
95
138
  this.from.classView.value.id,
96
139
  this.to.classView.value.id,
97
- hashArray(this.fullPath),
140
+ hashArray(this.pathForSerialization),
98
141
  ]);
99
142
  }
100
143
  }
@@ -14,7 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { observable, makeObservable } from 'mobx';
18
17
  import { hashArray, type Hashable } from '@finos/legend-shared';
19
18
  import { Point } from './DSLDiagram_Point';
20
19
  import { Rectangle } from './DSLDiagram_Rectangle';
@@ -26,10 +25,6 @@ export class PositionedRectangle implements Hashable {
26
25
  dummyObservable = {};
27
26
 
28
27
  constructor(position: Point, rectangle: Rectangle) {
29
- makeObservable(this, {
30
- dummyObservable: observable,
31
- });
32
-
33
28
  this.position = position;
34
29
  this.rectangle = rectangle;
35
30
  }
@@ -17,8 +17,8 @@
17
17
  import type { Point } from './DSLDiagram_Point';
18
18
 
19
19
  export class Vector {
20
- x: number;
21
- y: number;
20
+ readonly x: number;
21
+ readonly y: number;
22
22
 
23
23
  constructor(x: number, y: number) {
24
24
  this.x = x;
@@ -29,7 +29,7 @@ export class Vector {
29
29
  return new Vector(b.x - a.x, b.y - a.y);
30
30
  }
31
31
 
32
- norm(): Vector {
32
+ unit(): Vector {
33
33
  const norm = Math.sqrt(this.x * this.x + this.y * this.y);
34
34
  return new Vector(this.x / norm, this.y / norm);
35
35
  }
@@ -35,8 +35,10 @@ import type { V1_Point } from '../../model/packageableElements/diagram/geometry/
35
35
  import type { V1_Rectangle } from '../../model/packageableElements/diagram/geometry/V1_DSLDiagram_Rectangle';
36
36
  import type { V1_PropertyView } from '../../model/packageableElements/diagram/V1_DSLDiagram_PropertyView';
37
37
  import type { V1_GeneralizationView } from '../../model/packageableElements/diagram/V1_DSLDiagram_GeneralizationView';
38
- import { getClassView } from '../../../../../../helpers/DiagramHelper';
39
- import { _relationView_possiblyFlattenPath } from '../../../../../metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper';
38
+ import {
39
+ getClassView,
40
+ _relationshipView_simplifyPath,
41
+ } from '../../../../../../helpers/DiagramHelper';
40
42
 
41
43
  const buildPoint = (point: V1_Point): Point => {
42
44
  const x = guaranteeNonNullable(point.x, `Point 'x' coordinate is missing`);
@@ -116,7 +118,7 @@ export const V1_buildPropertyView = (
116
118
  targetClassView,
117
119
  );
118
120
  view.path = propertyView.line.points.map((point) => buildPoint(point));
119
- _relationView_possiblyFlattenPath(view); // transform the line because we store only 2 end points that are inside points and we will calculate the offset
121
+ _relationshipView_simplifyPath(view); // transform the line because we store only 2 end points that are inside points and we will calculate the offset
120
122
  return view;
121
123
  };
122
124
 
@@ -142,7 +144,7 @@ export const V1_buildGeneralizationView = (
142
144
  targetClassView,
143
145
  );
144
146
  view.path = generalizationView.line.points.map((point) => buildPoint(point));
145
- _relationView_possiblyFlattenPath(view); // transform the line because we store only 2 end points that are inside points and we will calculate the offset
147
+ _relationshipView_simplifyPath(view); // transform the line because we store only 2 end points that are inside points and we will calculate the offset
146
148
  return view;
147
149
  };
148
150
 
@@ -18,7 +18,7 @@ import type { ClassView } from '../../../../../metamodels/pure/packageableElemen
18
18
  import type { Diagram } from '../../../../../metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram';
19
19
  import type { GeneralizationView } from '../../../../../metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView';
20
20
  import type { PropertyView } from '../../../../../metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView';
21
- import type { RelationShipEdgeView } from '../../../../../metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView';
21
+ import type { RelationshipEdgeView } from '../../../../../metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView';
22
22
  import { V1_Point } from '../../model/packageableElements/diagram/geometry/V1_DSLDiagram_Point';
23
23
  import { V1_ClassView } from '../../model/packageableElements/diagram/V1_DSLDiagram_ClassView';
24
24
  import { V1_Diagram } from '../../model/packageableElements/diagram/V1_DSLDiagram_Diagram';
@@ -32,7 +32,7 @@ import {
32
32
  V1_transformPropertyReference,
33
33
  } from '@finos/legend-graph';
34
34
 
35
- const relationshipEdgeViewTransformer = (value: RelationShipEdgeView): string =>
35
+ const relationshipEdgeViewTransformer = (value: RelationshipEdgeView): string =>
36
36
  value.classView.value.id;
37
37
 
38
38
  const createRectangle = (height: number, width: number): V1_Rectangle => {
@@ -52,7 +52,7 @@ const createPoint = (x: number, y: number): V1_Point => {
52
52
  const transformPropertyView = (element: PropertyView): V1_PropertyView => {
53
53
  const view = new V1_PropertyView();
54
54
  const line = new V1_Line();
55
- line.points = element.fullPath;
55
+ line.points = element.pathForSerialization;
56
56
  view.line = line;
57
57
  view.property = V1_transformPropertyReference(element.property);
58
58
  view.sourceView = relationshipEdgeViewTransformer(element.from);
@@ -65,7 +65,7 @@ const transformGenerationView = (
65
65
  ): V1_GeneralizationView => {
66
66
  const view = new V1_GeneralizationView();
67
67
  const line = new V1_Line();
68
- line.points = element.fullPath;
68
+ line.points = element.pathForSerialization;
69
69
  view.line = line;
70
70
  view.sourceView = relationshipEdgeViewTransformer(element.from);
71
71
  view.targetView = relationshipEdgeViewTransformer(element.to);
@@ -22,24 +22,30 @@ import type { Diagram } from '../../models/metamodels/pure/packageableElements/d
22
22
  import type { GeneralizationView } from '../../models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView';
23
23
  import {
24
24
  _findOrBuildPoint,
25
- _relationView_possiblyFlattenPath,
26
- _relationView_setPath,
27
- } from '../../models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper';
25
+ _relationshipView_simplifyPath,
26
+ _relationshipView_setPath,
27
+ } from '../../helpers/DiagramHelper';
28
28
  import type { PropertyView } from '../../models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView';
29
- import type { RelationShipEdgeView } from '../../models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView';
29
+ import type { RelationshipEdgeView } from '../../models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView';
30
30
  import type { RelationshipView } from '../../models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView';
31
31
  import type { Point } from '../../models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Point';
32
32
  import type { PositionedRectangle } from '../../models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle';
33
33
  import type { Rectangle } from '../../models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Rectangle';
34
+ import {
35
+ observe_AssociationView,
36
+ observe_ClassView,
37
+ observe_GeneralizationView,
38
+ observe_PropertyView,
39
+ } from '../../graphManager/action/changeDetection/DSLDiagram_ObserverHelper';
34
40
 
35
41
  export const diagram_setClassViews = action(
36
42
  (diagram: Diagram, val: ClassView[]): void => {
37
- diagram.classViews = val;
43
+ diagram.classViews = val.map(observe_ClassView);
38
44
  },
39
45
  );
40
46
  export const diagram_addClassView = action(
41
47
  (diagram: Diagram, val: ClassView): void => {
42
- addUniqueEntry(diagram.classViews, val);
48
+ addUniqueEntry(diagram.classViews, observe_ClassView(val));
43
49
  },
44
50
  );
45
51
  export const diagram_deleteClassView = action(
@@ -49,7 +55,7 @@ export const diagram_deleteClassView = action(
49
55
  );
50
56
  export const diagram_setAssociationViews = action(
51
57
  (diagram: Diagram, val: AssociationView[]): void => {
52
- diagram.associationViews = val;
58
+ diagram.associationViews = val.map(observe_AssociationView);
53
59
  },
54
60
  );
55
61
  export const diagram_deleteAssociationView = action(
@@ -59,12 +65,15 @@ export const diagram_deleteAssociationView = action(
59
65
  );
60
66
  export const diagram_setGeneralizationViews = action(
61
67
  (diagram: Diagram, val: GeneralizationView[]): void => {
62
- diagram.generalizationViews = val;
68
+ diagram.generalizationViews = val.map(observe_GeneralizationView);
63
69
  },
64
70
  );
65
71
  export const diagram_addGeneralizationView = action(
66
72
  (diagram: Diagram, val: GeneralizationView): void => {
67
- addUniqueEntry(diagram.generalizationViews, val);
73
+ addUniqueEntry(
74
+ diagram.generalizationViews,
75
+ observe_GeneralizationView(val),
76
+ );
68
77
  },
69
78
  );
70
79
  export const diagram_deleteGeneralizationView = action(
@@ -74,12 +83,12 @@ export const diagram_deleteGeneralizationView = action(
74
83
  );
75
84
  export const diagram_setPropertyViews = action(
76
85
  (diagram: Diagram, val: PropertyView[]): void => {
77
- diagram.propertyViews = val;
86
+ diagram.propertyViews = val.map(observe_PropertyView);
78
87
  },
79
88
  );
80
89
  export const diagram_addPropertyView = action(
81
90
  (diagram: Diagram, val: PropertyView): void => {
82
- addUniqueEntry(diagram.propertyViews, val);
91
+ addUniqueEntry(diagram.propertyViews, observe_PropertyView(val));
83
92
  },
84
93
  );
85
94
  export const diagram_deletePropertyView = action(
@@ -103,34 +112,38 @@ export const classView_setHideTaggedValues = action(
103
112
  cv.hideTaggedValues = val;
104
113
  },
105
114
  );
106
- export const relationShipEdgeView_setOffsetX = action(
107
- (r: RelationShipEdgeView, val: number): void => {
115
+ export const relationshipEdgeView_setOffsetX = action(
116
+ (r: RelationshipEdgeView, val: number): void => {
108
117
  r.offsetX = val;
109
118
  },
110
119
  );
111
- export const relationShipEdgeView_setOffsetY = action(
112
- (r: RelationShipEdgeView, val: number): void => {
120
+ export const relationshipEdgeView_setOffsetY = action(
121
+ (r: RelationshipEdgeView, val: number): void => {
113
122
  r.offsetY = val;
114
123
  },
115
124
  );
116
125
 
126
+ // To optimize performance we will not observe point (path)
117
127
  export const relationshipView_changePoint = action(
118
128
  (v: RelationshipView, val: Point, newVal: Point): void => {
119
129
  changeEntry(v.path, val, newVal);
120
130
  },
121
131
  );
122
- export const relationView_possiblyFlattenPath = action(
123
- _relationView_possiblyFlattenPath,
132
+ export const relationshipView_simplifyPath = action(
133
+ _relationshipView_simplifyPath,
124
134
  );
125
135
 
126
136
  export const findOrBuildPoint = action(_findOrBuildPoint);
127
- export const relationView_setPath = action(_relationView_setPath);
137
+ export const relationshipView_setPath = action(_relationshipView_setPath);
128
138
 
139
+ // To optimize performance we will not observe rectangle
129
140
  export const positionedRectangle_setRectangle = action(
130
141
  (pR: PositionedRectangle, value: Rectangle): void => {
131
142
  pR.rectangle = value;
132
143
  },
133
144
  );
145
+
146
+ // To optimize performance we will not observe point (path)
134
147
  export const positionedRectangle_setPosition = action(
135
148
  (pR: PositionedRectangle, value: Point): void => {
136
149
  pR.position = value;
@@ -140,6 +153,9 @@ export const positionedRectangle_setPosition = action(
140
153
  * NOTE: Having `position` and `rectangle` as observables compromises the performance of diagram
141
154
  * so we want to have a way to refresh the hash for change detection to pick up new hash when we resize
142
155
  * the class view box or move it.
156
+ *
157
+ * We should re-consider the usefulness of this method, maybe it's more worthwhile to recompute hash
158
+ * for the whole diagram instead?
143
159
  */
144
160
  export const positionedRectangle_forceRefreshHash = action(
145
161
  (pR: PositionedRectangle): void => {
@@ -275,18 +275,24 @@ export class DiagramEditorState extends ElementEditorState {
275
275
  return 'diagram-editor__cursor--resize';
276
276
  } else if (this.renderer.mouseOverClassProperty) {
277
277
  return this.isReadOnly ||
278
- this.renderer.mouseOverClassProperty.owner.isReadOnly
278
+ this.editorStore.graphManagerState.isElementReadOnly(
279
+ this.renderer.mouseOverClassProperty.owner,
280
+ )
279
281
  ? 'diagram-editor__cursor--not-allowed'
280
282
  : 'diagram-editor__cursor--text';
281
283
  } else if (this.renderer.mouseOverPropertyHolderViewLabel) {
282
284
  return this.isReadOnly ||
283
- this.renderer.mouseOverPropertyHolderViewLabel.property.value.owner
284
- .isReadOnly
285
+ this.editorStore.graphManagerState.isElementReadOnly(
286
+ this.renderer.mouseOverPropertyHolderViewLabel.property.value
287
+ .owner,
288
+ )
285
289
  ? 'diagram-editor__cursor--not-allowed'
286
290
  : 'diagram-editor__cursor--text';
287
291
  } else if (this.renderer.mouseOverClassName) {
288
292
  return this.isReadOnly ||
289
- this.renderer.mouseOverClassName.class.value.isReadOnly
293
+ this.editorStore.graphManagerState.isElementReadOnly(
294
+ this.renderer.mouseOverClassName.class.value,
295
+ )
290
296
  ? 'diagram-editor__cursor--not-allowed'
291
297
  : 'diagram-editor__cursor--text';
292
298
  } else if (this.renderer.mouseOverClassView) {
@@ -375,7 +381,12 @@ export class DiagramEditorState extends ElementEditorState {
375
381
  classView: ClassView,
376
382
  point: Point,
377
383
  ): void => {
378
- if (!this.isReadOnly && !classView.class.value.isReadOnly) {
384
+ if (
385
+ !this.isReadOnly &&
386
+ !this.editorStore.graphManagerState.isElementReadOnly(
387
+ classView.class.value,
388
+ )
389
+ ) {
379
390
  this.setInlineClassRenamerState(
380
391
  new DiagramEditorInlineClassRenamerState(this, classView, point),
381
392
  );
@@ -386,7 +397,10 @@ export class DiagramEditorState extends ElementEditorState {
386
397
  point: Point,
387
398
  propertyHolderView: PropertyHolderView | undefined,
388
399
  ): void => {
389
- if (!this.isReadOnly && !property.owner.isReadOnly) {
400
+ if (
401
+ !this.isReadOnly &&
402
+ !this.editorStore.graphManagerState.isElementReadOnly(property.owner)
403
+ ) {
390
404
  this.setInlinePropertyEditorState(
391
405
  new DiagramEditorInlinePropertyEditorState(
392
406
  this,
@@ -400,7 +414,12 @@ export class DiagramEditorState extends ElementEditorState {
400
414
  this.renderer.onClassPropertyDoubleClick = editProperty;
401
415
  this.renderer.handleEditProperty = editProperty;
402
416
  this.renderer.handleAddSimpleProperty = (classView: ClassView): void => {
403
- if (!this.isReadOnly && !classView.class.value.isReadOnly) {
417
+ if (
418
+ !this.isReadOnly &&
419
+ !this.editorStore.graphManagerState.isElementReadOnly(
420
+ classView.class.value,
421
+ )
422
+ ) {
404
423
  const _class = classView.class.value;
405
424
  class_addProperty(
406
425
  _class,
package/tsconfig.json CHANGED
@@ -44,6 +44,7 @@
44
44
  "./src/graph/DSLDiagram_PureGraphPlugin.ts",
45
45
  "./src/graphManager/DSLDiagram_GraphManagerHelper.ts",
46
46
  "./src/graphManager/DSLDiagram_PureGraphManagerPlugin.ts",
47
+ "./src/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.ts",
47
48
  "./src/helpers/DiagramHelper.ts",
48
49
  "./src/models/DSLDiagram_ModelUtils.ts",
49
50
  "./src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.ts",
@@ -51,7 +52,6 @@
51
52
  "./src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.ts",
52
53
  "./src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.ts",
53
54
  "./src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.ts",
54
- "./src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.ts",
55
55
  "./src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyHolderView.ts",
56
56
  "./src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.ts",
57
57
  "./src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.ts",
@@ -74,7 +74,7 @@
74
74
  "./src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.ts",
75
75
  "./src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.ts",
76
76
  "./src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDiagram_ProtocolHelper.ts",
77
- "./src/stores/studio/DSLDiagram_ModifierHelper.ts",
77
+ "./src/stores/studio/DSLDiagram_GraphModifierHelper.ts",
78
78
  "./src/stores/studio/DiagramEditorState.ts",
79
79
  "./src/components/studio/ClassDiagramPreview.tsx",
80
80
  "./src/components/studio/DSLDiagram_LegendStudioPlugin.tsx",
@@ -1,35 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { ClassView } from './DSLDiagram_ClassView';
17
- import type { RelationshipView } from './DSLDiagram_RelationshipView';
18
- import { Point } from './geometry/DSLDiagram_Point';
19
- export declare const _relationView_setPath: (relationView: RelationshipView, val: Point[]) => void;
20
- /**
21
- * For a path, only counts the points which lie outside of the 2 class views
22
- */
23
- export declare const _relationView_manageInsidePointsDynamically: (path: Point[], from: ClassView, to: ClassView) => Point[];
24
- /**
25
- * Flatten the path if the angle is wide enough
26
- * Also `swallow` points in path which lie inside of the rectangle of a view
27
- */
28
- export declare const _relationView_possiblyFlattenPath: (relationView: RelationshipView) => void;
29
- /**
30
- * Based on the location, find the point on the path that matches or create new point
31
- * (within a threshold of proximity) from the coordinate and put this in the path array
32
- * so it doesn't look too weird
33
- */
34
- export declare const _findOrBuildPoint: (relationView: RelationshipView, x: number, y: number, zoom: number, allowChange?: boolean) => Point | undefined;
35
- //# sourceMappingURL=DSLDiagram_GraphModifierHelper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DSLDiagram_GraphModifierHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAGpD,eAAO,MAAM,qBAAqB,iBAClB,gBAAgB,OACzB,KAAK,EAAE,KACX,IAEF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2CAA2C,SAChD,KAAK,EAAE,QACP,SAAS,MACX,SAAS,KACZ,KAAK,EAsBP,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,iBAC9B,gBAAgB,KAC7B,IA8CF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,iBACd,gBAAgB,KAC3B,MAAM,KACN,MAAM,QACH,MAAM,4BAEX,KAAK,GAAG,SAwCV,CAAC"}
@@ -1,118 +0,0 @@
1
- /**
2
- * Copyright (c) 2020-present, Goldman Sachs
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { Point } from './geometry/DSLDiagram_Point';
17
- import { Vector } from './geometry/DSLDiagram_Vector';
18
- export const _relationView_setPath = (relationView, val) => {
19
- relationView.path = val;
20
- };
21
- /**
22
- * For a path, only counts the points which lie outside of the 2 class views
23
- */
24
- export const _relationView_manageInsidePointsDynamically = (path, from, to) => {
25
- if (!path.length) {
26
- return [];
27
- }
28
- let start = 0;
29
- let startPoint = path[start];
30
- while (start < path.length - 1 && from.contains(startPoint.x, startPoint.y)) {
31
- start++;
32
- startPoint = path[start];
33
- }
34
- let end = path.length - 1;
35
- let endPoint = path[end];
36
- while (end > 0 && to.contains(endPoint.x, endPoint.y)) {
37
- end--;
38
- endPoint = path[end];
39
- }
40
- return path.slice(start - 1, end + 2);
41
- };
42
- /**
43
- * Flatten the path if the angle is wide enough
44
- * Also `swallow` points in path which lie inside of the rectangle of a view
45
- */
46
- export const _relationView_possiblyFlattenPath = (relationView) => {
47
- const fullPath = relationView.buildFullPath();
48
- // NOTE: this method here will `swallow` up points inside of the boxes
49
- const newPath = _relationView_manageInsidePointsDynamically(fullPath, relationView.from.classView.value, relationView.to.classView.value);
50
- // recompute the offset point from center inside of `from` and `to` classviews.
51
- // for each, we first check if `manageInsidePointsDynamically` removes any points from the full path
52
- // if it does we will update the offset
53
- if (newPath[0] !== fullPath[0]) {
54
- const center = relationView.from.classView.value.center();
55
- relationView.from.offsetX = newPath[0].x - center.x;
56
- relationView.from.offsetY = newPath[0].y - center.y;
57
- }
58
- if (newPath[newPath.length - 1] !== fullPath[fullPath.length - 1]) {
59
- const center = relationView.to.classView.value.center();
60
- relationView.to.offsetX =
61
- newPath[newPath.length - 1].x - center.x;
62
- relationView.to.offsetY =
63
- newPath[newPath.length - 1].y - center.y;
64
- }
65
- // find the point which can be flattened due to its wide angle
66
- const result = [];
67
- for (let i = 0; i < newPath.length - 2; i++) {
68
- const v1 = Vector.fromPoints(newPath[i + 1], newPath[i]).norm();
69
- const v2 = Vector.fromPoints(newPath[i + 1], newPath[i + 2]).norm();
70
- const dot = v1.dotProduct(v2);
71
- const angle = (Math.acos(dot) * 180) / Math.PI;
72
- if (Math.abs(angle - 180) > 5) {
73
- result.push(newPath[i + 1]);
74
- }
75
- }
76
- // here's where we will modify the path, i.e. swallow inside points if we have to
77
- _relationView_setPath(relationView, result);
78
- };
79
- /**
80
- * Based on the location, find the point on the path that matches or create new point
81
- * (within a threshold of proximity) from the coordinate and put this in the path array
82
- * so it doesn't look too weird
83
- */
84
- export const _findOrBuildPoint = (relationView, x, y, zoom, allowChange = true) => {
85
- for (const pt of relationView.path) {
86
- if (Math.sqrt((x - pt.x) * (x - pt.x) + (y - pt.y) * (y - pt.y)) <
87
- 10 / zoom) {
88
- return pt;
89
- }
90
- }
91
- const fullPath = relationView.buildFullPath(allowChange);
92
- const newPath = [];
93
- let point;
94
- for (let i = 0; i < fullPath.length - 1; i++) {
95
- const a = fullPath[i];
96
- const b = fullPath[i + 1];
97
- const n = new Vector(a.x, a.y).normal(new Vector(b.x, b.y)).norm();
98
- const v = Vector.fromPoints(a, new Point(x, y));
99
- if (Math.abs(n.dotProduct(v)) < 5 / zoom) {
100
- const lx = (a.x < b.x ? a.x : b.x) - 5 / zoom;
101
- const hx = (a.x < b.x ? b.x : a.x) + 5 / zoom;
102
- const ly = (a.y < b.y ? a.y : b.y) - 5 / zoom;
103
- const hy = (a.y < b.y ? b.y : a.y) + 5 / zoom;
104
- if (lx <= x && x <= hx && ly <= y && y <= hy) {
105
- point = new Point(x, y);
106
- newPath.push(point);
107
- }
108
- }
109
- if (i < fullPath.length - 2) {
110
- newPath.push(fullPath[i + 1]);
111
- }
112
- }
113
- if (point && allowChange) {
114
- _relationView_setPath(relationView, newPath);
115
- }
116
- return point;
117
- };
118
- //# sourceMappingURL=DSLDiagram_GraphModifierHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DSLDiagram_GraphModifierHelper.js","sourceRoot":"","sources":["../../../../../../src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAEtD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,YAA8B,EAC9B,GAAY,EACN,EAAE;IACR,YAAY,CAAC,IAAI,GAAG,GAAG,CAAC;AAC1B,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,2CAA2C,GAAG,CACzD,IAAa,EACb,IAAe,EACf,EAAa,EACJ,EAAE;IACX,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IAED,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,UAAU,GAAG,IAAI,CAAC,KAAK,CAAU,CAAC;IAEtC,OAAO,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE;QAC3E,KAAK,EAAE,CAAC;QACR,UAAU,GAAG,IAAI,CAAC,KAAK,CAAU,CAAC;KACnC;IAED,IAA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