@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.
- package/lib/DiagramRenderer.d.ts +4 -1
- package/lib/DiagramRenderer.d.ts.map +1 -1
- package/lib/DiagramRenderer.js +21 -23
- package/lib/DiagramRenderer.js.map +1 -1
- package/lib/components/studio/ClassDiagramPreview.d.ts.map +1 -1
- package/lib/components/studio/ClassDiagramPreview.js +3 -1
- package/lib/components/studio/ClassDiagramPreview.js.map +1 -1
- package/lib/components/studio/DiagramEditor.d.ts.map +1 -1
- package/lib/components/studio/DiagramEditor.js +8 -5
- package/lib/components/studio/DiagramEditor.js.map +1 -1
- package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.d.ts +2 -1
- package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.d.ts.map +1 -1
- package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.js +11 -0
- package/lib/graphManager/DSLDiagram_PureGraphManagerPlugin.js.map +1 -1
- package/lib/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.d.ts +34 -0
- package/lib/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.d.ts.map +1 -0
- package/lib/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.js +94 -0
- package/lib/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.js.map +1 -0
- package/lib/helpers/DiagramHelper.d.ts +16 -1
- package/lib/helpers/DiagramHelper.d.ts.map +1 -1
- package/lib/helpers/DiagramHelper.js +87 -1
- package/lib/helpers/DiagramHelper.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.js +0 -4
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.js +0 -8
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.js +0 -4
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.d.ts +0 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.js +0 -11
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.d.ts +0 -3
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.js +0 -7
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.d.ts +0 -4
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.js +0 -7
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.d.ts +6 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.js +6 -6
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.d.ts +24 -6
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.js +58 -27
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.js +0 -4
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.js.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Vector.d.ts +3 -3
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Vector.d.ts.map +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Vector.js +1 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Vector.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.js +3 -4
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.js +2 -2
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.js.map +1 -1
- package/lib/package.json +3 -3
- package/lib/stores/studio/{DSLDiagram_ModifierHelper.d.ts → DSLDiagram_GraphModifierHelper.d.ts} +10 -7
- package/lib/stores/studio/DSLDiagram_GraphModifierHelper.d.ts.map +1 -0
- package/lib/stores/studio/{DSLDiagram_ModifierHelper.js → DSLDiagram_GraphModifierHelper.js} +20 -13
- package/lib/stores/studio/DSLDiagram_GraphModifierHelper.js.map +1 -0
- package/lib/stores/studio/DiagramEditorState.d.ts.map +1 -1
- package/lib/stores/studio/DiagramEditorState.js +10 -7
- package/lib/stores/studio/DiagramEditorState.js.map +1 -1
- package/package.json +10 -10
- package/src/DiagramRenderer.ts +31 -34
- package/src/components/studio/ClassDiagramPreview.tsx +3 -1
- package/src/components/studio/DiagramEditor.tsx +10 -4
- package/src/graphManager/DSLDiagram_PureGraphManagerPlugin.ts +17 -0
- package/src/graphManager/action/changeDetection/DSLDiagram_ObserverHelper.ts +153 -0
- package/src/helpers/DiagramHelper.ts +122 -1
- package/src/index.ts +0 -1
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_AssociationView.ts +0 -6
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassView.ts +0 -10
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_ClassViewReference.ts +0 -6
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_Diagram.ts +0 -13
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GeneralizationView.ts +0 -11
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_PropertyView.ts +0 -17
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipEdgeView.ts +6 -7
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_RelationshipView.ts +77 -34
- package/src/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_PositionedRectangle.ts +0 -5
- package/src/models/metamodels/pure/packageableElements/diagram/geometry/DSLDiagram_Vector.ts +3 -3
- package/src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_GraphBuilderHelper.ts +6 -4
- package/src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDiagram_TransformerHelper.ts +4 -4
- package/src/stores/studio/{DSLDiagram_ModifierHelper.ts → DSLDiagram_GraphModifierHelper.ts} +34 -18
- package/src/stores/studio/DiagramEditorState.ts +26 -7
- package/tsconfig.json +2 -2
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.d.ts +0 -35
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.d.ts.map +0 -1
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.js +0 -118
- package/lib/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.js.map +0 -1
- package/lib/stores/studio/DSLDiagram_ModifierHelper.d.ts.map +0 -1
- package/lib/stores/studio/DSLDiagram_ModifierHelper.js.map +0 -1
- package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.ts +0 -165
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"DSLDiagram_ModifierHelper.d.ts","sourceRoot":"","sources":["../../../src/stores/studio/DSLDiagram_ModifierHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAC3H,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+EAA+E,CAAC;AAC/G,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6EAA6E,CAAC;AAC3G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wFAAwF,CAAC;AAMjI,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kFAAkF,CAAC;AACrH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0FAA0F,CAAC;AACrI,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sFAAsF,CAAC;AAC7H,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oFAAoF,CAAC;AAChH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kGA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MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CACpD,CAAC,EAAuB,EAAE,KAAgB,EAAQ,EAAE;IAClD,EAAE,CAAC,SAAS,GAAG,KAAK,CAAC;AACvB,CAAC,CACF,CAAC;AACF,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CACnD,CAAC,EAAuB,EAAE,KAAY,EAAQ,EAAE;IAC9C,EAAE,CAAC,QAAQ,GAAG,KAAK,CAAC;AACtB,CAAC,CACF,CAAC;AACF;;;;GAIG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CACxD,CAAC,EAAuB,EAAQ,EAAE;IAChC,EAAE,CAAC,eAAe,GAAG,EAAE,CAAC;AAC1B,CAAC,CACF,CAAC"}
|
package/src/models/metamodels/pure/packageableElements/diagram/DSLDiagram_GraphModifierHelper.ts
DELETED
@@ -1,165 +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
|
-
|
17
|
-
import type { ClassView } from './DSLDiagram_ClassView';
|
18
|
-
import type { RelationshipView } from './DSLDiagram_RelationshipView';
|
19
|
-
import { Point } from './geometry/DSLDiagram_Point';
|
20
|
-
import { Vector } from './geometry/DSLDiagram_Vector';
|
21
|
-
|
22
|
-
export const _relationView_setPath = (
|
23
|
-
relationView: RelationshipView,
|
24
|
-
val: Point[],
|
25
|
-
): void => {
|
26
|
-
relationView.path = val;
|
27
|
-
};
|
28
|
-
|
29
|
-
/**
|
30
|
-
* For a path, only counts the points which lie outside of the 2 class views
|
31
|
-
*/
|
32
|
-
export const _relationView_manageInsidePointsDynamically = (
|
33
|
-
path: Point[],
|
34
|
-
from: ClassView,
|
35
|
-
to: ClassView,
|
36
|
-
): Point[] => {
|
37
|
-
if (!path.length) {
|
38
|
-
return [];
|
39
|
-
}
|
40
|
-
|
41
|
-
let start = 0;
|
42
|
-
let startPoint = path[start] as Point;
|
43
|
-
|
44
|
-
while (start < path.length - 1 && from.contains(startPoint.x, startPoint.y)) {
|
45
|
-
start++;
|
46
|
-
startPoint = path[start] as Point;
|
47
|
-
}
|
48
|
-
|
49
|
-
let end = path.length - 1;
|
50
|
-
let endPoint = path[end] as Point;
|
51
|
-
|
52
|
-
while (end > 0 && to.contains(endPoint.x, endPoint.y)) {
|
53
|
-
end--;
|
54
|
-
endPoint = path[end] as Point;
|
55
|
-
}
|
56
|
-
|
57
|
-
return path.slice(start - 1, end + 2);
|
58
|
-
};
|
59
|
-
|
60
|
-
/**
|
61
|
-
* Flatten the path if the angle is wide enough
|
62
|
-
* Also `swallow` points in path which lie inside of the rectangle of a view
|
63
|
-
*/
|
64
|
-
export const _relationView_possiblyFlattenPath = (
|
65
|
-
relationView: RelationshipView,
|
66
|
-
): void => {
|
67
|
-
const fullPath = relationView.buildFullPath();
|
68
|
-
// NOTE: this method here will `swallow` up points inside of the boxes
|
69
|
-
const newPath = _relationView_manageInsidePointsDynamically(
|
70
|
-
fullPath,
|
71
|
-
relationView.from.classView.value,
|
72
|
-
relationView.to.classView.value,
|
73
|
-
);
|
74
|
-
|
75
|
-
// recompute the offset point from center inside of `from` and `to` classviews.
|
76
|
-
// for each, we first check if `manageInsidePointsDynamically` removes any points from the full path
|
77
|
-
// if it does we will update the offset
|
78
|
-
if (newPath[0] !== fullPath[0]) {
|
79
|
-
const center = relationView.from.classView.value.center();
|
80
|
-
|
81
|
-
relationView.from.offsetX = (newPath[0] as Point).x - center.x;
|
82
|
-
relationView.from.offsetY = (newPath[0] as Point).y - center.y;
|
83
|
-
}
|
84
|
-
|
85
|
-
if (newPath[newPath.length - 1] !== fullPath[fullPath.length - 1]) {
|
86
|
-
const center = relationView.to.classView.value.center();
|
87
|
-
relationView.to.offsetX =
|
88
|
-
(newPath[newPath.length - 1] as Point).x - center.x;
|
89
|
-
relationView.to.offsetY =
|
90
|
-
(newPath[newPath.length - 1] as Point).y - center.y;
|
91
|
-
}
|
92
|
-
|
93
|
-
// find the point which can be flattened due to its wide angle
|
94
|
-
const result = [];
|
95
|
-
for (let i = 0; i < newPath.length - 2; i++) {
|
96
|
-
const v1 = Vector.fromPoints(
|
97
|
-
newPath[i + 1] as Point,
|
98
|
-
newPath[i] as Point,
|
99
|
-
).norm();
|
100
|
-
const v2 = Vector.fromPoints(
|
101
|
-
newPath[i + 1] as Point,
|
102
|
-
newPath[i + 2] as Point,
|
103
|
-
).norm();
|
104
|
-
const dot = v1.dotProduct(v2);
|
105
|
-
const angle = (Math.acos(dot) * 180) / Math.PI;
|
106
|
-
if (Math.abs(angle - 180) > 5) {
|
107
|
-
result.push(newPath[i + 1] as Point);
|
108
|
-
}
|
109
|
-
}
|
110
|
-
// here's where we will modify the path, i.e. swallow inside points if we have to
|
111
|
-
_relationView_setPath(relationView, result);
|
112
|
-
};
|
113
|
-
|
114
|
-
/**
|
115
|
-
* Based on the location, find the point on the path that matches or create new point
|
116
|
-
* (within a threshold of proximity) from the coordinate and put this in the path array
|
117
|
-
* so it doesn't look too weird
|
118
|
-
*/
|
119
|
-
export const _findOrBuildPoint = (
|
120
|
-
relationView: RelationshipView,
|
121
|
-
x: number,
|
122
|
-
y: number,
|
123
|
-
zoom: number,
|
124
|
-
allowChange = true,
|
125
|
-
): Point | undefined => {
|
126
|
-
for (const pt of relationView.path) {
|
127
|
-
if (
|
128
|
-
Math.sqrt((x - pt.x) * (x - pt.x) + (y - pt.y) * (y - pt.y)) <
|
129
|
-
10 / zoom
|
130
|
-
) {
|
131
|
-
return pt;
|
132
|
-
}
|
133
|
-
}
|
134
|
-
|
135
|
-
const fullPath = relationView.buildFullPath(allowChange);
|
136
|
-
const newPath = [];
|
137
|
-
let point;
|
138
|
-
|
139
|
-
for (let i = 0; i < fullPath.length - 1; i++) {
|
140
|
-
const a = fullPath[i] as Point;
|
141
|
-
const b = fullPath[i + 1] as Point;
|
142
|
-
const n = new Vector(a.x, a.y).normal(new Vector(b.x, b.y)).norm();
|
143
|
-
const v = Vector.fromPoints(a, new Point(x, y));
|
144
|
-
|
145
|
-
if (Math.abs(n.dotProduct(v)) < 5 / zoom) {
|
146
|
-
const lx = (a.x < b.x ? a.x : b.x) - 5 / zoom;
|
147
|
-
const hx = (a.x < b.x ? b.x : a.x) + 5 / zoom;
|
148
|
-
const ly = (a.y < b.y ? a.y : b.y) - 5 / zoom;
|
149
|
-
const hy = (a.y < b.y ? b.y : a.y) + 5 / zoom;
|
150
|
-
|
151
|
-
if (lx <= x && x <= hx && ly <= y && y <= hy) {
|
152
|
-
point = new Point(x, y);
|
153
|
-
newPath.push(point);
|
154
|
-
}
|
155
|
-
}
|
156
|
-
|
157
|
-
if (i < fullPath.length - 2) {
|
158
|
-
newPath.push(fullPath[i + 1] as Point);
|
159
|
-
}
|
160
|
-
}
|
161
|
-
if (point && allowChange) {
|
162
|
-
_relationView_setPath(relationView, newPath);
|
163
|
-
}
|
164
|
-
return point;
|
165
|
-
};
|