@metadev/daga 3.0.0 → 3.1.1
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 +20 -1
- package/README.md +11 -1
- package/index.cjs.js +1056 -351
- package/index.esm.js +1044 -348
- package/package.json +1 -1
- package/src/index.d.ts +27 -21
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +6 -12
- package/src/lib/diagram/collab/collab-action.d.ts +58 -2
- package/src/lib/diagram/converters/daga-model.d.ts +1 -0
- package/src/lib/diagram/diagram-action.d.ts +67 -4
- package/src/lib/diagram/diagram-config.d.ts +23 -4
- package/src/lib/diagram/diagram-event.d.ts +74 -8
- package/src/lib/diagram/layout/diagram-layout.d.ts +4 -0
- package/src/lib/diagram/model/diagram-connection.d.ts +3 -2
- package/src/lib/diagram/model/diagram-decorator.d.ts +1 -0
- package/src/lib/diagram/model/diagram-element.d.ts +5 -0
- package/src/lib/diagram/model/diagram-field.d.ts +1 -0
- package/src/lib/diagram/model/diagram-node.d.ts +69 -2
- package/src/lib/diagram/model/diagram-object.d.ts +1 -0
- package/src/lib/diagram/model/diagram-port.d.ts +1 -0
- package/src/lib/diagram/model/diagram-property.d.ts +3 -1
- package/src/lib/diagram/model/diagram-section.d.ts +1 -0
- package/src/lib/interfaces/canvas.d.ts +8 -16
- package/src/lib/util/line.d.ts +6 -1
- package/src/lib/util/shape.d.ts +6 -1
package/index.esm.js
CHANGED
|
@@ -303,6 +303,9 @@ const MINIMUM_DISTANCE_BEFORE_TURN = 20;
|
|
|
303
303
|
* @private
|
|
304
304
|
*/
|
|
305
305
|
const linePath = (shape, points, startDirection, endDirection, minimumDistanceBeforeTurn) => {
|
|
306
|
+
if (typeof shape === 'function') {
|
|
307
|
+
return shape(points, startDirection, endDirection, minimumDistanceBeforeTurn);
|
|
308
|
+
}
|
|
306
309
|
if (points.length === 0) {
|
|
307
310
|
return '';
|
|
308
311
|
} else if (points.length === 1) {
|
|
@@ -665,6 +668,9 @@ var ClosedShape;
|
|
|
665
668
|
* @private
|
|
666
669
|
*/
|
|
667
670
|
const generalClosedPath = (shape, x, y, width, height) => {
|
|
671
|
+
if (typeof shape === 'function') {
|
|
672
|
+
return shape(x, y, width, height);
|
|
673
|
+
}
|
|
668
674
|
switch (shape) {
|
|
669
675
|
case ClosedShape.Ellipse:
|
|
670
676
|
return ellipsePath(x, y, width, height);
|
|
@@ -798,7 +804,7 @@ const numberOfColumns = s => {
|
|
|
798
804
|
};
|
|
799
805
|
const numberOfRows = s => {
|
|
800
806
|
var _a;
|
|
801
|
-
return ((_a = s.match(/\n/g)) === null || _a ===
|
|
807
|
+
return ((_a = s.match(/\n/g)) === null || _a === undefined ? undefined : _a.length) || 0;
|
|
802
808
|
};
|
|
803
809
|
|
|
804
810
|
/**
|
|
@@ -958,14 +964,14 @@ class DiagramElement {
|
|
|
958
964
|
*/
|
|
959
965
|
get highlighted() {
|
|
960
966
|
var _a, _b;
|
|
961
|
-
return ((_b = (_a = this.model.canvas) === null || _a ===
|
|
967
|
+
return ((_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.userHighlight) === null || _b === undefined ? undefined : _b.contains(this.id)) || false;
|
|
962
968
|
}
|
|
963
969
|
/**
|
|
964
970
|
* Whether this diagram element is currently in the user selection.
|
|
965
971
|
*/
|
|
966
972
|
get selected() {
|
|
967
973
|
var _a, _b;
|
|
968
|
-
return ((_b = (_a = this.model.canvas) === null || _a ===
|
|
974
|
+
return ((_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.userSelection) === null || _b === undefined ? undefined : _b.contains(this.id)) || false;
|
|
969
975
|
}
|
|
970
976
|
constructor(model, id) {
|
|
971
977
|
/**
|
|
@@ -994,7 +1000,7 @@ class DiagramElement {
|
|
|
994
1000
|
*/
|
|
995
1001
|
select() {
|
|
996
1002
|
var _a, _b;
|
|
997
|
-
return (_b = (_a = this.model.canvas) === null || _a ===
|
|
1003
|
+
return (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.selectCanvasView()) === null || _b === undefined ? undefined : _b.select(`g#${this.id}`);
|
|
998
1004
|
}
|
|
999
1005
|
}
|
|
1000
1006
|
class DiagramElementSet extends DiagramEntitySet {
|
|
@@ -1217,6 +1223,7 @@ class ValueSet {
|
|
|
1217
1223
|
constructor(propertySet, rootElement) {
|
|
1218
1224
|
this.displayedProperties = [];
|
|
1219
1225
|
this.hiddenProperties = [];
|
|
1226
|
+
// TODO JC: make this private after reviewing how it's used from React
|
|
1220
1227
|
this.values = {};
|
|
1221
1228
|
this.valueSets = {};
|
|
1222
1229
|
/**
|
|
@@ -1295,7 +1302,7 @@ class ValueSet {
|
|
|
1295
1302
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1296
1303
|
getValue(key) {
|
|
1297
1304
|
var _a;
|
|
1298
|
-
const rootAttribute = (_a = this.propertySet.getProperty(key)) === null || _a ===
|
|
1305
|
+
const rootAttribute = (_a = this.propertySet.getProperty(key)) === null || _a === undefined ? undefined : _a.rootAttribute;
|
|
1299
1306
|
if (rootAttribute !== undefined && rootAttribute !== null) {
|
|
1300
1307
|
this.values[key] = this.getRootElementValue(rootAttribute);
|
|
1301
1308
|
}
|
|
@@ -1380,7 +1387,7 @@ class ValueSet {
|
|
|
1380
1387
|
if (property && property.type === Type.Object) {
|
|
1381
1388
|
return this.getSubValueSet(key).hasAnySetValue();
|
|
1382
1389
|
}
|
|
1383
|
-
return !empty(value) && !equals(value, property === null || property ===
|
|
1390
|
+
return !empty(value) && !equals(value, property === null || property === undefined ? undefined : property.defaultValue);
|
|
1384
1391
|
}
|
|
1385
1392
|
/**
|
|
1386
1393
|
* Checks if any of the values in the set are not empty or the default value.
|
|
@@ -1739,7 +1746,11 @@ class DiagramConnection extends DiagramElement {
|
|
|
1739
1746
|
}
|
|
1740
1747
|
updateInView() {
|
|
1741
1748
|
var _a;
|
|
1742
|
-
(_a = this.model.canvas) === null || _a ===
|
|
1749
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateConnectionsInView(this.id);
|
|
1750
|
+
}
|
|
1751
|
+
raise() {
|
|
1752
|
+
var _a;
|
|
1753
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
1743
1754
|
}
|
|
1744
1755
|
/**
|
|
1745
1756
|
* Set the start of this connection to the given port or reset this connection's starting port if `undefined`.
|
|
@@ -1755,12 +1766,12 @@ class DiagramConnection extends DiagramElement {
|
|
|
1755
1766
|
this.start = start;
|
|
1756
1767
|
if (start !== undefined) {
|
|
1757
1768
|
start.outgoingConnections.push(this);
|
|
1758
|
-
this.startDirection = start === null || start ===
|
|
1759
|
-
this.startCoords = (start === null || start ===
|
|
1769
|
+
this.startDirection = start === null || start === undefined ? undefined : start.direction;
|
|
1770
|
+
this.startCoords = (start === null || start === undefined ? undefined : start.coords) || [0, 0];
|
|
1760
1771
|
}
|
|
1761
1772
|
} else {
|
|
1762
|
-
this.startDirection = start === null || start ===
|
|
1763
|
-
this.startCoords = (start === null || start ===
|
|
1773
|
+
this.startDirection = start === null || start === undefined ? undefined : start.direction;
|
|
1774
|
+
this.startCoords = (start === null || start === undefined ? undefined : start.coords) || [0, 0];
|
|
1764
1775
|
}
|
|
1765
1776
|
this.updateInView();
|
|
1766
1777
|
}
|
|
@@ -1778,12 +1789,12 @@ class DiagramConnection extends DiagramElement {
|
|
|
1778
1789
|
this.end = end;
|
|
1779
1790
|
if (end !== undefined) {
|
|
1780
1791
|
end.incomingConnections.push(this);
|
|
1781
|
-
this.endDirection = end === null || end ===
|
|
1782
|
-
this.endCoords = (end === null || end ===
|
|
1792
|
+
this.endDirection = end === null || end === undefined ? undefined : end.direction;
|
|
1793
|
+
this.endCoords = (end === null || end === undefined ? undefined : end.coords) || [0, 0];
|
|
1783
1794
|
}
|
|
1784
1795
|
} else {
|
|
1785
|
-
this.endDirection = end === null || end ===
|
|
1786
|
-
this.endCoords = (end === null || end ===
|
|
1796
|
+
this.endDirection = end === null || end === undefined ? undefined : end.direction;
|
|
1797
|
+
this.endCoords = (end === null || end === undefined ? undefined : end.coords) || [0, 0];
|
|
1787
1798
|
}
|
|
1788
1799
|
this.updateInView();
|
|
1789
1800
|
}
|
|
@@ -1794,7 +1805,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
1794
1805
|
*/
|
|
1795
1806
|
tighten() {
|
|
1796
1807
|
var _a, _b;
|
|
1797
|
-
if (((_a = this.start) === null || _a ===
|
|
1808
|
+
if (((_a = this.start) === null || _a === undefined ? undefined : _a.rootElement) && this.end) {
|
|
1798
1809
|
const alternativeStartPortsSortedByDistanceAscending = this.start.rootElement.ports.map(p => [p, p.distanceTo(this.end.coords)]).sort((a, b) => a[1] - b[1]).map(a => a[0]);
|
|
1799
1810
|
checkAlternativeStartPorts: for (const alternativeStartPort of alternativeStartPortsSortedByDistanceAscending) {
|
|
1800
1811
|
if (alternativeStartPort === this.end) {
|
|
@@ -1824,7 +1835,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
1824
1835
|
}
|
|
1825
1836
|
}
|
|
1826
1837
|
}
|
|
1827
|
-
if (((_b = this.end) === null || _b ===
|
|
1838
|
+
if (((_b = this.end) === null || _b === undefined ? undefined : _b.rootElement) && this.start) {
|
|
1828
1839
|
const alternativeEndPortsSortedByDistanceAscending = this.end.rootElement.ports.map(p => [p, p.distanceTo(this.start.coords)]).sort((a, b) => a[1] - b[1]).map(a => a[0]);
|
|
1829
1840
|
checkAlternativeEndPorts: for (const alternativeEndPort of alternativeEndPortsSortedByDistanceAscending) {
|
|
1830
1841
|
if (alternativeEndPort === this.start) {
|
|
@@ -1916,8 +1927,8 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
1916
1927
|
const connection = this.get(id, true);
|
|
1917
1928
|
if (connection) {
|
|
1918
1929
|
// remove from ports
|
|
1919
|
-
removeIfExists(((_a = connection.start) === null || _a ===
|
|
1920
|
-
removeIfExists(((_b = connection.end) === null || _b ===
|
|
1930
|
+
removeIfExists(((_a = connection.start) === null || _a === undefined ? undefined : _a.outgoingConnections) || [], connection);
|
|
1931
|
+
removeIfExists(((_b = connection.end) === null || _b === undefined ? undefined : _b.incomingConnections) || [], connection);
|
|
1921
1932
|
// remove from set of connections
|
|
1922
1933
|
super.remove(id);
|
|
1923
1934
|
// remove from canvas
|
|
@@ -1966,11 +1977,11 @@ class DiagramField extends DiagramElement {
|
|
|
1966
1977
|
this._text = value;
|
|
1967
1978
|
this.updateInView();
|
|
1968
1979
|
if (this.fit) {
|
|
1969
|
-
(_a = this.model.canvas) === null || _a ===
|
|
1980
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.fitFieldRootInView(this.id);
|
|
1970
1981
|
}
|
|
1971
1982
|
}
|
|
1972
1983
|
constructor(model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, text, editable, fit) {
|
|
1973
|
-
const id = `${rootElement === null || rootElement ===
|
|
1984
|
+
const id = `${rootElement === null || rootElement === undefined ? undefined : rootElement.id}_field`;
|
|
1974
1985
|
if (model.fields.get(id) !== undefined) {
|
|
1975
1986
|
throw new Error('DiagramField for rootElement already exists');
|
|
1976
1987
|
}
|
|
@@ -1997,14 +2008,18 @@ class DiagramField extends DiagramElement {
|
|
|
1997
2008
|
}
|
|
1998
2009
|
select() {
|
|
1999
2010
|
var _a, _b;
|
|
2000
|
-
return (_b = (_a = this.model.canvas) === null || _a ===
|
|
2011
|
+
return (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.selectCanvasView()) === null || _b === undefined ? undefined : _b.select(`foreignObject#${this.id}`);
|
|
2001
2012
|
}
|
|
2002
2013
|
get removed() {
|
|
2003
2014
|
return this.selfRemoved || this.rootElement !== undefined && this.rootElement.removed;
|
|
2004
2015
|
}
|
|
2005
2016
|
updateInView() {
|
|
2006
2017
|
var _a;
|
|
2007
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2018
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateFieldsInView(this.id);
|
|
2019
|
+
}
|
|
2020
|
+
raise() {
|
|
2021
|
+
var _a;
|
|
2022
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
2008
2023
|
}
|
|
2009
2024
|
/**
|
|
2010
2025
|
* Change the coordinates of this field to the given coordinates.
|
|
@@ -2017,7 +2032,7 @@ class DiagramField extends DiagramElement {
|
|
|
2017
2032
|
}
|
|
2018
2033
|
getPriority() {
|
|
2019
2034
|
var _a;
|
|
2020
|
-
return ((_a = this.rootElement) === null || _a ===
|
|
2035
|
+
return ((_a = this.rootElement) === null || _a === undefined ? undefined : _a.getPriority()) || DEFAULT_PRIORITY;
|
|
2021
2036
|
}
|
|
2022
2037
|
}
|
|
2023
2038
|
class DiagramFieldSet extends DiagramElementSet {
|
|
@@ -2048,7 +2063,7 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2048
2063
|
const field = this.get(id, true);
|
|
2049
2064
|
if (field) {
|
|
2050
2065
|
// remove from root element
|
|
2051
|
-
if (((_a = field.rootElement) === null || _a ===
|
|
2066
|
+
if (((_a = field.rootElement) === null || _a === undefined ? undefined : _a.label) !== undefined) {
|
|
2052
2067
|
if (field.rootElement.label === field) {
|
|
2053
2068
|
field.rootElement.label = undefined;
|
|
2054
2069
|
}
|
|
@@ -2061,7 +2076,7 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2061
2076
|
}
|
|
2062
2077
|
}
|
|
2063
2078
|
const getBottomMargin = config => {
|
|
2064
|
-
if ((config === null || config ===
|
|
2079
|
+
if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
|
|
2065
2080
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2066
2081
|
} else if (typeof config.margin === 'number') {
|
|
2067
2082
|
return config.margin;
|
|
@@ -2080,7 +2095,7 @@ const getBottomMargin = config => {
|
|
|
2080
2095
|
}
|
|
2081
2096
|
};
|
|
2082
2097
|
const getLeftMargin = config => {
|
|
2083
|
-
if ((config === null || config ===
|
|
2098
|
+
if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
|
|
2084
2099
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2085
2100
|
} else if (typeof config.margin === 'number') {
|
|
2086
2101
|
return config.margin;
|
|
@@ -2099,7 +2114,7 @@ const getLeftMargin = config => {
|
|
|
2099
2114
|
}
|
|
2100
2115
|
};
|
|
2101
2116
|
const getRightMargin = config => {
|
|
2102
|
-
if ((config === null || config ===
|
|
2117
|
+
if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
|
|
2103
2118
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2104
2119
|
} else if (typeof config.margin === 'number') {
|
|
2105
2120
|
return config.margin;
|
|
@@ -2118,7 +2133,7 @@ const getRightMargin = config => {
|
|
|
2118
2133
|
}
|
|
2119
2134
|
};
|
|
2120
2135
|
const getTopMargin = config => {
|
|
2121
|
-
if ((config === null || config ===
|
|
2136
|
+
if ((config === null || config === undefined ? undefined : config.margin) === null || (config === null || config === undefined ? undefined : config.margin) === undefined) {
|
|
2122
2137
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
2123
2138
|
} else if (typeof config.margin === 'number') {
|
|
2124
2139
|
return config.margin;
|
|
@@ -2136,8 +2151,8 @@ const getTopMargin = config => {
|
|
|
2136
2151
|
}
|
|
2137
2152
|
}
|
|
2138
2153
|
};
|
|
2139
|
-
const getBottomPadding = config => {
|
|
2140
|
-
if ((config === null || config ===
|
|
2154
|
+
const getBottomPadding$1 = config => {
|
|
2155
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
2141
2156
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2142
2157
|
} else if (typeof config.padding === 'number') {
|
|
2143
2158
|
return config.padding;
|
|
@@ -2155,8 +2170,8 @@ const getBottomPadding = config => {
|
|
|
2155
2170
|
}
|
|
2156
2171
|
}
|
|
2157
2172
|
};
|
|
2158
|
-
const getLeftPadding = config => {
|
|
2159
|
-
if ((config === null || config ===
|
|
2173
|
+
const getLeftPadding$1 = config => {
|
|
2174
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
2160
2175
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2161
2176
|
} else if (typeof config.padding === 'number') {
|
|
2162
2177
|
return config.padding;
|
|
@@ -2174,8 +2189,8 @@ const getLeftPadding = config => {
|
|
|
2174
2189
|
}
|
|
2175
2190
|
}
|
|
2176
2191
|
};
|
|
2177
|
-
const getRightPadding = config => {
|
|
2178
|
-
if ((config === null || config ===
|
|
2192
|
+
const getRightPadding$1 = config => {
|
|
2193
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
2179
2194
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2180
2195
|
} else if (typeof config.padding === 'number') {
|
|
2181
2196
|
return config.padding;
|
|
@@ -2193,8 +2208,8 @@ const getRightPadding = config => {
|
|
|
2193
2208
|
}
|
|
2194
2209
|
}
|
|
2195
2210
|
};
|
|
2196
|
-
const getTopPadding = config => {
|
|
2197
|
-
if ((config === null || config ===
|
|
2211
|
+
const getTopPadding$1 = config => {
|
|
2212
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
2198
2213
|
return DIAGRAM_FIELD_DEFAULTS.padding;
|
|
2199
2214
|
} else if (typeof config.padding === 'number') {
|
|
2200
2215
|
return config.padding;
|
|
@@ -2275,7 +2290,7 @@ class DiagramSection extends DiagramElement {
|
|
|
2275
2290
|
*/
|
|
2276
2291
|
get name() {
|
|
2277
2292
|
var _a;
|
|
2278
|
-
return ((_a = this.label) === null || _a ===
|
|
2293
|
+
return ((_a = this.label) === null || _a === undefined ? undefined : _a.text) || '';
|
|
2279
2294
|
}
|
|
2280
2295
|
set name(name) {
|
|
2281
2296
|
if (this.label) {
|
|
@@ -2309,23 +2324,36 @@ class DiagramSection extends DiagramElement {
|
|
|
2309
2324
|
}
|
|
2310
2325
|
updateInView() {
|
|
2311
2326
|
var _a;
|
|
2312
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2327
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateSectionsInView(this.id);
|
|
2328
|
+
}
|
|
2329
|
+
raise() {
|
|
2330
|
+
var _a;
|
|
2331
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
2332
|
+
if (this.label) {
|
|
2333
|
+
this.label.raise();
|
|
2334
|
+
}
|
|
2335
|
+
for (const port of this.ports) {
|
|
2336
|
+
port.raise();
|
|
2337
|
+
}
|
|
2338
|
+
for (const decorator of this.decorators) {
|
|
2339
|
+
decorator.raise();
|
|
2340
|
+
}
|
|
2313
2341
|
}
|
|
2314
2342
|
getConfig() {
|
|
2315
2343
|
var _a, _b, _c, _d, _e;
|
|
2316
|
-
return (_e = (_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2344
|
+
return (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.sections) === null || _d === undefined ? undefined : _d[this.indexYInNode]) === null || _e === undefined ? undefined : _e[this.indexXInNode];
|
|
2317
2345
|
}
|
|
2318
2346
|
getMinWidth() {
|
|
2319
2347
|
var _a, _b, _c, _d;
|
|
2320
|
-
return ((_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2348
|
+
return ((_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.minWidths) === null || _d === undefined ? undefined : _d[this.indexXInNode]) || DIAGRAM_SECTION_MIN_WIDTH;
|
|
2321
2349
|
}
|
|
2322
2350
|
getMinHeight() {
|
|
2323
2351
|
var _a, _b, _c, _d;
|
|
2324
|
-
return ((_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2352
|
+
return ((_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.minHeights) === null || _d === undefined ? undefined : _d[this.indexYInNode]) || DIAGRAM_SECTION_MIN_HEIGHT;
|
|
2325
2353
|
}
|
|
2326
2354
|
getPriority() {
|
|
2327
2355
|
var _a, _b, _c, _d, _e, _f;
|
|
2328
|
-
return ((_f = (_e = (_d = (_c = (_b = (_a = this.node) === null || _a ===
|
|
2356
|
+
return ((_f = (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.sectionGrid) === null || _c === undefined ? undefined : _c.sections) === null || _d === undefined ? undefined : _d[this.indexYInNode]) === null || _e === undefined ? undefined : _e[this.indexXInNode]) === null || _f === undefined ? undefined : _f.priority) || DIAGRAM_SECTION_DEFAULTS.priority;
|
|
2329
2357
|
}
|
|
2330
2358
|
/**
|
|
2331
2359
|
* Get the port of this section which is closest to the given coordinates.
|
|
@@ -2490,9 +2518,9 @@ class DiagramSection extends DiagramElement {
|
|
|
2490
2518
|
}
|
|
2491
2519
|
// Set label's dimensions as a function of ours.
|
|
2492
2520
|
if (this.label) {
|
|
2493
|
-
this.label.coords = [this.coords[0] + getLeftMargin((_a = this.getConfig()) === null || _a ===
|
|
2494
|
-
this.label.width = this.width - getLeftMargin((_c = this.getConfig()) === null || _c ===
|
|
2495
|
-
this.label.height = this.height - getTopMargin((_e = this.getConfig()) === null || _e ===
|
|
2521
|
+
this.label.coords = [this.coords[0] + getLeftMargin((_a = this.getConfig()) === null || _a === undefined ? undefined : _a.label), this.coords[1] + getTopMargin((_b = this.getConfig()) === null || _b === undefined ? undefined : _b.label)];
|
|
2522
|
+
this.label.width = this.width - getLeftMargin((_c = this.getConfig()) === null || _c === undefined ? undefined : _c.label) - getRightMargin((_d = this.getConfig()) === null || _d === undefined ? undefined : _d.label);
|
|
2523
|
+
this.label.height = this.height - getTopMargin((_e = this.getConfig()) === null || _e === undefined ? undefined : _e.label) - getBottomMargin((_f = this.getConfig()) === null || _f === undefined ? undefined : _f.label);
|
|
2496
2524
|
this.label.updateInView();
|
|
2497
2525
|
}
|
|
2498
2526
|
// Move decorators to match the new coords.
|
|
@@ -2526,11 +2554,11 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
2526
2554
|
node.sections.push(section);
|
|
2527
2555
|
node.updateInView();
|
|
2528
2556
|
// add section ports
|
|
2529
|
-
const sectionPorts = (_d = (_c = (_b = (_a = node.type.sectionGrid) === null || _a ===
|
|
2557
|
+
const sectionPorts = (_d = (_c = (_b = (_a = node.type.sectionGrid) === null || _a === undefined ? undefined : _a.sections) === null || _b === undefined ? undefined : _b[indexYInNode]) === null || _c === undefined ? undefined : _c[indexXInNode]) === null || _d === undefined ? undefined : _d.ports;
|
|
2530
2558
|
if (sectionPorts && sectionPorts.length > 0) {
|
|
2531
2559
|
for (let i = 0; i < sectionPorts.length; ++i) {
|
|
2532
2560
|
const portConfig = sectionPorts[i];
|
|
2533
|
-
const port = this.model.ports.new(section, [section.coords[0] + (((_e = portConfig === null || portConfig ===
|
|
2561
|
+
const port = this.model.ports.new(section, [section.coords[0] + (((_e = portConfig === null || portConfig === undefined ? undefined : portConfig.coords) === null || _e === undefined ? undefined : _e[0]) || 0), section.coords[1] + (((_f = portConfig === null || portConfig === undefined ? undefined : portConfig.coords) === null || _f === undefined ? undefined : _f[1]) || 0)], portConfig === null || portConfig === undefined ? undefined : portConfig.direction, `${section.id}_${i}`);
|
|
2534
2562
|
if (portConfig.label) {
|
|
2535
2563
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), portConfig.label);
|
|
2536
2564
|
let labelCoords;
|
|
@@ -2553,7 +2581,7 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
2553
2581
|
}
|
|
2554
2582
|
}
|
|
2555
2583
|
// add section label
|
|
2556
|
-
const sectionLabel = (_k = (_j = (_h = (_g = node.type.sectionGrid) === null || _g ===
|
|
2584
|
+
const sectionLabel = (_k = (_j = (_h = (_g = node.type.sectionGrid) === null || _g === undefined ? undefined : _g.sections) === null || _h === undefined ? undefined : _h[indexYInNode]) === null || _j === undefined ? undefined : _j[indexXInNode]) === null || _k === undefined ? undefined : _k.label;
|
|
2557
2585
|
if (sectionLabel) {
|
|
2558
2586
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), sectionLabel);
|
|
2559
2587
|
this.model.fields.new(section, [section.coords[0] + getLeftMargin(labelConfiguration), section.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, section.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), section.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
@@ -2609,11 +2637,14 @@ const DIAGRAM_NODE_TYPE_DEFAULTS = {
|
|
|
2609
2637
|
minHeight: 1,
|
|
2610
2638
|
resizableX: false,
|
|
2611
2639
|
resizableY: false,
|
|
2640
|
+
padding: 0,
|
|
2612
2641
|
label: null,
|
|
2613
2642
|
ports: [],
|
|
2614
2643
|
sectionGrid: null,
|
|
2615
2644
|
look: DIAGRAM_NODE_LOOK_DEFAULTS,
|
|
2616
2645
|
isUnique: false,
|
|
2646
|
+
canBeParentless: true,
|
|
2647
|
+
childrenTypes: [],
|
|
2617
2648
|
priority: DEFAULT_PRIORITY,
|
|
2618
2649
|
properties: []
|
|
2619
2650
|
};
|
|
@@ -2633,13 +2664,19 @@ class DiagramNodeType {
|
|
|
2633
2664
|
this.minHeight = values.minHeight;
|
|
2634
2665
|
this.resizableX = values.resizableX;
|
|
2635
2666
|
this.resizableY = values.resizableY;
|
|
2667
|
+
this.bottomPadding = getBottomPadding(values);
|
|
2668
|
+
this.leftPadding = getLeftPadding(values);
|
|
2669
|
+
this.rightPadding = getRightPadding(values);
|
|
2670
|
+
this.topPadding = getTopPadding(values);
|
|
2636
2671
|
this.label = values.label;
|
|
2637
2672
|
this.ports = values.ports;
|
|
2638
2673
|
this.sectionGrid = values.sectionGrid;
|
|
2639
2674
|
this.look = values.look;
|
|
2640
2675
|
this.isUnique = values.isUnique;
|
|
2676
|
+
this.canBeParentless = values.canBeParentless;
|
|
2677
|
+
this.childrenTypes = values.childrenTypes;
|
|
2641
2678
|
this.priority = values.priority;
|
|
2642
|
-
this.propertySet = new PropertySet((options === null || options ===
|
|
2679
|
+
this.propertySet = new PropertySet((options === null || options === undefined ? undefined : options.properties) || []);
|
|
2643
2680
|
}
|
|
2644
2681
|
}
|
|
2645
2682
|
/**
|
|
@@ -2656,7 +2693,7 @@ class DiagramNode extends DiagramElement {
|
|
|
2656
2693
|
*/
|
|
2657
2694
|
get name() {
|
|
2658
2695
|
var _a;
|
|
2659
|
-
return ((_a = this.label) === null || _a ===
|
|
2696
|
+
return ((_a = this.label) === null || _a === undefined ? undefined : _a.text) || '';
|
|
2660
2697
|
}
|
|
2661
2698
|
set name(name) {
|
|
2662
2699
|
if (this.label) {
|
|
@@ -2668,6 +2705,11 @@ class DiagramNode extends DiagramElement {
|
|
|
2668
2705
|
throw new Error(`DiagramNode with id "${id}" already exists`);
|
|
2669
2706
|
}
|
|
2670
2707
|
super(model, id);
|
|
2708
|
+
/**
|
|
2709
|
+
* Nodes contained within this node.
|
|
2710
|
+
* @public
|
|
2711
|
+
*/
|
|
2712
|
+
this.children = [];
|
|
2671
2713
|
/**
|
|
2672
2714
|
* Sections of this node.
|
|
2673
2715
|
* @public
|
|
@@ -2684,7 +2726,7 @@ class DiagramNode extends DiagramElement {
|
|
|
2684
2726
|
*/
|
|
2685
2727
|
this.decorators = [];
|
|
2686
2728
|
/**
|
|
2687
|
-
* Collaborative timestamp for
|
|
2729
|
+
* Collaborative timestamp for MoveCollabAction, SetGeometryCollabAction and SetParentCollabAction.
|
|
2688
2730
|
* @public
|
|
2689
2731
|
*/
|
|
2690
2732
|
this.geometryTimestamp = null;
|
|
@@ -2700,7 +2742,26 @@ class DiagramNode extends DiagramElement {
|
|
|
2700
2742
|
}
|
|
2701
2743
|
updateInView() {
|
|
2702
2744
|
var _a;
|
|
2703
|
-
(_a = this.model.canvas) === null || _a ===
|
|
2745
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateNodesInView(this.id);
|
|
2746
|
+
}
|
|
2747
|
+
raise() {
|
|
2748
|
+
var _a;
|
|
2749
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
2750
|
+
if (this.label) {
|
|
2751
|
+
this.label.raise();
|
|
2752
|
+
}
|
|
2753
|
+
for (const port of this.ports) {
|
|
2754
|
+
port.raise();
|
|
2755
|
+
}
|
|
2756
|
+
for (const section of this.sections) {
|
|
2757
|
+
section.raise();
|
|
2758
|
+
}
|
|
2759
|
+
for (const decorator of this.decorators) {
|
|
2760
|
+
decorator.raise();
|
|
2761
|
+
}
|
|
2762
|
+
for (const child of this.children) {
|
|
2763
|
+
child.raise();
|
|
2764
|
+
}
|
|
2704
2765
|
}
|
|
2705
2766
|
getPriority() {
|
|
2706
2767
|
return this.type.priority;
|
|
@@ -2792,7 +2853,7 @@ class DiagramNode extends DiagramElement {
|
|
|
2792
2853
|
if (!includeRemoved && incomingConnection.removed) {
|
|
2793
2854
|
continue;
|
|
2794
2855
|
}
|
|
2795
|
-
const otherNode = (_a = incomingConnection.start) === null || _a ===
|
|
2856
|
+
const otherNode = (_a = incomingConnection.start) === null || _a === undefined ? undefined : _a.getNode();
|
|
2796
2857
|
if (otherNode) {
|
|
2797
2858
|
if (!includeRemoved && otherNode.removed) {
|
|
2798
2859
|
continue;
|
|
@@ -2804,7 +2865,7 @@ class DiagramNode extends DiagramElement {
|
|
|
2804
2865
|
if (!includeRemoved && outgoingConnection.removed) {
|
|
2805
2866
|
continue;
|
|
2806
2867
|
}
|
|
2807
|
-
const otherNode = (_b = outgoingConnection.end) === null || _b ===
|
|
2868
|
+
const otherNode = (_b = outgoingConnection.end) === null || _b === undefined ? undefined : _b.getNode();
|
|
2808
2869
|
if (otherNode) {
|
|
2809
2870
|
if (!includeRemoved && otherNode.removed) {
|
|
2810
2871
|
continue;
|
|
@@ -2815,6 +2876,94 @@ class DiagramNode extends DiagramElement {
|
|
|
2815
2876
|
}
|
|
2816
2877
|
return result;
|
|
2817
2878
|
}
|
|
2879
|
+
/**
|
|
2880
|
+
* Return the ancestor of this node which has no ancestors. If this node has no ancestors, returns itself.
|
|
2881
|
+
* @returns The ancestor of this node which has no ancestors.
|
|
2882
|
+
*/
|
|
2883
|
+
getLastAncestor() {
|
|
2884
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
2885
|
+
let node = this;
|
|
2886
|
+
while (node.parent !== undefined) {
|
|
2887
|
+
node = node === null || node === undefined ? undefined : node.parent;
|
|
2888
|
+
}
|
|
2889
|
+
return node;
|
|
2890
|
+
}
|
|
2891
|
+
/**
|
|
2892
|
+
* Return true if this node is among the ancestors of the given node.
|
|
2893
|
+
* @param child A node.
|
|
2894
|
+
* @returns `true` if this node is among the ancestors of the given node, `false` otherwise.
|
|
2895
|
+
*/
|
|
2896
|
+
isAncestorOf(child) {
|
|
2897
|
+
let node = child;
|
|
2898
|
+
while (node !== undefined) {
|
|
2899
|
+
if (this.id === node.id) {
|
|
2900
|
+
return true;
|
|
2901
|
+
}
|
|
2902
|
+
node = node.parent;
|
|
2903
|
+
}
|
|
2904
|
+
return false;
|
|
2905
|
+
}
|
|
2906
|
+
/**
|
|
2907
|
+
* Return true if the given node is among the ancestors of this node.
|
|
2908
|
+
* @param child A node.
|
|
2909
|
+
* @returns `true` if the given node is among the ancestors of this node, `false` otherwise.
|
|
2910
|
+
*/
|
|
2911
|
+
isDescendantOf(child) {
|
|
2912
|
+
return child.isAncestorOf(this);
|
|
2913
|
+
}
|
|
2914
|
+
addChild(child) {
|
|
2915
|
+
if (child.id === this.id) {
|
|
2916
|
+
// do nothing; a node can't be its own child
|
|
2917
|
+
return;
|
|
2918
|
+
}
|
|
2919
|
+
let node = this.parent;
|
|
2920
|
+
let isChildParentOfThis = false;
|
|
2921
|
+
while (node !== undefined) {
|
|
2922
|
+
if (node.id === child.id) {
|
|
2923
|
+
isChildParentOfThis = true;
|
|
2924
|
+
break;
|
|
2925
|
+
}
|
|
2926
|
+
node = node.parent;
|
|
2927
|
+
}
|
|
2928
|
+
if (isChildParentOfThis) {
|
|
2929
|
+
// do nothing; a node can't be its own ancestor
|
|
2930
|
+
return;
|
|
2931
|
+
}
|
|
2932
|
+
if (this.children.indexOf(child) >= 0) {
|
|
2933
|
+
// do nothing, child is already among the node's children
|
|
2934
|
+
return;
|
|
2935
|
+
}
|
|
2936
|
+
this.fitToChild(child);
|
|
2937
|
+
this.children.push(child);
|
|
2938
|
+
child.parent = this;
|
|
2939
|
+
child.raise();
|
|
2940
|
+
}
|
|
2941
|
+
removeChild(child) {
|
|
2942
|
+
removeIfExists(this.children, child);
|
|
2943
|
+
child.parent = undefined;
|
|
2944
|
+
}
|
|
2945
|
+
fitToChild(child) {
|
|
2946
|
+
const excessLeft = this.coords[0] - child.coords[0] + this.type.leftPadding;
|
|
2947
|
+
if (excessLeft >= 0) {
|
|
2948
|
+
this.stretch(Side.Left, excessLeft);
|
|
2949
|
+
}
|
|
2950
|
+
const excessTop = this.coords[1] - child.coords[1] + this.type.topPadding;
|
|
2951
|
+
if (excessTop >= 0) {
|
|
2952
|
+
this.stretch(Side.Top, excessTop);
|
|
2953
|
+
}
|
|
2954
|
+
const excessRight = child.coords[0] + child.width - (this.coords[0] + this.width) + this.type.rightPadding;
|
|
2955
|
+
if (excessRight >= 0) {
|
|
2956
|
+
this.stretch(Side.Right, excessRight);
|
|
2957
|
+
}
|
|
2958
|
+
const excessBottom = child.coords[1] + child.height - (this.coords[1] + this.height) + this.type.bottomPadding;
|
|
2959
|
+
if (excessBottom >= 0) {
|
|
2960
|
+
this.stretch(Side.Bottom, excessBottom);
|
|
2961
|
+
}
|
|
2962
|
+
if (this.parent) {
|
|
2963
|
+
// ensure this node also fits inside its parent after stretching
|
|
2964
|
+
this.parent.fitToChild(this);
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2818
2967
|
/**
|
|
2819
2968
|
* Change the coordinates of this node to the given coordinates and move its sections, ports and labels correspondingly.
|
|
2820
2969
|
* @public
|
|
@@ -2822,6 +2971,9 @@ class DiagramNode extends DiagramElement {
|
|
|
2822
2971
|
*/
|
|
2823
2972
|
move(coords) {
|
|
2824
2973
|
const coordDifferences = [coords[0] - this.coords[0], coords[1] - this.coords[1]];
|
|
2974
|
+
for (const child of this.children) {
|
|
2975
|
+
child.move([child.coords[0] + coordDifferences[0], child.coords[1] + coordDifferences[1]]);
|
|
2976
|
+
}
|
|
2825
2977
|
for (const section of this.sections) {
|
|
2826
2978
|
section.move([section.coords[0] + coordDifferences[0], section.coords[1] + coordDifferences[1]]);
|
|
2827
2979
|
}
|
|
@@ -2830,7 +2982,9 @@ class DiagramNode extends DiagramElement {
|
|
|
2830
2982
|
width: this.width,
|
|
2831
2983
|
height: this.height,
|
|
2832
2984
|
// We already moved the sections above - skip changing them in setDimensions.
|
|
2833
|
-
sections: {}
|
|
2985
|
+
sections: {},
|
|
2986
|
+
// We don't change the children when stretching
|
|
2987
|
+
children: {}
|
|
2834
2988
|
});
|
|
2835
2989
|
}
|
|
2836
2990
|
/**
|
|
@@ -2879,7 +3033,9 @@ class DiagramNode extends DiagramElement {
|
|
|
2879
3033
|
width: newCoordsX[1] - newCoordsX[0],
|
|
2880
3034
|
height: newCoordsY[1] - newCoordsY[0],
|
|
2881
3035
|
// we ignore this.sections, the stretching of a node with sections is handled in the stretchSections method
|
|
2882
|
-
sections: {}
|
|
3036
|
+
sections: {},
|
|
3037
|
+
// we ignore this.children
|
|
3038
|
+
children: {}
|
|
2883
3039
|
});
|
|
2884
3040
|
}
|
|
2885
3041
|
/**
|
|
@@ -2968,16 +3124,23 @@ class DiagramNode extends DiagramElement {
|
|
|
2968
3124
|
* Returns the current values of all geometric properties (coordinates and dimensions) of this node and its sections.
|
|
2969
3125
|
* @public
|
|
2970
3126
|
*/
|
|
2971
|
-
getGeometry() {
|
|
3127
|
+
getGeometry(excludeId) {
|
|
2972
3128
|
const sections = {};
|
|
2973
3129
|
for (const section of this.sections) {
|
|
2974
3130
|
sections[section.id] = section.getGeometry();
|
|
2975
3131
|
}
|
|
3132
|
+
const children = {};
|
|
3133
|
+
for (const child of this.children) {
|
|
3134
|
+
if (child.id !== excludeId) {
|
|
3135
|
+
children[child.id] = child.getGeometry(excludeId);
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
2976
3138
|
return {
|
|
2977
3139
|
coords: [...this.coords],
|
|
2978
3140
|
width: this.width,
|
|
2979
3141
|
height: this.height,
|
|
2980
|
-
sections
|
|
3142
|
+
sections,
|
|
3143
|
+
children
|
|
2981
3144
|
};
|
|
2982
3145
|
}
|
|
2983
3146
|
/**
|
|
@@ -2985,6 +3148,7 @@ class DiagramNode extends DiagramElement {
|
|
|
2985
3148
|
* @public
|
|
2986
3149
|
*/
|
|
2987
3150
|
setGeometry(geometry) {
|
|
3151
|
+
this.raise();
|
|
2988
3152
|
const oldCoordsX = [this.coords[0], this.coords[0] + this.width];
|
|
2989
3153
|
const oldCoordsY = [this.coords[1], this.coords[1] + this.height];
|
|
2990
3154
|
this.coords = [...geometry.coords];
|
|
@@ -2992,6 +3156,13 @@ class DiagramNode extends DiagramElement {
|
|
|
2992
3156
|
this.height = geometry.height;
|
|
2993
3157
|
const newCoordsX = [this.coords[0], this.coords[0] + this.width];
|
|
2994
3158
|
const newCoordsY = [this.coords[1], this.coords[1] + this.height];
|
|
3159
|
+
// Update children, if supplied.
|
|
3160
|
+
for (const child of this.children) {
|
|
3161
|
+
const childGeometry = geometry.children[child.id];
|
|
3162
|
+
if (childGeometry) {
|
|
3163
|
+
child.setGeometry(childGeometry);
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
2995
3166
|
// Update sections, if supplied.
|
|
2996
3167
|
for (const section of this.sections) {
|
|
2997
3168
|
const sectionGeometry = geometry.sections[section.id];
|
|
@@ -3063,10 +3234,10 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3063
3234
|
for (let j = 0; j < nodeType.sectionGrid.sections.length; ++j) {
|
|
3064
3235
|
let widthAccumulator = node.coords[0] + (nodeType.sectionGrid.margin || 0);
|
|
3065
3236
|
for (let i = 0; i < nodeType.sectionGrid.sections[j].length; ++i) {
|
|
3066
|
-
this.model.sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a ===
|
|
3067
|
-
widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c ===
|
|
3237
|
+
this.model.sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a === undefined ? undefined : _a[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH, ((_b = nodeType.sectionGrid.defaultHeights) === null || _b === undefined ? undefined : _b[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT, `${node.id}_${j}_${i}`);
|
|
3238
|
+
widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c === undefined ? undefined : _c[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH) + (nodeType.sectionGrid.margin || 0);
|
|
3068
3239
|
}
|
|
3069
|
-
heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d ===
|
|
3240
|
+
heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d === undefined ? undefined : _d[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT) + (nodeType.sectionGrid.margin || 0);
|
|
3070
3241
|
}
|
|
3071
3242
|
}
|
|
3072
3243
|
// add node ports
|
|
@@ -3101,12 +3272,20 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3101
3272
|
this.model.fields.new(node, [node.coords[0] + getLeftMargin(labelConfiguration), node.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, node.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), node.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
3102
3273
|
}
|
|
3103
3274
|
node.valueSet.resetValues();
|
|
3104
|
-
(_e = node.model.canvas) === null || _e ===
|
|
3275
|
+
(_e = node.model.canvas) === null || _e === undefined ? undefined : _e.fitNodeInView(node.id);
|
|
3105
3276
|
return node;
|
|
3106
3277
|
}
|
|
3107
3278
|
remove(id) {
|
|
3108
3279
|
const node = this.get(id, true);
|
|
3109
3280
|
if (node) {
|
|
3281
|
+
// remove from parent
|
|
3282
|
+
if (node.parent) {
|
|
3283
|
+
removeIfExists(node.parent.children, node);
|
|
3284
|
+
}
|
|
3285
|
+
// remove all children
|
|
3286
|
+
while (node.children.length > 0) {
|
|
3287
|
+
this.model.nodes.remove(node.children[0].id);
|
|
3288
|
+
}
|
|
3110
3289
|
// remove all sections
|
|
3111
3290
|
while (node.sections.length > 0) {
|
|
3112
3291
|
this.model.sections.remove(node.sections[0].id);
|
|
@@ -3129,7 +3308,137 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
3129
3308
|
node.updateInView();
|
|
3130
3309
|
}
|
|
3131
3310
|
}
|
|
3311
|
+
/**
|
|
3312
|
+
* Gets all the nodes that overlap with the given coordinates.
|
|
3313
|
+
* @public
|
|
3314
|
+
* @param x A coordinate along the x axis.
|
|
3315
|
+
* @param y A coordinate along the y axis.
|
|
3316
|
+
* @returns All the nodes that overlap with the given coordinates.
|
|
3317
|
+
*/
|
|
3318
|
+
getAtCoordinates(x, y) {
|
|
3319
|
+
const nodesAtLocation = [];
|
|
3320
|
+
for (const node of this) {
|
|
3321
|
+
if (node.coords[0] < x && x < node.coords[0] + node.width && node.coords[1] < y && y < node.coords[1] + node.height) {
|
|
3322
|
+
nodesAtLocation.push(node);
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
return nodesAtLocation;
|
|
3326
|
+
}
|
|
3132
3327
|
}
|
|
3328
|
+
/**
|
|
3329
|
+
* Removes any nodes from the given list which are a descendant of another node in the list.
|
|
3330
|
+
* @param nodes A list of nodes.
|
|
3331
|
+
* @returns The given list of nodes minus any node that is a descendant of another node in the list.
|
|
3332
|
+
*/
|
|
3333
|
+
const filterByOnlyAncestors = nodes => {
|
|
3334
|
+
for (let i = 0; i < nodes.length; ++i) {
|
|
3335
|
+
for (let j = 0; j < nodes.length; ++j) {
|
|
3336
|
+
if (j !== i && nodes[j].isDescendantOf(nodes[i])) {
|
|
3337
|
+
nodes.splice(j, 1);
|
|
3338
|
+
--j;
|
|
3339
|
+
if (i > j) {
|
|
3340
|
+
--i;
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
return nodes;
|
|
3346
|
+
};
|
|
3347
|
+
/**
|
|
3348
|
+
* Removes any nodes from the given list which are an ancestor of another node in the list.
|
|
3349
|
+
* @param nodes A list of nodes.
|
|
3350
|
+
* @returns The given list of nodes minus any node that is an ancestor of another node in the list.
|
|
3351
|
+
*/
|
|
3352
|
+
const filterByOnlyDescendants = nodes => {
|
|
3353
|
+
for (let i = 0; i < nodes.length; ++i) {
|
|
3354
|
+
for (let j = 0; j < nodes.length; ++j) {
|
|
3355
|
+
if (j !== i && nodes[j].isAncestorOf(nodes[i])) {
|
|
3356
|
+
nodes.splice(j, 1);
|
|
3357
|
+
--j;
|
|
3358
|
+
if (i > j) {
|
|
3359
|
+
--i;
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
return nodes;
|
|
3365
|
+
};
|
|
3366
|
+
const getBottomPadding = config => {
|
|
3367
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
3368
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3369
|
+
} else if (typeof config.padding === 'number') {
|
|
3370
|
+
return config.padding;
|
|
3371
|
+
} else {
|
|
3372
|
+
if (config.padding.length === 0) {
|
|
3373
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3374
|
+
} else if (config.padding.length === 1) {
|
|
3375
|
+
return config.padding[0];
|
|
3376
|
+
} else if (config.padding.length === 2) {
|
|
3377
|
+
return config.padding[0];
|
|
3378
|
+
} else if (config.padding.length === 3) {
|
|
3379
|
+
return config.padding[2];
|
|
3380
|
+
} else {
|
|
3381
|
+
return config.padding[2];
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
};
|
|
3385
|
+
const getLeftPadding = config => {
|
|
3386
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
3387
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3388
|
+
} else if (typeof config.padding === 'number') {
|
|
3389
|
+
return config.padding;
|
|
3390
|
+
} else {
|
|
3391
|
+
if (config.padding.length === 0) {
|
|
3392
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3393
|
+
} else if (config.padding.length === 1) {
|
|
3394
|
+
return config.padding[0];
|
|
3395
|
+
} else if (config.padding.length === 2) {
|
|
3396
|
+
return config.padding[1];
|
|
3397
|
+
} else if (config.padding.length === 3) {
|
|
3398
|
+
return config.padding[1];
|
|
3399
|
+
} else {
|
|
3400
|
+
return config.padding[3];
|
|
3401
|
+
}
|
|
3402
|
+
}
|
|
3403
|
+
};
|
|
3404
|
+
const getRightPadding = config => {
|
|
3405
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
3406
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3407
|
+
} else if (typeof config.padding === 'number') {
|
|
3408
|
+
return config.padding;
|
|
3409
|
+
} else {
|
|
3410
|
+
if (config.padding.length === 0) {
|
|
3411
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3412
|
+
} else if (config.padding.length === 1) {
|
|
3413
|
+
return config.padding[0];
|
|
3414
|
+
} else if (config.padding.length === 2) {
|
|
3415
|
+
return config.padding[1];
|
|
3416
|
+
} else if (config.padding.length === 3) {
|
|
3417
|
+
return config.padding[1];
|
|
3418
|
+
} else {
|
|
3419
|
+
return config.padding[1];
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
};
|
|
3423
|
+
const getTopPadding = config => {
|
|
3424
|
+
if ((config === null || config === undefined ? undefined : config.padding) === null || (config === null || config === undefined ? undefined : config.padding) === undefined) {
|
|
3425
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3426
|
+
} else if (typeof config.padding === 'number') {
|
|
3427
|
+
return config.padding;
|
|
3428
|
+
} else {
|
|
3429
|
+
if (config.padding.length === 0) {
|
|
3430
|
+
return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
|
|
3431
|
+
} else if (config.padding.length === 1) {
|
|
3432
|
+
return config.padding[0];
|
|
3433
|
+
} else if (config.padding.length === 2) {
|
|
3434
|
+
return config.padding[0];
|
|
3435
|
+
} else if (config.padding.length === 3) {
|
|
3436
|
+
return config.padding[0];
|
|
3437
|
+
} else {
|
|
3438
|
+
return config.padding[0];
|
|
3439
|
+
}
|
|
3440
|
+
}
|
|
3441
|
+
};
|
|
3133
3442
|
|
|
3134
3443
|
/**
|
|
3135
3444
|
* Default values of the parameters of a diagram port.
|
|
@@ -3173,7 +3482,17 @@ class DiagramPort extends DiagramElement {
|
|
|
3173
3482
|
}
|
|
3174
3483
|
updateInView() {
|
|
3175
3484
|
var _a;
|
|
3176
|
-
(_a = this.model.canvas) === null || _a ===
|
|
3485
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updatePortsInView(this.id);
|
|
3486
|
+
}
|
|
3487
|
+
raise() {
|
|
3488
|
+
var _a;
|
|
3489
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
3490
|
+
for (const connection of this.incomingConnections) {
|
|
3491
|
+
connection.raise();
|
|
3492
|
+
}
|
|
3493
|
+
for (const connection of this.outgoingConnections) {
|
|
3494
|
+
connection.raise();
|
|
3495
|
+
}
|
|
3177
3496
|
}
|
|
3178
3497
|
/**
|
|
3179
3498
|
* Add a connection to this port's list of outgoing connections.
|
|
@@ -3206,7 +3525,7 @@ class DiagramPort extends DiagramElement {
|
|
|
3206
3525
|
}
|
|
3207
3526
|
getPriority() {
|
|
3208
3527
|
var _a;
|
|
3209
|
-
return ((_a = this.rootElement) === null || _a ===
|
|
3528
|
+
return ((_a = this.rootElement) === null || _a === undefined ? undefined : _a.getPriority()) || DEFAULT_PRIORITY;
|
|
3210
3529
|
}
|
|
3211
3530
|
/**
|
|
3212
3531
|
* Change the coordinates of this port to the given coordinates and move its labels correspondingly.
|
|
@@ -3312,7 +3631,7 @@ class DagaImporter {
|
|
|
3312
3631
|
return model;
|
|
3313
3632
|
}
|
|
3314
3633
|
importNode(model, node) {
|
|
3315
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
3634
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3316
3635
|
const newNodeType = model.nodes.types.get(node.type);
|
|
3317
3636
|
if (newNodeType) {
|
|
3318
3637
|
const newNode = new DiagramNode(model, newNodeType, node.coords, node.id);
|
|
@@ -3330,14 +3649,21 @@ class DagaImporter {
|
|
|
3330
3649
|
newField.updateInView();
|
|
3331
3650
|
}
|
|
3332
3651
|
}
|
|
3652
|
+
for (const child of node.children || []) {
|
|
3653
|
+
const newChild = this.importNode(model, child);
|
|
3654
|
+
if (newChild !== undefined) {
|
|
3655
|
+
(_a = newNode.children) === null || _a === undefined ? undefined : _a.push(newChild);
|
|
3656
|
+
newChild.parent = newNode;
|
|
3657
|
+
}
|
|
3658
|
+
}
|
|
3333
3659
|
for (const section of node.sections || []) {
|
|
3334
3660
|
const newSection = new DiagramSection(model, newNode, section.indexXInNode, section.indexYInNode, section.coords, section.width, section.height, section.id);
|
|
3335
|
-
(
|
|
3661
|
+
(_b = newNode.sections) === null || _b === undefined ? undefined : _b.push(newSection);
|
|
3336
3662
|
model.sections.add(newSection);
|
|
3337
3663
|
if (section.label) {
|
|
3338
3664
|
// add section label
|
|
3339
|
-
if ((
|
|
3340
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (
|
|
3665
|
+
if ((_f = (_e = (_d = (_c = newNodeType.sectionGrid) === null || _c === undefined ? undefined : _c.sections) === null || _d === undefined ? undefined : _d[section.indexYInNode]) === null || _e === undefined ? undefined : _e[section.indexXInNode]) === null || _f === undefined ? undefined : _f.label) {
|
|
3666
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_k = (_j = (_h = (_g = newNodeType.sectionGrid) === null || _g === undefined ? undefined : _g.sections) === null || _h === undefined ? undefined : _h[section.indexYInNode]) === null || _j === undefined ? undefined : _j[section.indexXInNode]) === null || _k === undefined ? undefined : _k.label);
|
|
3341
3667
|
const newField = new DiagramField(model, newSection, [newSection.coords[0] + getLeftMargin(labelConfiguration), newSection.coords[1] + getTopMargin(labelConfiguration)], newSection.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newSection.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, '', labelConfiguration.editable, labelConfiguration.fit);
|
|
3342
3668
|
newField.text = section.label;
|
|
3343
3669
|
newSection.label = newField;
|
|
@@ -3482,16 +3808,21 @@ class DagaImporter {
|
|
|
3482
3808
|
* @see AddNodeAction
|
|
3483
3809
|
*/
|
|
3484
3810
|
class AddNodeCollabAction {
|
|
3485
|
-
constructor(canvas, id, typeId, coords, label, values) {
|
|
3811
|
+
constructor(canvas, id, typeId, coords, parentId, label, values) {
|
|
3486
3812
|
this.canvas = canvas;
|
|
3487
3813
|
this.id = id;
|
|
3488
3814
|
this.typeId = typeId;
|
|
3489
3815
|
this.coords = coords;
|
|
3816
|
+
this.parentId = parentId;
|
|
3490
3817
|
this.label = label;
|
|
3491
3818
|
this.values = values;
|
|
3492
3819
|
}
|
|
3493
3820
|
do() {
|
|
3821
|
+
var _a;
|
|
3494
3822
|
const node = this.canvas.model.nodes.new(this.typeId, this.coords, this.id);
|
|
3823
|
+
if (this.parentId !== undefined) {
|
|
3824
|
+
(_a = this.canvas.model.nodes.get(this.parentId)) === null || _a === undefined ? undefined : _a.addChild(node);
|
|
3825
|
+
}
|
|
3495
3826
|
if (this.values !== undefined) {
|
|
3496
3827
|
node.valueSet.setValues(structuredClone(Object.assign(Object.assign({}, node.valueSet.getValues()), this.values)));
|
|
3497
3828
|
}
|
|
@@ -3505,12 +3836,45 @@ class AddNodeCollabAction {
|
|
|
3505
3836
|
id: this.id,
|
|
3506
3837
|
typeId: this.typeId,
|
|
3507
3838
|
coords: this.coords,
|
|
3839
|
+
parentId: this.parentId,
|
|
3508
3840
|
label: this.label,
|
|
3509
3841
|
values: this.values
|
|
3510
3842
|
};
|
|
3511
3843
|
}
|
|
3512
3844
|
static deserialize(canvas, serialized) {
|
|
3513
|
-
return new AddNodeCollabAction(canvas, serialized.id, serialized.typeId, serialized.coords, serialized.label, serialized.values);
|
|
3845
|
+
return new AddNodeCollabAction(canvas, serialized.id, serialized.typeId, serialized.coords, serialized.parentId, serialized.label, serialized.values);
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3848
|
+
/**
|
|
3849
|
+
* Collaborative which consists of applying a layout to the diagram which can change the location of several nodes.
|
|
3850
|
+
* @private
|
|
3851
|
+
* @see ApplyLayoutAction
|
|
3852
|
+
*/
|
|
3853
|
+
class ApplyLayoutCollabAction {
|
|
3854
|
+
constructor(canvas, to, timestamp) {
|
|
3855
|
+
this.canvas = canvas;
|
|
3856
|
+
this.to = to;
|
|
3857
|
+
this.timestamp = timestamp;
|
|
3858
|
+
}
|
|
3859
|
+
do() {
|
|
3860
|
+
for (const nodeId in this.to) {
|
|
3861
|
+
const node = this.canvas.model.nodes.get(nodeId, true);
|
|
3862
|
+
if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
|
|
3863
|
+
const point = this.to[nodeId];
|
|
3864
|
+
node.move([point[0], point[1]]);
|
|
3865
|
+
node.geometryTimestamp = this.timestamp;
|
|
3866
|
+
}
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
serialize() {
|
|
3870
|
+
return {
|
|
3871
|
+
type: 'applyLayout',
|
|
3872
|
+
to: this.to,
|
|
3873
|
+
timestamp: this.timestamp
|
|
3874
|
+
};
|
|
3875
|
+
}
|
|
3876
|
+
static deserialize(canvas, serialized) {
|
|
3877
|
+
return new ApplyLayoutCollabAction(canvas, serialized.to, serialized.timestamp);
|
|
3514
3878
|
}
|
|
3515
3879
|
}
|
|
3516
3880
|
/**
|
|
@@ -3526,10 +3890,12 @@ class MoveCollabAction {
|
|
|
3526
3890
|
this.timestamp = timestamp;
|
|
3527
3891
|
}
|
|
3528
3892
|
do() {
|
|
3893
|
+
var _a;
|
|
3529
3894
|
for (const nodeId of this.nodeIds) {
|
|
3530
3895
|
const node = this.canvas.model.nodes.get(nodeId, true);
|
|
3531
3896
|
if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
|
|
3532
3897
|
node.move([node.coords[0] + this.delta[0], node.coords[1] + this.delta[1]]);
|
|
3898
|
+
(_a = node.parent) === null || _a === undefined ? undefined : _a.fitToChild(node);
|
|
3533
3899
|
node.geometryTimestamp = this.timestamp;
|
|
3534
3900
|
}
|
|
3535
3901
|
}
|
|
@@ -3559,19 +3925,20 @@ class SetGeometryCollabAction {
|
|
|
3559
3925
|
this.timestamp = timestamp;
|
|
3560
3926
|
}
|
|
3561
3927
|
do() {
|
|
3562
|
-
var _a, _b;
|
|
3928
|
+
var _a, _b, _c;
|
|
3563
3929
|
const node = this.canvas.model.nodes.get(this.nodeId, true);
|
|
3564
3930
|
if (node && timestampWins(this.timestamp, node.geometryTimestamp)) {
|
|
3565
3931
|
node.setGeometry(this.to);
|
|
3566
3932
|
// Re-fit the labels, in case their text has changed since `this.to` was measured.
|
|
3567
|
-
if ((_a = node.label) === null || _a ===
|
|
3933
|
+
if ((_a = node.label) === null || _a === undefined ? undefined : _a.fit) {
|
|
3568
3934
|
this.canvas.fitFieldRootInView(node.label.id);
|
|
3569
3935
|
}
|
|
3570
3936
|
for (const section of node.sections) {
|
|
3571
|
-
if ((_b = section.label) === null || _b ===
|
|
3937
|
+
if ((_b = section.label) === null || _b === undefined ? undefined : _b.fit) {
|
|
3572
3938
|
this.canvas.fitFieldRootInView(section.label.id);
|
|
3573
3939
|
}
|
|
3574
3940
|
}
|
|
3941
|
+
(_c = node.parent) === null || _c === undefined ? undefined : _c.fitToChild(node);
|
|
3575
3942
|
node.geometryTimestamp = this.timestamp;
|
|
3576
3943
|
}
|
|
3577
3944
|
}
|
|
@@ -3587,6 +3954,42 @@ class SetGeometryCollabAction {
|
|
|
3587
3954
|
return new SetGeometryCollabAction(canvas, serialized.nodeId, serialized.to, serialized.timestamp);
|
|
3588
3955
|
}
|
|
3589
3956
|
}
|
|
3957
|
+
/**
|
|
3958
|
+
* Collaborative action which consists of setting a node's parent.
|
|
3959
|
+
* @private
|
|
3960
|
+
* @see SetParentAction
|
|
3961
|
+
*/
|
|
3962
|
+
class SetParentCollabAction {
|
|
3963
|
+
constructor(canvas, childId, parentId, childGeometry, timestamp) {
|
|
3964
|
+
this.canvas = canvas;
|
|
3965
|
+
this.childId = childId;
|
|
3966
|
+
this.parentId = parentId;
|
|
3967
|
+
this.childGeometry = childGeometry;
|
|
3968
|
+
this.timestamp = timestamp;
|
|
3969
|
+
}
|
|
3970
|
+
do() {
|
|
3971
|
+
var _a;
|
|
3972
|
+
const childNode = this.canvas.model.nodes.get(this.childId, true);
|
|
3973
|
+
const parentNode = this.parentId !== undefined ? this.canvas.model.nodes.get(this.parentId, true) : undefined;
|
|
3974
|
+
if (childNode && (this.parentId !== undefined ? parentNode : true) && timestampWins(this.timestamp, childNode.geometryTimestamp)) {
|
|
3975
|
+
(_a = childNode.parent) === null || _a === undefined ? undefined : _a.removeChild(childNode);
|
|
3976
|
+
childNode.setGeometry(this.childGeometry);
|
|
3977
|
+
parentNode === null || parentNode === undefined ? undefined : parentNode.addChild(childNode);
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
serialize() {
|
|
3981
|
+
return {
|
|
3982
|
+
type: 'setParent',
|
|
3983
|
+
childId: this.childId,
|
|
3984
|
+
parentId: this.parentId,
|
|
3985
|
+
childGeometry: this.childGeometry,
|
|
3986
|
+
timestamp: this.timestamp
|
|
3987
|
+
};
|
|
3988
|
+
}
|
|
3989
|
+
static deserialize(canvas, serialized) {
|
|
3990
|
+
return new SetParentCollabAction(canvas, serialized.childId, serialized.parentId, serialized.childGeometry, serialized.timestamp);
|
|
3991
|
+
}
|
|
3992
|
+
}
|
|
3590
3993
|
/**
|
|
3591
3994
|
* Collaborative action which consists of adding a connection.
|
|
3592
3995
|
* @private
|
|
@@ -3668,12 +4071,12 @@ class UpdateValuesCollabAction {
|
|
|
3668
4071
|
if (this.id === undefined) {
|
|
3669
4072
|
return this.canvas.model.valueSet;
|
|
3670
4073
|
} else {
|
|
3671
|
-
return (_a = this.canvas.model.nodes.get(this.id, true) || this.canvas.model.connections.get(this.id, true)) === null || _a ===
|
|
4074
|
+
return (_a = this.canvas.model.nodes.get(this.id, true) || this.canvas.model.connections.get(this.id, true)) === null || _a === undefined ? undefined : _a.valueSet;
|
|
3672
4075
|
}
|
|
3673
4076
|
}
|
|
3674
4077
|
do() {
|
|
3675
4078
|
var _a;
|
|
3676
|
-
(_a = this.getValueSet()) === null || _a ===
|
|
4079
|
+
(_a = this.getValueSet()) === null || _a === undefined ? undefined : _a.overwriteValuesLww(this.to, this.timestamp);
|
|
3677
4080
|
}
|
|
3678
4081
|
serialize() {
|
|
3679
4082
|
return {
|
|
@@ -3858,6 +4261,12 @@ class CollabEngine {
|
|
|
3858
4261
|
action.do();
|
|
3859
4262
|
break;
|
|
3860
4263
|
}
|
|
4264
|
+
case 'applyLayout':
|
|
4265
|
+
{
|
|
4266
|
+
const action = ApplyLayoutCollabAction.deserialize(this.canvas, message);
|
|
4267
|
+
action.do();
|
|
4268
|
+
break;
|
|
4269
|
+
}
|
|
3861
4270
|
case 'move':
|
|
3862
4271
|
{
|
|
3863
4272
|
const action = MoveCollabAction.deserialize(this.canvas, message);
|
|
@@ -3870,6 +4279,12 @@ class CollabEngine {
|
|
|
3870
4279
|
action.do();
|
|
3871
4280
|
break;
|
|
3872
4281
|
}
|
|
4282
|
+
case 'setParent':
|
|
4283
|
+
{
|
|
4284
|
+
const action = SetParentCollabAction.deserialize(this.canvas, message);
|
|
4285
|
+
action.do();
|
|
4286
|
+
break;
|
|
4287
|
+
}
|
|
3873
4288
|
case 'addConnection':
|
|
3874
4289
|
{
|
|
3875
4290
|
const action = AddConnectionCollabAction.deserialize(this.canvas, message);
|
|
@@ -3910,7 +4325,7 @@ class CollabEngine {
|
|
|
3910
4325
|
}
|
|
3911
4326
|
|
|
3912
4327
|
/**
|
|
3913
|
-
* A stack of recent actions taken by the user
|
|
4328
|
+
* A stack of recent actions taken by the user.
|
|
3914
4329
|
* @private
|
|
3915
4330
|
*/
|
|
3916
4331
|
class ActionStack {
|
|
@@ -3935,37 +4350,60 @@ class ActionStack {
|
|
|
3935
4350
|
this.history.push(action);
|
|
3936
4351
|
++this.index;
|
|
3937
4352
|
}
|
|
3938
|
-
this.canvas.diagramChange$.next(
|
|
4353
|
+
this.canvas.diagramChange$.next({
|
|
4354
|
+
action,
|
|
4355
|
+
method: DiagramActionMethod.Do
|
|
4356
|
+
});
|
|
3939
4357
|
}
|
|
3940
4358
|
/**
|
|
3941
4359
|
* Undoes the last action in the history, not counting undone actions.
|
|
3942
4360
|
* @private
|
|
3943
4361
|
*/
|
|
3944
4362
|
undo() {
|
|
4363
|
+
let action;
|
|
3945
4364
|
if (this.index > 0) {
|
|
3946
4365
|
let hasEffect;
|
|
3947
4366
|
do {
|
|
3948
4367
|
--this.index;
|
|
3949
|
-
|
|
4368
|
+
action = this.history[this.index];
|
|
4369
|
+
hasEffect = action.undo();
|
|
3950
4370
|
} while (!hasEffect && this.index > 0);
|
|
3951
4371
|
}
|
|
3952
|
-
this.canvas.diagramChange$.next(
|
|
4372
|
+
this.canvas.diagramChange$.next({
|
|
4373
|
+
action,
|
|
4374
|
+
method: DiagramActionMethod.Undo
|
|
4375
|
+
});
|
|
3953
4376
|
}
|
|
3954
4377
|
/**
|
|
3955
4378
|
* Redoes the last undone action in the history.
|
|
3956
4379
|
* @private
|
|
3957
4380
|
*/
|
|
3958
4381
|
redo() {
|
|
4382
|
+
let action;
|
|
3959
4383
|
if (this.index < this.history.length) {
|
|
3960
4384
|
let hasEffect;
|
|
3961
4385
|
do {
|
|
3962
|
-
|
|
4386
|
+
action = this.history[this.index];
|
|
4387
|
+
hasEffect = action.redo();
|
|
3963
4388
|
++this.index;
|
|
3964
4389
|
} while (!hasEffect && this.index < this.history.length);
|
|
3965
4390
|
}
|
|
3966
|
-
this.canvas.diagramChange$.next(
|
|
4391
|
+
this.canvas.diagramChange$.next({
|
|
4392
|
+
action,
|
|
4393
|
+
method: DiagramActionMethod.Redo
|
|
4394
|
+
});
|
|
3967
4395
|
}
|
|
3968
4396
|
}
|
|
4397
|
+
/**
|
|
4398
|
+
* The different methods of an action.
|
|
4399
|
+
* @private
|
|
4400
|
+
*/
|
|
4401
|
+
var DiagramActionMethod;
|
|
4402
|
+
(function (DiagramActionMethod) {
|
|
4403
|
+
DiagramActionMethod[DiagramActionMethod["Do"] = 0] = "Do";
|
|
4404
|
+
DiagramActionMethod[DiagramActionMethod["Undo"] = 1] = "Undo";
|
|
4405
|
+
DiagramActionMethod[DiagramActionMethod["Redo"] = 2] = "Redo";
|
|
4406
|
+
})(DiagramActionMethod || (DiagramActionMethod = {}));
|
|
3969
4407
|
/**
|
|
3970
4408
|
* Enum listing the actions that can be taken by the user.
|
|
3971
4409
|
* The actions can correspond to a DiagramAction that can be recorded in the action stack of a diagram or they may not correspond to any DiagramAction implementations.
|
|
@@ -3985,6 +4423,12 @@ var DiagramActions;
|
|
|
3985
4423
|
* @see AddNodeAction
|
|
3986
4424
|
*/
|
|
3987
4425
|
DiagramActions["AddNode"] = "add-node";
|
|
4426
|
+
/**
|
|
4427
|
+
* Action that corresponds to applying a layout which changes the location of several nodes.
|
|
4428
|
+
* @public
|
|
4429
|
+
* @see ApplyLayoutAction
|
|
4430
|
+
*/
|
|
4431
|
+
DiagramActions["ApplyLayout"] = "apply-layout";
|
|
3988
4432
|
/**
|
|
3989
4433
|
* Action that corresponds to copying diagram elements to the clipboard.
|
|
3990
4434
|
* @public
|
|
@@ -4050,17 +4494,25 @@ var DiagramActions;
|
|
|
4050
4494
|
* @see DiagramNode
|
|
4051
4495
|
*/
|
|
4052
4496
|
class AddNodeAction {
|
|
4053
|
-
constructor(canvas, type, coords, label, values) {
|
|
4497
|
+
constructor(canvas, type, coords, parentId, ancestorId, fromAncestorGeometry, toAncestorGeometry, label, values) {
|
|
4054
4498
|
this.canvas = canvas;
|
|
4055
4499
|
this.type = type;
|
|
4056
4500
|
this.coords = coords;
|
|
4501
|
+
this.parentId = parentId;
|
|
4502
|
+
this.ancestorId = ancestorId;
|
|
4503
|
+
this.fromAncestorGeometry = fromAncestorGeometry;
|
|
4504
|
+
this.toAncestorGeometry = toAncestorGeometry;
|
|
4057
4505
|
this.label = label;
|
|
4058
4506
|
this.values = values;
|
|
4059
4507
|
this.id = this.canvas.collabEngine.freshId();
|
|
4060
4508
|
}
|
|
4061
4509
|
do() {
|
|
4062
|
-
const collabAction = new AddNodeCollabAction(this.canvas, this.id, this.type.id, this.coords, this.label, this.values);
|
|
4510
|
+
const collabAction = new AddNodeCollabAction(this.canvas, this.id, this.type.id, this.coords, this.parentId, this.label, this.values);
|
|
4063
4511
|
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4512
|
+
if (this.ancestorId !== undefined && this.toAncestorGeometry !== undefined) {
|
|
4513
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4514
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4515
|
+
}
|
|
4064
4516
|
// creating a node always has an effect
|
|
4065
4517
|
return true;
|
|
4066
4518
|
}
|
|
@@ -4068,6 +4520,10 @@ class AddNodeAction {
|
|
|
4068
4520
|
const node = this.canvas.model.nodes.get(this.id);
|
|
4069
4521
|
const collabAction = new SetSelfRemovedCollabAction(this.canvas, [this.id], [], [], [], [], true, this.canvas.collabEngine.freshTimestamp());
|
|
4070
4522
|
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4523
|
+
if (this.ancestorId !== undefined && this.fromAncestorGeometry !== undefined) {
|
|
4524
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.fromAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4525
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4526
|
+
}
|
|
4071
4527
|
// undoing creating a node has an effect if the node was not already removed
|
|
4072
4528
|
return node !== undefined;
|
|
4073
4529
|
}
|
|
@@ -4075,10 +4531,38 @@ class AddNodeAction {
|
|
|
4075
4531
|
const node = this.canvas.model.nodes.get(this.id);
|
|
4076
4532
|
const collabAction = new SetSelfRemovedCollabAction(this.canvas, [this.id], [], [], [], [], false, this.canvas.collabEngine.freshTimestamp());
|
|
4077
4533
|
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4534
|
+
if (this.ancestorId !== undefined && this.toAncestorGeometry !== undefined) {
|
|
4535
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4536
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4537
|
+
}
|
|
4078
4538
|
// redoing creating a node has an effect if the node was removed
|
|
4079
4539
|
return node === undefined;
|
|
4080
4540
|
}
|
|
4081
4541
|
}
|
|
4542
|
+
/**
|
|
4543
|
+
* Action which consists of applying a layout to the diagram which can change the location of several nodes.
|
|
4544
|
+
* @private
|
|
4545
|
+
*/
|
|
4546
|
+
class ApplyLayoutAction {
|
|
4547
|
+
constructor(canvas, from, to) {
|
|
4548
|
+
this.canvas = canvas;
|
|
4549
|
+
this.from = from;
|
|
4550
|
+
this.to = to;
|
|
4551
|
+
}
|
|
4552
|
+
do() {
|
|
4553
|
+
const collabAction = new ApplyLayoutCollabAction(this.canvas, this.to, this.canvas.collabEngine.freshTimestamp());
|
|
4554
|
+
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4555
|
+
return true;
|
|
4556
|
+
}
|
|
4557
|
+
undo() {
|
|
4558
|
+
const collabAction = new ApplyLayoutCollabAction(this.canvas, this.from, this.canvas.collabEngine.freshTimestamp());
|
|
4559
|
+
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4560
|
+
return true;
|
|
4561
|
+
}
|
|
4562
|
+
redo() {
|
|
4563
|
+
return this.do();
|
|
4564
|
+
}
|
|
4565
|
+
}
|
|
4082
4566
|
/**
|
|
4083
4567
|
* Action which consists of changing the coordinates of diagram elements by a fixed amount.
|
|
4084
4568
|
* @private
|
|
@@ -4109,17 +4593,26 @@ class MoveAction {
|
|
|
4109
4593
|
* @see DiagramNode
|
|
4110
4594
|
*/
|
|
4111
4595
|
class SetGeometryAction {
|
|
4112
|
-
constructor(canvas, intent, nodeId, from, to) {
|
|
4596
|
+
constructor(canvas, intent, nodeId, from, to, ancestorId, fromAncestorGeometry, toAncestorGeometry) {
|
|
4113
4597
|
this.canvas = canvas;
|
|
4114
4598
|
this.intent = intent;
|
|
4115
4599
|
this.nodeId = nodeId;
|
|
4116
4600
|
this.from = from;
|
|
4117
4601
|
this.to = to;
|
|
4602
|
+
this.ancestorId = ancestorId;
|
|
4603
|
+
this.fromAncestorGeometry = fromAncestorGeometry;
|
|
4604
|
+
this.toAncestorGeometry = toAncestorGeometry;
|
|
4118
4605
|
}
|
|
4119
4606
|
do() {
|
|
4120
4607
|
const node = this.canvas.model.nodes.get(this.nodeId);
|
|
4121
|
-
|
|
4122
|
-
|
|
4608
|
+
if (node) {
|
|
4609
|
+
const collabAction = new SetGeometryCollabAction(this.canvas, this.nodeId, this.to, this.canvas.collabEngine.freshTimestamp());
|
|
4610
|
+
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4611
|
+
if (this.ancestorId !== undefined && this.toAncestorGeometry !== undefined) {
|
|
4612
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4613
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4614
|
+
}
|
|
4615
|
+
}
|
|
4123
4616
|
return node !== undefined;
|
|
4124
4617
|
}
|
|
4125
4618
|
undo() {
|
|
@@ -4128,6 +4621,10 @@ class SetGeometryAction {
|
|
|
4128
4621
|
this.to = node.getGeometry();
|
|
4129
4622
|
const collabAction = new SetGeometryCollabAction(this.canvas, this.nodeId, this.from, this.canvas.collabEngine.freshTimestamp());
|
|
4130
4623
|
this.canvas.collabEngine.doCollaboratively(collabAction);
|
|
4624
|
+
if (this.ancestorId !== undefined && this.fromAncestorGeometry !== undefined) {
|
|
4625
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.fromAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4626
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4627
|
+
}
|
|
4131
4628
|
}
|
|
4132
4629
|
return node !== undefined;
|
|
4133
4630
|
}
|
|
@@ -4141,6 +4638,46 @@ class SetGeometryAction {
|
|
|
4141
4638
|
return node !== undefined;
|
|
4142
4639
|
}
|
|
4143
4640
|
}
|
|
4641
|
+
/**
|
|
4642
|
+
* Action which consists of setting a node's parent.
|
|
4643
|
+
* @private
|
|
4644
|
+
*/
|
|
4645
|
+
class SetParentAction {
|
|
4646
|
+
constructor(canvas, childId, fromParentId, toParentId, fromChildGeometry, toChildGeometry, ancestorId, fromAncestorGeometry, toAncestorGeometry) {
|
|
4647
|
+
this.canvas = canvas;
|
|
4648
|
+
this.childId = childId;
|
|
4649
|
+
this.fromParentId = fromParentId;
|
|
4650
|
+
this.toParentId = toParentId;
|
|
4651
|
+
this.fromChildGeometry = fromChildGeometry;
|
|
4652
|
+
this.toChildGeometry = toChildGeometry;
|
|
4653
|
+
this.ancestorId = ancestorId;
|
|
4654
|
+
this.fromAncestorGeometry = fromAncestorGeometry;
|
|
4655
|
+
this.toAncestorGeometry = toAncestorGeometry;
|
|
4656
|
+
}
|
|
4657
|
+
do() {
|
|
4658
|
+
const childNode = this.canvas.model.nodes.get(this.childId);
|
|
4659
|
+
const collabAction1 = new SetParentCollabAction(this.canvas, this.childId, this.toParentId, this.toChildGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4660
|
+
this.canvas.collabEngine.doCollaboratively(collabAction1);
|
|
4661
|
+
if (this.ancestorId !== undefined && this.toAncestorGeometry !== undefined) {
|
|
4662
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.toAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4663
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4664
|
+
}
|
|
4665
|
+
return childNode !== undefined;
|
|
4666
|
+
}
|
|
4667
|
+
undo() {
|
|
4668
|
+
const childNode = this.canvas.model.nodes.get(this.childId);
|
|
4669
|
+
const collabAction1 = new SetParentCollabAction(this.canvas, this.childId, this.fromParentId, this.fromChildGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4670
|
+
this.canvas.collabEngine.doCollaboratively(collabAction1);
|
|
4671
|
+
if (this.ancestorId !== undefined && this.fromAncestorGeometry !== undefined) {
|
|
4672
|
+
const collabAction2 = new SetGeometryCollabAction(this.canvas, this.ancestorId, this.fromAncestorGeometry, this.canvas.collabEngine.freshTimestamp());
|
|
4673
|
+
this.canvas.collabEngine.doCollaboratively(collabAction2);
|
|
4674
|
+
}
|
|
4675
|
+
return childNode !== undefined;
|
|
4676
|
+
}
|
|
4677
|
+
redo() {
|
|
4678
|
+
return this.do();
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4144
4681
|
/**
|
|
4145
4682
|
* Action which consists of adding a connection.
|
|
4146
4683
|
* @private
|
|
@@ -4405,21 +4942,97 @@ class PasteAction {
|
|
|
4405
4942
|
}
|
|
4406
4943
|
|
|
4407
4944
|
/**
|
|
4408
|
-
* Represents an action taken by the user on the diagram.
|
|
4945
|
+
* Represents an action taken by the user on the diagram which doesn't have an impact on the diagram's model.
|
|
4946
|
+
* Contrast with {@link DiagramAction} which does have an impact on the diagram's model.
|
|
4409
4947
|
* @public
|
|
4410
4948
|
*/
|
|
4411
4949
|
class DiagramEvent {
|
|
4412
|
-
constructor(
|
|
4413
|
-
this.cause = cause;
|
|
4950
|
+
constructor(type) {
|
|
4414
4951
|
this.type = type;
|
|
4415
|
-
this.target = target;
|
|
4416
|
-
this.coords = coords;
|
|
4417
4952
|
this.defaultPrevented = false;
|
|
4418
4953
|
}
|
|
4419
4954
|
preventDefault() {
|
|
4420
4955
|
this.defaultPrevented = true;
|
|
4421
4956
|
}
|
|
4422
4957
|
}
|
|
4958
|
+
/**
|
|
4959
|
+
* Diagram user events.
|
|
4960
|
+
* @public
|
|
4961
|
+
*/
|
|
4962
|
+
var DiagramEvents;
|
|
4963
|
+
(function (DiagramEvents) {
|
|
4964
|
+
DiagramEvents[DiagramEvents["DoubleClick"] = 0] = "DoubleClick";
|
|
4965
|
+
DiagramEvents[DiagramEvents["SecondaryClick"] = 1] = "SecondaryClick";
|
|
4966
|
+
DiagramEvents[DiagramEvents["Selection"] = 2] = "Selection";
|
|
4967
|
+
DiagramEvents[DiagramEvents["Highlight"] = 3] = "Highlight";
|
|
4968
|
+
})(DiagramEvents || (DiagramEvents = {}));
|
|
4969
|
+
/**
|
|
4970
|
+
* Diagram event which consists of the user performing a double click on the diagram.
|
|
4971
|
+
*/
|
|
4972
|
+
class DiagramDoubleClickEvent extends DiagramEvent {
|
|
4973
|
+
/**
|
|
4974
|
+
* Create a diagram double click event.
|
|
4975
|
+
*
|
|
4976
|
+
* @param cause Mouse event which triggered this event.
|
|
4977
|
+
* @param target Diagram element which is targeted by the event, or null if no element was targeted (the diagram background was targeted).
|
|
4978
|
+
* @param coords Optionally, coordinates of the point of the diagram where the event happened.
|
|
4979
|
+
*/
|
|
4980
|
+
constructor(cause, target, coords) {
|
|
4981
|
+
super(DiagramEvents.DoubleClick);
|
|
4982
|
+
this.cause = cause;
|
|
4983
|
+
this.target = target;
|
|
4984
|
+
this.coords = coords;
|
|
4985
|
+
}
|
|
4986
|
+
}
|
|
4987
|
+
/**
|
|
4988
|
+
* Diagram event which consists of the user performing a secondary click on the diagram.
|
|
4989
|
+
*/
|
|
4990
|
+
class DiagramSecondaryClickEvent extends DiagramEvent {
|
|
4991
|
+
/**
|
|
4992
|
+
* Create a diagram secondary click event.
|
|
4993
|
+
*
|
|
4994
|
+
* @param cause Mouse event which triggered this event.
|
|
4995
|
+
* @param target Diagram element which is targeted by the event, or null if no element was targeted (the diagram background was targeted).
|
|
4996
|
+
* @param coords Optionally, coordinates of the point of the diagram where the event happened.
|
|
4997
|
+
*/
|
|
4998
|
+
constructor(cause, target, coords) {
|
|
4999
|
+
super(DiagramEvents.SecondaryClick);
|
|
5000
|
+
this.cause = cause;
|
|
5001
|
+
this.target = target;
|
|
5002
|
+
this.coords = coords;
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
/**
|
|
5006
|
+
* Diagram event which consists of the user either adding or removing one or several diagram elements from the user selection.
|
|
5007
|
+
*/
|
|
5008
|
+
class DiagramSelectionEvent extends DiagramEvent {
|
|
5009
|
+
/**
|
|
5010
|
+
* Create a diagram selection event.
|
|
5011
|
+
*
|
|
5012
|
+
* @param targets Diagram elements which are targeted by the event.
|
|
5013
|
+
* @param selected `true` if the targets were selected, `false` if the targets were deselected.
|
|
5014
|
+
*/
|
|
5015
|
+
constructor(targets, selected) {
|
|
5016
|
+
super(DiagramEvents.Selection);
|
|
5017
|
+
this.targets = targets;
|
|
5018
|
+
this.selected = selected;
|
|
5019
|
+
}
|
|
5020
|
+
}
|
|
5021
|
+
/**
|
|
5022
|
+
* Diagram event which consists of the user highlighting a diagram element.
|
|
5023
|
+
* If the target is `null`, that means that the previously highlighted element was unhighlighted.
|
|
5024
|
+
*/
|
|
5025
|
+
class DiagramHighlightedEvent extends DiagramEvent {
|
|
5026
|
+
/**
|
|
5027
|
+
* Create a diagram highlight event.
|
|
5028
|
+
*
|
|
5029
|
+
* @param target Diagram element which is targeted by the event.
|
|
5030
|
+
*/
|
|
5031
|
+
constructor(target) {
|
|
5032
|
+
super(DiagramEvents.Highlight);
|
|
5033
|
+
this.target = target;
|
|
5034
|
+
}
|
|
5035
|
+
}
|
|
4423
5036
|
|
|
4424
5037
|
/**
|
|
4425
5038
|
* A foreign object which is inserted with arbitrary html into a diagram.
|
|
@@ -4445,14 +5058,18 @@ class DiagramDecorator extends DiagramElement {
|
|
|
4445
5058
|
}
|
|
4446
5059
|
select() {
|
|
4447
5060
|
var _a, _b;
|
|
4448
|
-
return (_b = (_a = this.model.canvas) === null || _a ===
|
|
5061
|
+
return (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.selectCanvasView()) === null || _b === undefined ? undefined : _b.select(`foreignObject#${this.id}`);
|
|
4449
5062
|
}
|
|
4450
5063
|
get removed() {
|
|
4451
5064
|
return this.selfRemoved || this.rootElement !== undefined && this.rootElement.removed;
|
|
4452
5065
|
}
|
|
4453
5066
|
updateInView() {
|
|
4454
5067
|
var _a;
|
|
4455
|
-
(_a = this.model.canvas) === null || _a ===
|
|
5068
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateDecoratorsInView(this.id);
|
|
5069
|
+
}
|
|
5070
|
+
raise() {
|
|
5071
|
+
var _a;
|
|
5072
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
4456
5073
|
}
|
|
4457
5074
|
/**
|
|
4458
5075
|
* Change the coordinates of this decorator to the given coordinates.
|
|
@@ -4524,14 +5141,18 @@ class DiagramObject extends DiagramElement {
|
|
|
4524
5141
|
}
|
|
4525
5142
|
select() {
|
|
4526
5143
|
var _a, _b;
|
|
4527
|
-
return (_b = (_a = this.model.canvas) === null || _a ===
|
|
5144
|
+
return (_b = (_a = this.model.canvas) === null || _a === undefined ? undefined : _a.selectCanvasView()) === null || _b === undefined ? undefined : _b.select(`foreignObject#${this.id}`);
|
|
4528
5145
|
}
|
|
4529
5146
|
get removed() {
|
|
4530
5147
|
return this.selfRemoved;
|
|
4531
5148
|
}
|
|
4532
5149
|
updateInView() {
|
|
4533
5150
|
var _a;
|
|
4534
|
-
(_a = this.model.canvas) === null || _a ===
|
|
5151
|
+
(_a = this.model.canvas) === null || _a === undefined ? undefined : _a.updateObjectsInView(this.id);
|
|
5152
|
+
}
|
|
5153
|
+
raise() {
|
|
5154
|
+
var _a;
|
|
5155
|
+
(_a = this.select()) === null || _a === undefined ? undefined : _a.raise();
|
|
4535
5156
|
}
|
|
4536
5157
|
/**
|
|
4537
5158
|
* Change the coordinates of this object to the given coordinates.
|
|
@@ -4641,7 +5262,7 @@ class DiagramModel {
|
|
|
4641
5262
|
*/
|
|
4642
5263
|
clear() {
|
|
4643
5264
|
var _a, _b;
|
|
4644
|
-
(_a = this.canvas) === null || _a ===
|
|
5265
|
+
(_a = this.canvas) === null || _a === undefined ? undefined : _a.cancelAllUserActions();
|
|
4645
5266
|
this.id = undefined;
|
|
4646
5267
|
this.name = '';
|
|
4647
5268
|
this.description = undefined;
|
|
@@ -4656,7 +5277,7 @@ class DiagramModel {
|
|
|
4656
5277
|
this.objects.clear();
|
|
4657
5278
|
this.decorators.clear();
|
|
4658
5279
|
this.valueSet.resetValues();
|
|
4659
|
-
(_b = this.canvas) === null || _b ===
|
|
5280
|
+
(_b = this.canvas) === null || _b === undefined ? undefined : _b.updateModelInView();
|
|
4660
5281
|
}
|
|
4661
5282
|
}
|
|
4662
5283
|
|
|
@@ -4785,7 +5406,7 @@ class DiagramContextMenu {
|
|
|
4785
5406
|
*/
|
|
4786
5407
|
close() {
|
|
4787
5408
|
var _a;
|
|
4788
|
-
(_a = this.contextMenuContainer) === null || _a ===
|
|
5409
|
+
(_a = this.contextMenuContainer) === null || _a === undefined ? undefined : _a.remove();
|
|
4789
5410
|
this.contextMenuContainer = undefined;
|
|
4790
5411
|
}
|
|
4791
5412
|
}
|
|
@@ -4900,6 +5521,7 @@ class DagaExporter {
|
|
|
4900
5521
|
}
|
|
4901
5522
|
for (const node of model.nodes.all(true)) {
|
|
4902
5523
|
if (!includeCollabMeta && node.removed) continue;
|
|
5524
|
+
if (node.parent !== undefined) continue;
|
|
4903
5525
|
result.nodes.push(this.exportNode(node, includeCollabMeta));
|
|
4904
5526
|
}
|
|
4905
5527
|
for (const connection of model.connections.all(true)) {
|
|
@@ -4910,6 +5532,10 @@ class DagaExporter {
|
|
|
4910
5532
|
}
|
|
4911
5533
|
exportNode(node, includeCollabMeta = false) {
|
|
4912
5534
|
var _a, _b, _c, _d;
|
|
5535
|
+
const children = [];
|
|
5536
|
+
for (const child of node.children) {
|
|
5537
|
+
children.push(this.exportNode(child, includeCollabMeta));
|
|
5538
|
+
}
|
|
4913
5539
|
const sections = [];
|
|
4914
5540
|
for (const section of node.sections) {
|
|
4915
5541
|
const ports = [];
|
|
@@ -4918,7 +5544,7 @@ class DagaExporter {
|
|
|
4918
5544
|
id: port.id,
|
|
4919
5545
|
coords: roundPoint(port.coords),
|
|
4920
5546
|
direction: port.direction,
|
|
4921
|
-
label: ((_a = port.label) === null || _a ===
|
|
5547
|
+
label: ((_a = port.label) === null || _a === undefined ? undefined : _a.text) || ''
|
|
4922
5548
|
}, includeCollabMeta ? {
|
|
4923
5549
|
collabMeta: Object.assign({
|
|
4924
5550
|
removed: port.removed,
|
|
@@ -4930,7 +5556,7 @@ class DagaExporter {
|
|
|
4930
5556
|
sections.push(Object.assign({
|
|
4931
5557
|
id: section.id,
|
|
4932
5558
|
ports,
|
|
4933
|
-
label: ((_b = section.label) === null || _b ===
|
|
5559
|
+
label: ((_b = section.label) === null || _b === undefined ? undefined : _b.text) || '',
|
|
4934
5560
|
indexXInNode: section.indexXInNode,
|
|
4935
5561
|
indexYInNode: section.indexYInNode,
|
|
4936
5562
|
coords: roundPoint(section.coords),
|
|
@@ -4950,7 +5576,7 @@ class DagaExporter {
|
|
|
4950
5576
|
id: port.id,
|
|
4951
5577
|
coords: roundPoint(port.coords),
|
|
4952
5578
|
direction: port.direction,
|
|
4953
|
-
label: ((_c = port.label) === null || _c ===
|
|
5579
|
+
label: ((_c = port.label) === null || _c === undefined ? undefined : _c.text) || ''
|
|
4954
5580
|
}, includeCollabMeta ? {
|
|
4955
5581
|
collabMeta: Object.assign({
|
|
4956
5582
|
removed: port.removed,
|
|
@@ -4962,9 +5588,10 @@ class DagaExporter {
|
|
|
4962
5588
|
return Object.assign({
|
|
4963
5589
|
id: node.id,
|
|
4964
5590
|
type: node.type.id,
|
|
5591
|
+
children,
|
|
4965
5592
|
sections,
|
|
4966
5593
|
ports,
|
|
4967
|
-
label: ((_d = node.label) === null || _d ===
|
|
5594
|
+
label: ((_d = node.label) === null || _d === undefined ? undefined : _d.text) || '',
|
|
4968
5595
|
coords: roundPoint(node.coords),
|
|
4969
5596
|
width: node.width,
|
|
4970
5597
|
height: node.height,
|
|
@@ -4984,8 +5611,8 @@ class DagaExporter {
|
|
|
4984
5611
|
return Object.assign({
|
|
4985
5612
|
id: connection.id,
|
|
4986
5613
|
type: connection.type.id,
|
|
4987
|
-
start: ((_a = connection.start) === null || _a ===
|
|
4988
|
-
end: ((_b = connection.end) === null || _b ===
|
|
5614
|
+
start: ((_a = connection.start) === null || _a === undefined ? undefined : _a.id) || '',
|
|
5615
|
+
end: ((_b = connection.end) === null || _b === undefined ? undefined : _b.id) || '',
|
|
4989
5616
|
startLabel: connection.startLabel,
|
|
4990
5617
|
middleLabel: connection.middleLabel,
|
|
4991
5618
|
endLabel: connection.endLabel,
|
|
@@ -5205,11 +5832,11 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
5205
5832
|
openInPropertyEditor(selection) {
|
|
5206
5833
|
var _a;
|
|
5207
5834
|
this.makeUpdateValuesAction();
|
|
5208
|
-
const propertyEditor = (_a = this.canvas.parentComponent) === null || _a ===
|
|
5835
|
+
const propertyEditor = (_a = this.canvas.parentComponent) === null || _a === undefined ? undefined : _a.propertyEditor;
|
|
5209
5836
|
if (propertyEditor === undefined) {
|
|
5210
5837
|
return;
|
|
5211
5838
|
}
|
|
5212
|
-
const selectedValueSet = selection === null || selection ===
|
|
5839
|
+
const selectedValueSet = selection === null || selection === undefined ? undefined : selection.valueSet;
|
|
5213
5840
|
if (selectedValueSet) {
|
|
5214
5841
|
this.propertyEditorSelection = selection;
|
|
5215
5842
|
this.propertyEditorValues = structuredClone(selectedValueSet.getValues());
|
|
@@ -5251,11 +5878,11 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
5251
5878
|
const previousSelectionId = this.propertyEditorSelection instanceof DiagramModel ? undefined : this.propertyEditorSelection.id;
|
|
5252
5879
|
// check if there have been changes in the previously selected ValueSet,
|
|
5253
5880
|
// and create an UpdateValuesAction if there have
|
|
5254
|
-
if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a ===
|
|
5881
|
+
if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a === undefined ? undefined : _a.valueSet.getValues())) {
|
|
5255
5882
|
return;
|
|
5256
5883
|
}
|
|
5257
5884
|
const from = this.propertyEditorValues;
|
|
5258
|
-
const to = structuredClone((_b = this.propertyEditorSelection) === null || _b ===
|
|
5885
|
+
const to = structuredClone((_b = this.propertyEditorSelection) === null || _b === undefined ? undefined : _b.valueSet.getValues());
|
|
5259
5886
|
const [fromDiff, toDiff] = diff(from, to);
|
|
5260
5887
|
const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
|
|
5261
5888
|
currentAction.do();
|
|
@@ -5290,7 +5917,7 @@ class DiagramCanvas {
|
|
|
5290
5917
|
var _a, _b;
|
|
5291
5918
|
this._connectionType = value;
|
|
5292
5919
|
// refresh the palette every time connectionType is set so that the palette keeps track of updates to the connectionType
|
|
5293
|
-
(_b = (_a = this.parentComponent) === null || _a ===
|
|
5920
|
+
(_b = (_a = this.parentComponent) === null || _a === undefined ? undefined : _a.palette) === null || _b === undefined ? undefined : _b.refreshPalette();
|
|
5294
5921
|
}
|
|
5295
5922
|
/**
|
|
5296
5923
|
* Constructs a canvas object.
|
|
@@ -5308,27 +5935,25 @@ class DiagramCanvas {
|
|
|
5308
5935
|
this.dragging = false;
|
|
5309
5936
|
// used to track whether a click is secondary or primary
|
|
5310
5937
|
this.secondaryButton = false;
|
|
5311
|
-
this.viewInitialized$ = new Subject();
|
|
5312
5938
|
this.validatorChange$ = new Subject();
|
|
5313
5939
|
this.diagramChange$ = new Subject();
|
|
5314
|
-
this.diagramImportantChange$ = new Subject();
|
|
5315
|
-
this.propertyEditorChanges$ = new Subject();
|
|
5316
5940
|
this.diagramEvent$ = new Subject();
|
|
5941
|
+
this.propertyEditorChanges$ = new Subject();
|
|
5317
5942
|
this.parentComponent = parentComponent;
|
|
5318
5943
|
this.model = new DiagramModel(this, undefined, config.name || 'unnamed', '', config.type || '', config.properties || []);
|
|
5319
5944
|
this.userSelection = new DiagramUserSelection(this);
|
|
5320
5945
|
this.userHighlight = new DiagramUserHighlight(this);
|
|
5321
5946
|
this.contextMenu = new DiagramContextMenu(this);
|
|
5322
|
-
this.backgroundColor = ((_a = config.canvas) === null || _a ===
|
|
5323
|
-
this.gridSize = ((_c = (_b = config.canvas) === null || _b ===
|
|
5324
|
-
this.gridThickness = Math.abs(((_h = (_g = config.canvas) === null || _g ===
|
|
5325
|
-
this.gridColor = ((_k = (_j = config.canvas) === null || _j ===
|
|
5326
|
-
this.snapToGrid = ((_m = (_l = config.canvas) === null || _l ===
|
|
5327
|
-
this.zoomFactor = ((_r = config.canvas) === null || _r ===
|
|
5328
|
-
this.panRate = ((_s = config.canvas) === null || _s ===
|
|
5947
|
+
this.backgroundColor = ((_a = config.canvas) === null || _a === undefined ? undefined : _a.backgroundColor) || '#FFFFFF';
|
|
5948
|
+
this.gridSize = ((_c = (_b = config.canvas) === null || _b === undefined ? undefined : _b.grid) === null || _c === undefined ? undefined : _c.enabled) === false || ((_d = config.canvas) === null || _d === undefined ? undefined : _d.grid) === undefined ? 0 : Math.abs(((_f = (_e = config.canvas) === null || _e === undefined ? undefined : _e.grid) === null || _f === undefined ? undefined : _f.spacing) || 10);
|
|
5949
|
+
this.gridThickness = Math.abs(((_h = (_g = config.canvas) === null || _g === undefined ? undefined : _g.grid) === null || _h === undefined ? undefined : _h.thickness) || 0.05);
|
|
5950
|
+
this.gridColor = ((_k = (_j = config.canvas) === null || _j === undefined ? undefined : _j.grid) === null || _k === undefined ? undefined : _k.color) || 'rgba(0, 0, 0, 0.1)';
|
|
5951
|
+
this.snapToGrid = ((_m = (_l = config.canvas) === null || _l === undefined ? undefined : _l.grid) === null || _m === undefined ? undefined : _m.enabled) === false || ((_o = config.canvas) === null || _o === undefined ? undefined : _o.grid) === undefined ? false : ((_q = (_p = config.canvas) === null || _p === undefined ? undefined : _p.grid) === null || _q === undefined ? undefined : _q.snap) || false;
|
|
5952
|
+
this.zoomFactor = ((_r = config.canvas) === null || _r === undefined ? undefined : _r.zoomFactor) || 2;
|
|
5953
|
+
this.panRate = ((_s = config.canvas) === null || _s === undefined ? undefined : _s.panRate) || 100;
|
|
5329
5954
|
this.inferConnectionType = config.inferConnectionType || false;
|
|
5330
5955
|
this.multipleSelectionOn = false;
|
|
5331
|
-
this.priorityThresholds = ((_t = config.canvas) === null || _t ===
|
|
5956
|
+
this.priorityThresholds = ((_t = config.canvas) === null || _t === undefined ? undefined : _t.priorityThresholds) || [];
|
|
5332
5957
|
this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
|
|
5333
5958
|
this.layoutFormat = config.layoutFormat;
|
|
5334
5959
|
this.userActions = config.userActions || {};
|
|
@@ -5372,18 +5997,21 @@ class DiagramCanvas {
|
|
|
5372
5997
|
for (const node of this.model.nodes) {
|
|
5373
5998
|
this.fitNodeInView(node.id);
|
|
5374
5999
|
}
|
|
5375
|
-
(_b = (_a = this.parentComponent) === null || _a ===
|
|
6000
|
+
(_b = (_a = this.parentComponent) === null || _a === undefined ? undefined : _a.palette) === null || _b === undefined ? undefined : _b.refreshPalette();
|
|
5376
6001
|
}
|
|
5377
6002
|
// View methods
|
|
5378
6003
|
initView(appendTo) {
|
|
5379
|
-
|
|
6004
|
+
const appendToSelection = d3.select(appendTo);
|
|
6005
|
+
// remove all children
|
|
6006
|
+
appendToSelection.html('');
|
|
6007
|
+
this.diagramRoot = appendToSelection.append('div').node();
|
|
5380
6008
|
d3.select(this.diagramRoot).attr('tabindex', 0) // make element focusable
|
|
5381
6009
|
.style('width', '100%').style('height', '100%').append('svg').style('width', '100%').style('height', '100%');
|
|
5382
6010
|
d3.select(this.diagramRoot).on(Events.Click, () => {
|
|
5383
6011
|
var _a;
|
|
5384
6012
|
// focus on the diagram when clicking so that we can focus on the diagram
|
|
5385
6013
|
// keyboard events only work if we're focusing on the diagram
|
|
5386
|
-
(_a = d3.select(this.diagramRoot).node()) === null || _a ===
|
|
6014
|
+
(_a = d3.select(this.diagramRoot).node()) === null || _a === undefined ? undefined : _a.focus();
|
|
5387
6015
|
}).on(Events.ContextMenu, event => {
|
|
5388
6016
|
if (this.dragging) {
|
|
5389
6017
|
event.preventDefault();
|
|
@@ -5391,14 +6019,14 @@ class DiagramCanvas {
|
|
|
5391
6019
|
this.dragging = false;
|
|
5392
6020
|
return;
|
|
5393
6021
|
}
|
|
5394
|
-
const diagramEvent = new
|
|
6022
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, null);
|
|
5395
6023
|
this.diagramEvent$.next(diagramEvent);
|
|
5396
6024
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
5397
6025
|
event.preventDefault();
|
|
5398
6026
|
this.contextMenu.open(event);
|
|
5399
6027
|
}
|
|
5400
6028
|
}).on(Events.DoubleClick, event => {
|
|
5401
|
-
const diagramEvent = new
|
|
6029
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, null);
|
|
5402
6030
|
this.diagramEvent$.next(diagramEvent);
|
|
5403
6031
|
}).on(Events.KeyDown, event => {
|
|
5404
6032
|
if (!event.ctrlKey && (event.key === Keys.Delete || event.key === Keys.Backspace) && this.canUserPerformAction(DiagramActions.Remove)) {
|
|
@@ -5414,15 +6042,34 @@ class DiagramCanvas {
|
|
|
5414
6042
|
for (const connection of this.model.connections) {
|
|
5415
6043
|
this.userSelection.add(connection);
|
|
5416
6044
|
}
|
|
6045
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(this.userSelection.all(), true));
|
|
5417
6046
|
}
|
|
5418
6047
|
if (event.ctrlKey && event.key === 'i') {
|
|
5419
6048
|
event.preventDefault();
|
|
5420
6049
|
// invert selection
|
|
6050
|
+
const selectedElements = [];
|
|
6051
|
+
const deselectedElements = [];
|
|
5421
6052
|
for (const node of this.model.nodes) {
|
|
5422
6053
|
this.userSelection.toggle(node);
|
|
6054
|
+
if (node.selected) {
|
|
6055
|
+
selectedElements.push(node);
|
|
6056
|
+
} else {
|
|
6057
|
+
deselectedElements.push(node);
|
|
6058
|
+
}
|
|
5423
6059
|
}
|
|
5424
6060
|
for (const connection of this.model.connections) {
|
|
5425
6061
|
this.userSelection.toggle(connection);
|
|
6062
|
+
if (connection.selected) {
|
|
6063
|
+
selectedElements.push(connection);
|
|
6064
|
+
} else {
|
|
6065
|
+
deselectedElements.push(connection);
|
|
6066
|
+
}
|
|
6067
|
+
}
|
|
6068
|
+
if (selectedElements.length > 0) {
|
|
6069
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(selectedElements, true));
|
|
6070
|
+
}
|
|
6071
|
+
if (deselectedElements.length > 0) {
|
|
6072
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
5426
6073
|
}
|
|
5427
6074
|
}
|
|
5428
6075
|
if (event.ctrlKey && event.key === 'c') {
|
|
@@ -5467,12 +6114,12 @@ class DiagramCanvas {
|
|
|
5467
6114
|
if (event.key === Keys.ArrowLeft) {
|
|
5468
6115
|
event.preventDefault();
|
|
5469
6116
|
// move left, faster if we're zoomed out and slower if we're zoomed in
|
|
5470
|
-
this.translateBy(
|
|
6117
|
+
this.translateBy(this.panRate / this.zoomTransform.k, 0);
|
|
5471
6118
|
}
|
|
5472
6119
|
if (event.key === Keys.ArrowRight) {
|
|
5473
6120
|
event.preventDefault();
|
|
5474
6121
|
// move right, faster if we're zoomed out and slower if we're zoomed in
|
|
5475
|
-
this.translateBy(this.panRate / this.zoomTransform.k, 0);
|
|
6122
|
+
this.translateBy(-this.panRate / this.zoomTransform.k, 0);
|
|
5476
6123
|
}
|
|
5477
6124
|
if (event.key === Keys.ArrowDown) {
|
|
5478
6125
|
event.preventDefault();
|
|
@@ -5492,12 +6139,22 @@ class DiagramCanvas {
|
|
|
5492
6139
|
this.unfinishedConnection.endCoords = pointerCoords;
|
|
5493
6140
|
}
|
|
5494
6141
|
}).on(Events.MouseOver, () => {
|
|
5495
|
-
this.userHighlight.
|
|
6142
|
+
if (this.userHighlight.size() > 0) {
|
|
6143
|
+
this.userHighlight.clear();
|
|
6144
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(null));
|
|
6145
|
+
}
|
|
5496
6146
|
}).on(Events.Click, () => {
|
|
5497
|
-
this.userHighlight.
|
|
6147
|
+
if (this.userHighlight.size() > 0) {
|
|
6148
|
+
this.userHighlight.clear();
|
|
6149
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(null));
|
|
6150
|
+
}
|
|
5498
6151
|
this.contextMenu.close();
|
|
5499
|
-
this.userSelection.
|
|
5500
|
-
|
|
6152
|
+
if (this.userSelection.size() > 0) {
|
|
6153
|
+
const deselectedElements = this.userSelection.all();
|
|
6154
|
+
this.userSelection.clear();
|
|
6155
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
6156
|
+
this.userSelection.openInPropertyEditor(this.model);
|
|
6157
|
+
}
|
|
5501
6158
|
}).call(d3.drag().filter(event => {
|
|
5502
6159
|
return this.multipleSelectionOn || isSecondaryButton(event);
|
|
5503
6160
|
}).on(DragEvents.Start, event => {
|
|
@@ -5539,15 +6196,7 @@ class DiagramCanvas {
|
|
|
5539
6196
|
canvasBackgroundPattern.append('circle').attr('cx', this.gridSize / 2).attr('cy', this.gridSize / 2).attr('r', this.gridSize * this.gridThickness).attr('fill', this.gridColor);
|
|
5540
6197
|
canvasBackground.attr('fill', `url(#${this.backgroundPatternId})`);
|
|
5541
6198
|
}
|
|
5542
|
-
|
|
5543
|
-
canvasElements.append('g').attr('class', 'daga-canvas-nodes');
|
|
5544
|
-
canvasElements.append('g').attr('class', 'daga-canvas-sections');
|
|
5545
|
-
canvasElements.append('g').attr('class', 'daga-canvas-ports');
|
|
5546
|
-
canvasElements.append('g').attr('class', 'daga-canvas-connections');
|
|
5547
|
-
canvasElements.append('g').attr('class', 'daga-canvas-fields');
|
|
5548
|
-
canvasElements.append('g').attr('class', 'daga-canvas-objects');
|
|
5549
|
-
canvasElements.append('g').attr('class', 'daga-canvas-decorators');
|
|
5550
|
-
this.viewInitialized$.next();
|
|
6199
|
+
canvasView.append('g').attr('class', 'daga-canvas-elements');
|
|
5551
6200
|
}
|
|
5552
6201
|
zoomBy(factor) {
|
|
5553
6202
|
if (!isNaN(factor)) {
|
|
@@ -5604,8 +6253,8 @@ class DiagramCanvas {
|
|
|
5604
6253
|
}
|
|
5605
6254
|
getCoordinatesOnScreen() {
|
|
5606
6255
|
var _a;
|
|
5607
|
-
const rootBoundingClientRect = (_a = this.selectRoot().node()) === null || _a ===
|
|
5608
|
-
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect ===
|
|
6256
|
+
const rootBoundingClientRect = (_a = this.selectRoot().node()) === null || _a === undefined ? undefined : _a.getBoundingClientRect();
|
|
6257
|
+
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === undefined ? undefined : rootBoundingClientRect.height) || 0];
|
|
5609
6258
|
return [[-this.zoomTransform.x / this.zoomTransform.k, -this.zoomTransform.y / this.zoomTransform.k], [(rootDimensions[0] - this.zoomTransform.x) / this.zoomTransform.k, (rootDimensions[1] - this.zoomTransform.y) / this.zoomTransform.k]];
|
|
5610
6259
|
}
|
|
5611
6260
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -5647,7 +6296,7 @@ class DiagramCanvas {
|
|
|
5647
6296
|
this.updateDecoratorsInView();
|
|
5648
6297
|
}
|
|
5649
6298
|
updateNodesInView(...ids) {
|
|
5650
|
-
let updateSelection = this.
|
|
6299
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-node').data(this.model.nodes.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
5651
6300
|
const exitSelection = updateSelection.exit();
|
|
5652
6301
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-node${d.type.resizableX ? ' resizable-x' : ''}${d.type.resizableY ? ' resizable-y' : ''} ${d.type.look.lookType}`);
|
|
5653
6302
|
if (ids && ids.length > 0) {
|
|
@@ -5658,12 +6307,16 @@ class DiagramCanvas {
|
|
|
5658
6307
|
enterSelection.on(Events.MouseOver, (_event, d) => {
|
|
5659
6308
|
if (!this.dragging) {
|
|
5660
6309
|
this.userHighlight.focusOn(d);
|
|
6310
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
5661
6311
|
}
|
|
5662
6312
|
}).on(Events.Click, (event, d) => {
|
|
5663
6313
|
if (!event.ctrlKey && !event.shiftKey) {
|
|
6314
|
+
const deselectedElements = this.userSelection.all();
|
|
5664
6315
|
this.userSelection.clear();
|
|
6316
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
5665
6317
|
}
|
|
5666
6318
|
this.userSelection.toggle(d);
|
|
6319
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([d], d.selected));
|
|
5667
6320
|
}).on(Events.ContextMenu, (event, d) => {
|
|
5668
6321
|
if (this.dragging) {
|
|
5669
6322
|
event.preventDefault();
|
|
@@ -5671,16 +6324,18 @@ class DiagramCanvas {
|
|
|
5671
6324
|
this.dragging = false;
|
|
5672
6325
|
return;
|
|
5673
6326
|
}
|
|
5674
|
-
const diagramEvent = new
|
|
6327
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
5675
6328
|
this.diagramEvent$.next(diagramEvent);
|
|
5676
6329
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
5677
6330
|
event.preventDefault();
|
|
5678
6331
|
this.userHighlight.focusOn(d);
|
|
6332
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
5679
6333
|
this.userSelection.add(d);
|
|
6334
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([d], true));
|
|
5680
6335
|
this.contextMenu.open(event);
|
|
5681
6336
|
}
|
|
5682
6337
|
}).on(Events.DoubleClick, (event, d) => {
|
|
5683
|
-
const diagramEvent = new
|
|
6338
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
5684
6339
|
this.diagramEvent$.next(diagramEvent);
|
|
5685
6340
|
}).call(d3.drag().filter(event => {
|
|
5686
6341
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -5870,11 +6525,11 @@ class DiagramCanvas {
|
|
|
5870
6525
|
mergeSelection.filter('.resizable-y').select('line.bottom-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', d => d.height - RESIZER_THICKNESS / 2).attr('y2', d => d.height - RESIZER_THICKNESS / 2);
|
|
5871
6526
|
}
|
|
5872
6527
|
updateSectionsInView(...ids) {
|
|
5873
|
-
let updateSelection = this.
|
|
6528
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-section').data(this.model.sections.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
5874
6529
|
const exitSelection = updateSelection.exit();
|
|
5875
6530
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
|
|
5876
6531
|
var _a, _b, _c, _d, _e, _f;
|
|
5877
|
-
return `diagram-section${((_b = (_a = d.node) === null || _a ===
|
|
6532
|
+
return `diagram-section${((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) ? ' resizable-x' : ''}${((_d = (_c = d.node) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.resizableY) ? ' resizable-y' : ''} ${(_f = (_e = d.getConfig()) === null || _e === undefined ? undefined : _e.look) === null || _f === undefined ? undefined : _f.lookType}`;
|
|
5878
6533
|
});
|
|
5879
6534
|
if (ids && ids.length > 0) {
|
|
5880
6535
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
@@ -5884,12 +6539,17 @@ class DiagramCanvas {
|
|
|
5884
6539
|
enterSelection.on(Events.MouseOver, (_event, d) => {
|
|
5885
6540
|
if (!this.dragging) {
|
|
5886
6541
|
this.userHighlight.focusOn(d);
|
|
6542
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
5887
6543
|
}
|
|
5888
6544
|
}).on(Events.Click, (event, d) => {
|
|
5889
6545
|
if (!event.ctrlKey && !event.shiftKey) {
|
|
6546
|
+
const deselectedElements = this.userSelection.all();
|
|
5890
6547
|
this.userSelection.clear();
|
|
6548
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
5891
6549
|
}
|
|
5892
|
-
|
|
6550
|
+
const elementToBeToggled = getRelatedNodeOrItself(d);
|
|
6551
|
+
this.userSelection.toggle(elementToBeToggled);
|
|
6552
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
5893
6553
|
}).on(Events.ContextMenu, (event, d) => {
|
|
5894
6554
|
if (this.dragging) {
|
|
5895
6555
|
event.preventDefault();
|
|
@@ -5897,17 +6557,19 @@ class DiagramCanvas {
|
|
|
5897
6557
|
this.dragging = false;
|
|
5898
6558
|
return;
|
|
5899
6559
|
}
|
|
5900
|
-
const diagramEvent = new
|
|
6560
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
5901
6561
|
this.diagramEvent$.next(diagramEvent);
|
|
5902
6562
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
5903
6563
|
event.preventDefault();
|
|
5904
6564
|
const elementToSelect = getRelatedNodeOrItself(d);
|
|
5905
6565
|
this.userHighlight.focusOn(elementToSelect);
|
|
6566
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(elementToSelect));
|
|
5906
6567
|
this.userSelection.add(elementToSelect);
|
|
6568
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToSelect], true));
|
|
5907
6569
|
this.contextMenu.open(event);
|
|
5908
6570
|
}
|
|
5909
6571
|
}).on(Events.DoubleClick, (event, d) => {
|
|
5910
|
-
const diagramEvent = new
|
|
6572
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
5911
6573
|
this.diagramEvent$.next(diagramEvent);
|
|
5912
6574
|
}).call(d3.drag().filter(event => {
|
|
5913
6575
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -5916,7 +6578,7 @@ class DiagramCanvas {
|
|
|
5916
6578
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
5917
6579
|
this.startMultipleSelection(event);
|
|
5918
6580
|
} else {
|
|
5919
|
-
const node = d === null || d ===
|
|
6581
|
+
const node = d === null || d === undefined ? undefined : d.node;
|
|
5920
6582
|
if (node) {
|
|
5921
6583
|
this.startMovingNode(event, node);
|
|
5922
6584
|
} else {
|
|
@@ -5927,7 +6589,7 @@ class DiagramCanvas {
|
|
|
5927
6589
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
5928
6590
|
this.continueMultipleSelection(event);
|
|
5929
6591
|
} else {
|
|
5930
|
-
const node = d === null || d ===
|
|
6592
|
+
const node = d === null || d === undefined ? undefined : d.node;
|
|
5931
6593
|
if (node) {
|
|
5932
6594
|
this.continueMovingNode(event, node);
|
|
5933
6595
|
} else {
|
|
@@ -5938,7 +6600,7 @@ class DiagramCanvas {
|
|
|
5938
6600
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
5939
6601
|
this.finishMultipleSelection(event);
|
|
5940
6602
|
} else {
|
|
5941
|
-
const node = d === null || d ===
|
|
6603
|
+
const node = d === null || d === undefined ? undefined : d.node;
|
|
5942
6604
|
if (node) {
|
|
5943
6605
|
this.finishMovingNode(event, node);
|
|
5944
6606
|
} else {
|
|
@@ -5960,17 +6622,17 @@ class DiagramCanvas {
|
|
|
5960
6622
|
enterSelection.filter('.stretchable-image-look').append('image').attr('class', 'bottom-right-image').attr('preserveAspectRatio', 'none');
|
|
5961
6623
|
enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
|
|
5962
6624
|
var _a, _b;
|
|
5963
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6625
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
5964
6626
|
setCursorStyle(CursorStyle.EWResize);
|
|
5965
6627
|
}
|
|
5966
6628
|
}).on(Events.MouseOut, (_event, d) => {
|
|
5967
6629
|
var _a, _b;
|
|
5968
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6630
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
5969
6631
|
setCursorStyle();
|
|
5970
6632
|
}
|
|
5971
6633
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
5972
6634
|
var _a, _b;
|
|
5973
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6635
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
5974
6636
|
setCursorStyle(CursorStyle.EWResize);
|
|
5975
6637
|
this.currentAction = new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
5976
6638
|
} else {
|
|
@@ -5978,13 +6640,13 @@ class DiagramCanvas {
|
|
|
5978
6640
|
}
|
|
5979
6641
|
}).on(DragEvents.Drag, (event, d) => {
|
|
5980
6642
|
var _a, _b;
|
|
5981
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6643
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
5982
6644
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
5983
6645
|
d.node.stretchSections(Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
5984
6646
|
}
|
|
5985
6647
|
}).on(DragEvents.End, (event, d) => {
|
|
5986
6648
|
var _a, _b;
|
|
5987
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6649
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
|
|
5988
6650
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
5989
6651
|
if (this.snapToGrid) {
|
|
5990
6652
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -5999,17 +6661,17 @@ class DiagramCanvas {
|
|
|
5999
6661
|
}));
|
|
6000
6662
|
enterSelection.filter('.resizable-y').append('line').attr('class', 'top-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
|
|
6001
6663
|
var _a, _b;
|
|
6002
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6664
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6003
6665
|
setCursorStyle(CursorStyle.NSResize);
|
|
6004
6666
|
}
|
|
6005
6667
|
}).on(Events.MouseOut, (_event, d) => {
|
|
6006
6668
|
var _a, _b;
|
|
6007
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6669
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6008
6670
|
setCursorStyle();
|
|
6009
6671
|
}
|
|
6010
6672
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
6011
6673
|
var _a, _b;
|
|
6012
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6674
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6013
6675
|
setCursorStyle(CursorStyle.NSResize);
|
|
6014
6676
|
this.currentAction = new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
6015
6677
|
} else {
|
|
@@ -6017,13 +6679,13 @@ class DiagramCanvas {
|
|
|
6017
6679
|
}
|
|
6018
6680
|
}).on(DragEvents.Drag, (event, d) => {
|
|
6019
6681
|
var _a, _b;
|
|
6020
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6682
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6021
6683
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6022
6684
|
d.node.stretchSections(Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
6023
6685
|
}
|
|
6024
6686
|
}).on(DragEvents.End, (event, d) => {
|
|
6025
6687
|
var _a, _b;
|
|
6026
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6688
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
|
|
6027
6689
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6028
6690
|
if (this.snapToGrid) {
|
|
6029
6691
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -6038,17 +6700,17 @@ class DiagramCanvas {
|
|
|
6038
6700
|
}));
|
|
6039
6701
|
enterSelection.filter('.resizable-x').append('line').attr('class', 'right-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
|
|
6040
6702
|
var _a, _b;
|
|
6041
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6703
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
6042
6704
|
setCursorStyle(CursorStyle.EWResize);
|
|
6043
6705
|
}
|
|
6044
6706
|
}).on(Events.MouseOut, (_event, d) => {
|
|
6045
6707
|
var _a, _b;
|
|
6046
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6708
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
6047
6709
|
setCursorStyle();
|
|
6048
6710
|
}
|
|
6049
6711
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
6050
6712
|
var _a, _b;
|
|
6051
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6713
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
6052
6714
|
setCursorStyle(CursorStyle.EWResize);
|
|
6053
6715
|
this.currentAction = new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
6054
6716
|
} else {
|
|
@@ -6056,13 +6718,13 @@ class DiagramCanvas {
|
|
|
6056
6718
|
}
|
|
6057
6719
|
}).on(DragEvents.Drag, (event, d) => {
|
|
6058
6720
|
var _a, _b;
|
|
6059
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6721
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed) {
|
|
6060
6722
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6061
6723
|
d.node.stretchSections(Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
6062
6724
|
}
|
|
6063
6725
|
}).on(DragEvents.End, (event, d) => {
|
|
6064
6726
|
var _a, _b;
|
|
6065
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6727
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableX) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
|
|
6066
6728
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6067
6729
|
if (this.snapToGrid) {
|
|
6068
6730
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -6077,17 +6739,17 @@ class DiagramCanvas {
|
|
|
6077
6739
|
}));
|
|
6078
6740
|
enterSelection.filter('.resizable-y').append('line').attr('class', 'bottom-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
|
|
6079
6741
|
var _a, _b;
|
|
6080
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6742
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6081
6743
|
setCursorStyle(CursorStyle.NSResize);
|
|
6082
6744
|
}
|
|
6083
6745
|
}).on(Events.MouseOut, (_event, d) => {
|
|
6084
6746
|
var _a, _b;
|
|
6085
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6747
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6086
6748
|
setCursorStyle();
|
|
6087
6749
|
}
|
|
6088
6750
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
6089
6751
|
var _a, _b;
|
|
6090
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6752
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6091
6753
|
setCursorStyle(CursorStyle.NSResize);
|
|
6092
6754
|
this.currentAction = new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
|
|
6093
6755
|
} else {
|
|
@@ -6095,13 +6757,13 @@ class DiagramCanvas {
|
|
|
6095
6757
|
}
|
|
6096
6758
|
}).on(DragEvents.Drag, (event, d) => {
|
|
6097
6759
|
var _a, _b;
|
|
6098
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6760
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed) {
|
|
6099
6761
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6100
6762
|
d.node.stretchSections(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
6101
6763
|
}
|
|
6102
6764
|
}).on(DragEvents.End, (event, d) => {
|
|
6103
6765
|
var _a, _b;
|
|
6104
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a ===
|
|
6766
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && ((_b = (_a = d.node) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.resizableY) && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchSection) {
|
|
6105
6767
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
6106
6768
|
if (this.snapToGrid) {
|
|
6107
6769
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
@@ -6117,143 +6779,143 @@ class DiagramCanvas {
|
|
|
6117
6779
|
mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
|
|
6118
6780
|
mergeSelection.filter('.shaped-look').select('path').attr('d', d => {
|
|
6119
6781
|
var _a;
|
|
6120
|
-
return generalClosedPath(((_a = d.getConfig()) === null || _a ===
|
|
6782
|
+
return generalClosedPath(((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).shape, 0, 0, d.width, d.height);
|
|
6121
6783
|
}).attr('fill', d => {
|
|
6122
6784
|
var _a, _b;
|
|
6123
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6785
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedFillColor : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).fillColor;
|
|
6124
6786
|
}).attr('stroke', d => {
|
|
6125
6787
|
var _a, _b;
|
|
6126
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6788
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBorderColor : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).borderColor;
|
|
6127
6789
|
}).attr('stroke-width', d => `${d.highlighted ? 3 : 1}px`);
|
|
6128
6790
|
mergeSelection.filter('.image-look').select('image').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('href', d => {
|
|
6129
6791
|
var _a, _b;
|
|
6130
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6792
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImage : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImage;
|
|
6131
6793
|
});
|
|
6132
6794
|
mergeSelection.filter('.stretchable-image-look').select('image.top-left-image').attr('x', 0).attr('y', 0).attr('width', d => {
|
|
6133
6795
|
var _a;
|
|
6134
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6796
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6135
6797
|
}).attr('height', d => {
|
|
6136
6798
|
var _a;
|
|
6137
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6799
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6138
6800
|
}).attr('href', d => {
|
|
6139
6801
|
var _a, _b;
|
|
6140
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6802
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageTopLeft : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageTopLeft;
|
|
6141
6803
|
});
|
|
6142
6804
|
mergeSelection.filter('.stretchable-image-look').select('image.top-image').attr('x', d => {
|
|
6143
6805
|
var _a;
|
|
6144
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6806
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6145
6807
|
}).attr('y', 0).attr('width', d => {
|
|
6146
6808
|
var _a, _b;
|
|
6147
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6809
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).leftMargin;
|
|
6148
6810
|
}).attr('height', d => {
|
|
6149
6811
|
var _a;
|
|
6150
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6812
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6151
6813
|
}).attr('href', d => {
|
|
6152
6814
|
var _a, _b;
|
|
6153
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6815
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageTop : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageTop;
|
|
6154
6816
|
});
|
|
6155
6817
|
mergeSelection.filter('.stretchable-image-look').select('image.top-right-image').attr('x', d => {
|
|
6156
6818
|
var _a;
|
|
6157
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6819
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6158
6820
|
}).attr('y', 0).attr('width', d => {
|
|
6159
6821
|
var _a;
|
|
6160
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6822
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6161
6823
|
}).attr('height', d => {
|
|
6162
6824
|
var _a;
|
|
6163
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6825
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6164
6826
|
}).attr('href', d => {
|
|
6165
6827
|
var _a, _b;
|
|
6166
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6828
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageTopRight : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageTopRight;
|
|
6167
6829
|
});
|
|
6168
6830
|
mergeSelection.filter('.stretchable-image-look').select('image.left-image').attr('x', 0).attr('y', d => {
|
|
6169
6831
|
var _a;
|
|
6170
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6832
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6171
6833
|
}).attr('width', d => {
|
|
6172
6834
|
var _a;
|
|
6173
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6835
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6174
6836
|
}).attr('height', d => {
|
|
6175
6837
|
var _a, _b;
|
|
6176
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6838
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).topMargin;
|
|
6177
6839
|
}).attr('href', d => {
|
|
6178
6840
|
var _a, _b;
|
|
6179
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6841
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageLeft : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageLeft;
|
|
6180
6842
|
});
|
|
6181
6843
|
mergeSelection.filter('.stretchable-image-look').select('image.center-image').attr('x', d => {
|
|
6182
6844
|
var _a;
|
|
6183
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6845
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6184
6846
|
}).attr('y', d => {
|
|
6185
6847
|
var _a;
|
|
6186
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6848
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6187
6849
|
}).attr('width', d => {
|
|
6188
6850
|
var _a, _b;
|
|
6189
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6851
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).leftMargin;
|
|
6190
6852
|
}).attr('height', d => {
|
|
6191
6853
|
var _a, _b;
|
|
6192
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6854
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).topMargin;
|
|
6193
6855
|
}).attr('href', d => {
|
|
6194
6856
|
var _a, _b;
|
|
6195
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6857
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageCenter : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageCenter;
|
|
6196
6858
|
});
|
|
6197
6859
|
mergeSelection.filter('.stretchable-image-look').select('image.right-image').attr('x', d => {
|
|
6198
6860
|
var _a;
|
|
6199
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6861
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6200
6862
|
}).attr('y', d => {
|
|
6201
6863
|
var _a;
|
|
6202
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6864
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).topMargin;
|
|
6203
6865
|
}).attr('width', d => {
|
|
6204
6866
|
var _a;
|
|
6205
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6867
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6206
6868
|
}).attr('height', d => {
|
|
6207
6869
|
var _a, _b;
|
|
6208
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6870
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).topMargin;
|
|
6209
6871
|
}).attr('href', d => {
|
|
6210
6872
|
var _a, _b;
|
|
6211
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6873
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageRight : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageRight;
|
|
6212
6874
|
});
|
|
6213
6875
|
mergeSelection.filter('.stretchable-image-look').select('image.bottom-left-image').attr('x', 0).attr('y', d => {
|
|
6214
6876
|
var _a;
|
|
6215
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6877
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6216
6878
|
}).attr('width', d => {
|
|
6217
6879
|
var _a;
|
|
6218
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6880
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6219
6881
|
}).attr('height', d => {
|
|
6220
6882
|
var _a;
|
|
6221
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6883
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6222
6884
|
}).attr('href', d => {
|
|
6223
6885
|
var _a, _b;
|
|
6224
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6886
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageBottomLeft : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageBottomLeft;
|
|
6225
6887
|
});
|
|
6226
6888
|
mergeSelection.filter('.stretchable-image-look').select('image.bottom-image').attr('x', d => {
|
|
6227
6889
|
var _a;
|
|
6228
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6890
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).leftMargin;
|
|
6229
6891
|
}).attr('y', d => {
|
|
6230
6892
|
var _a;
|
|
6231
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6893
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6232
6894
|
}).attr('width', d => {
|
|
6233
6895
|
var _a, _b;
|
|
6234
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6896
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin - ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).leftMargin;
|
|
6235
6897
|
}).attr('height', d => {
|
|
6236
6898
|
var _a;
|
|
6237
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6899
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6238
6900
|
}).attr('href', d => {
|
|
6239
6901
|
var _a, _b;
|
|
6240
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6902
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageBottom : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageBottom;
|
|
6241
6903
|
});
|
|
6242
6904
|
mergeSelection.filter('.stretchable-image-look').select('image.bottom-right-image').attr('x', d => {
|
|
6243
6905
|
var _a;
|
|
6244
|
-
return d.width - ((_a = d.getConfig()) === null || _a ===
|
|
6906
|
+
return d.width - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6245
6907
|
}).attr('y', d => {
|
|
6246
6908
|
var _a;
|
|
6247
|
-
return d.height - ((_a = d.getConfig()) === null || _a ===
|
|
6909
|
+
return d.height - ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6248
6910
|
}).attr('width', d => {
|
|
6249
6911
|
var _a;
|
|
6250
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6912
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).rightMargin;
|
|
6251
6913
|
}).attr('height', d => {
|
|
6252
6914
|
var _a;
|
|
6253
|
-
return ((_a = d.getConfig()) === null || _a ===
|
|
6915
|
+
return ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).bottomMargin;
|
|
6254
6916
|
}).attr('href', d => {
|
|
6255
6917
|
var _a, _b;
|
|
6256
|
-
return d.selected ? ((_a = d.getConfig()) === null || _a ===
|
|
6918
|
+
return d.selected ? ((_a = d.getConfig()) === null || _a === undefined ? undefined : _a.look).selectedBackgroundImageBottomRight : ((_b = d.getConfig()) === null || _b === undefined ? undefined : _b.look).backgroundImageBottomRight;
|
|
6257
6919
|
});
|
|
6258
6920
|
mergeSelection.filter('.resizable-x').select('line.left-resizer').attr('x1', RESIZER_THICKNESS / 2).attr('x2', RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
|
|
6259
6921
|
mergeSelection.filter('.resizable-y').select('line.top-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', RESIZER_THICKNESS / 2).attr('y2', RESIZER_THICKNESS / 2);
|
|
@@ -6261,7 +6923,7 @@ class DiagramCanvas {
|
|
|
6261
6923
|
mergeSelection.filter('.resizable-y').select('line.bottom-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', d => d.height - RESIZER_THICKNESS / 2).attr('y2', d => d.height - RESIZER_THICKNESS / 2);
|
|
6262
6924
|
}
|
|
6263
6925
|
updatePortsInView(...ids) {
|
|
6264
|
-
let updateSelection = this.
|
|
6926
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-port').data(this.model.ports.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
6265
6927
|
const exitSelection = updateSelection.exit();
|
|
6266
6928
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-port');
|
|
6267
6929
|
if (ids && ids.length > 0) {
|
|
@@ -6274,9 +6936,10 @@ class DiagramCanvas {
|
|
|
6274
6936
|
if (!this.unfinishedConnection && !this.dragging) {
|
|
6275
6937
|
// if there is an unfinished connection, the port will be highlighted automatically if the pointer is close
|
|
6276
6938
|
this.userHighlight.focusOn(d);
|
|
6939
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
6277
6940
|
}
|
|
6278
6941
|
if (this.unfinishedConnection) {
|
|
6279
|
-
const canConnectionFinishAtThisPort = this.unfinishedConnection.type.canStartFromType(((_c = (_b = (_a = this.unfinishedConnection.start) === null || _a ===
|
|
6942
|
+
const canConnectionFinishAtThisPort = this.unfinishedConnection.type.canStartFromType(((_c = (_b = (_a = this.unfinishedConnection.start) === null || _a === undefined ? undefined : _a.getNode()) === null || _b === undefined ? undefined : _b.type) === null || _c === undefined ? undefined : _c.id) || '') && this.unfinishedConnection.type.canFinishOnType(((_e = (_d = d.getNode()) === null || _d === undefined ? undefined : _d.type) === null || _e === undefined ? undefined : _e.id) || '') || this.unfinishedConnection.type.canStartFromType(((_g = (_f = d.getNode()) === null || _f === undefined ? undefined : _f.type) === null || _g === undefined ? undefined : _g.id) || '') && this.unfinishedConnection.type.canFinishOnType(((_k = (_j = (_h = this.unfinishedConnection.start) === null || _h === undefined ? undefined : _h.getNode()) === null || _j === undefined ? undefined : _j.type) === null || _k === undefined ? undefined : _k.id) || '');
|
|
6280
6943
|
if (!canConnectionFinishAtThisPort) {
|
|
6281
6944
|
setCursorStyle(CursorStyle.NoDrop);
|
|
6282
6945
|
}
|
|
@@ -6287,9 +6950,13 @@ class DiagramCanvas {
|
|
|
6287
6950
|
}
|
|
6288
6951
|
}).on(Events.Click, (event, d) => {
|
|
6289
6952
|
if (!event.ctrlKey && !event.shiftKey) {
|
|
6953
|
+
const deselectedElements = this.userSelection.all();
|
|
6290
6954
|
this.userSelection.clear();
|
|
6955
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
6291
6956
|
}
|
|
6292
|
-
|
|
6957
|
+
const elementToBeToggled = getRelatedNodeOrItself(d);
|
|
6958
|
+
this.userSelection.toggle(elementToBeToggled);
|
|
6959
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
6293
6960
|
}).on(Events.ContextMenu, (event, d) => {
|
|
6294
6961
|
if (this.dragging) {
|
|
6295
6962
|
event.preventDefault();
|
|
@@ -6297,17 +6964,19 @@ class DiagramCanvas {
|
|
|
6297
6964
|
this.dragging = false;
|
|
6298
6965
|
return;
|
|
6299
6966
|
}
|
|
6300
|
-
const diagramEvent = new
|
|
6967
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
6301
6968
|
this.diagramEvent$.next(diagramEvent);
|
|
6302
6969
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
6303
6970
|
event.preventDefault();
|
|
6304
6971
|
const elementToSelect = getRelatedNodeOrItself(d);
|
|
6305
6972
|
this.userHighlight.focusOn(elementToSelect);
|
|
6973
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(elementToSelect));
|
|
6306
6974
|
this.userSelection.add(elementToSelect);
|
|
6975
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToSelect], true));
|
|
6307
6976
|
this.contextMenu.open(event);
|
|
6308
6977
|
}
|
|
6309
6978
|
}).on(Events.DoubleClick, (event, d) => {
|
|
6310
|
-
const diagramEvent = new
|
|
6979
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
6311
6980
|
this.diagramEvent$.next(diagramEvent);
|
|
6312
6981
|
}).call(d3.drag().filter(event => {
|
|
6313
6982
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -6335,8 +7004,8 @@ class DiagramCanvas {
|
|
|
6335
7004
|
if (this.canUserPerformAction(DiagramActions.AddConnection) && !d.removed) {
|
|
6336
7005
|
if (this.unfinishedConnection !== undefined) {
|
|
6337
7006
|
const endCoords = [event.x, event.y];
|
|
6338
|
-
(_a = this.unfinishedConnectionTracer) === null || _a ===
|
|
6339
|
-
const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d ===
|
|
7007
|
+
(_a = this.unfinishedConnectionTracer) === null || _a === undefined ? undefined : _a.attr('d', getConnectionPath(this.unfinishedConnection.type.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.type.width, (_b = this.unfinishedConnection.startMarkerLook) === null || _b === undefined ? undefined : _b.markerWidth, (_c = this.unfinishedConnection.endMarkerLook) === null || _c === undefined ? undefined : _c.markerWidth));
|
|
7008
|
+
const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === undefined ? undefined : _d.node();
|
|
6340
7009
|
if (unfinishedConnectionGhostNode) {
|
|
6341
7010
|
let margin = 2;
|
|
6342
7011
|
const unfinishedConnectionTotalLength = unfinishedConnectionGhostNode.getTotalLength();
|
|
@@ -6377,7 +7046,7 @@ class DiagramCanvas {
|
|
|
6377
7046
|
this.finishMultipleSelection(event);
|
|
6378
7047
|
} else {
|
|
6379
7048
|
if (this.canUserPerformAction(DiagramActions.AddConnection) && !d.removed) {
|
|
6380
|
-
(_a = this.unfinishedConnectionTracer) === null || _a ===
|
|
7049
|
+
(_a = this.unfinishedConnectionTracer) === null || _a === undefined ? undefined : _a.remove();
|
|
6381
7050
|
const userHighlight = this.userHighlight.getFocus();
|
|
6382
7051
|
if (userHighlight instanceof DiagramPort) {
|
|
6383
7052
|
this.finishConnection(userHighlight);
|
|
@@ -6415,7 +7084,7 @@ class DiagramCanvas {
|
|
|
6415
7084
|
if (this.unfinishedConnection) {
|
|
6416
7085
|
connectionList.push(this.unfinishedConnection);
|
|
6417
7086
|
}
|
|
6418
|
-
let updateSelection = this.
|
|
7087
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-connection').data(connectionList, d => d.id);
|
|
6419
7088
|
const exitSelection = updateSelection.exit();
|
|
6420
7089
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-connection');
|
|
6421
7090
|
if (ids && ids.length > 0) {
|
|
@@ -6426,12 +7095,16 @@ class DiagramCanvas {
|
|
|
6426
7095
|
enterSelection.on(Events.MouseOver, (_event, d) => {
|
|
6427
7096
|
if (d.end !== undefined && !this.dragging) {
|
|
6428
7097
|
this.userHighlight.focusOn(d);
|
|
7098
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
6429
7099
|
}
|
|
6430
7100
|
}).on(Events.Click, (event, d) => {
|
|
6431
7101
|
if (!event.ctrlKey && !event.shiftKey) {
|
|
7102
|
+
const deselectedElements = this.userSelection.all();
|
|
6432
7103
|
this.userSelection.clear();
|
|
7104
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
6433
7105
|
}
|
|
6434
7106
|
this.userSelection.toggle(d);
|
|
7107
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([d], d.selected));
|
|
6435
7108
|
}).on(Events.ContextMenu, (event, d) => {
|
|
6436
7109
|
if (this.dragging) {
|
|
6437
7110
|
event.preventDefault();
|
|
@@ -6439,16 +7112,18 @@ class DiagramCanvas {
|
|
|
6439
7112
|
this.dragging = false;
|
|
6440
7113
|
return;
|
|
6441
7114
|
}
|
|
6442
|
-
const diagramEvent = new
|
|
7115
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
6443
7116
|
this.diagramEvent$.next(diagramEvent);
|
|
6444
7117
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
6445
7118
|
event.preventDefault();
|
|
6446
7119
|
this.userHighlight.focusOn(d);
|
|
7120
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
6447
7121
|
this.userSelection.add(d);
|
|
7122
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([d], true));
|
|
6448
7123
|
this.contextMenu.open(event);
|
|
6449
7124
|
}
|
|
6450
7125
|
}).on(Events.DoubleClick, (event, d) => {
|
|
6451
|
-
const diagramEvent = new
|
|
7126
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
6452
7127
|
this.diagramEvent$.next(diagramEvent);
|
|
6453
7128
|
}).call(d3.drag().filter(event => {
|
|
6454
7129
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -6475,11 +7150,11 @@ class DiagramCanvas {
|
|
|
6475
7150
|
enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
|
|
6476
7151
|
mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
|
|
6477
7152
|
var _a, _b;
|
|
6478
|
-
return getConnectionPath(d.type.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.width, (_a = d.startMarkerLook) === null || _a ===
|
|
7153
|
+
return getConnectionPath(d.type.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.width, (_a = d.startMarkerLook) === null || _a === undefined ? undefined : _a.markerWidth, (_b = d.endMarkerLook) === null || _b === undefined ? undefined : _b.markerWidth);
|
|
6479
7154
|
}).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.selected ? d.type.selectedColor : d.type.color).attr('stroke-width', d => `${d.highlighted ? d.type.width + 1 : d.type.width}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.type.style, d.type.width)).attr('fill', 'none');
|
|
6480
7155
|
mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
|
|
6481
7156
|
var _a, _b;
|
|
6482
|
-
return getConnectionPath(d.type.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.width, (_a = d.startMarkerLook) === null || _a ===
|
|
7157
|
+
return getConnectionPath(d.type.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.width, (_a = d.startMarkerLook) === null || _a === undefined ? undefined : _a.markerWidth, (_b = d.endMarkerLook) === null || _b === undefined ? undefined : _b.markerWidth);
|
|
6483
7158
|
}).attr('stroke', 'transparent')
|
|
6484
7159
|
// allow generating pointer events even when it is transparent
|
|
6485
7160
|
.attr('pointer-events', 'stroke').attr('stroke-width', d => `${d.type.width + CONNECTION_PATH_BOX_THICKNESS}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.type.style, d.type.width)).attr('fill', 'none');
|
|
@@ -6489,7 +7164,7 @@ class DiagramCanvas {
|
|
|
6489
7164
|
});
|
|
6490
7165
|
}
|
|
6491
7166
|
updateFieldsInView(...ids) {
|
|
6492
|
-
let updateSelection = this.
|
|
7167
|
+
let updateSelection = this.selectCanvasElements().selectAll('foreignObject.diagram-field').data(this.model.fields.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
6493
7168
|
const exitSelection = updateSelection.exit();
|
|
6494
7169
|
const enterSelection = updateSelection.enter().append('foreignObject').attr('id', d => d.id).attr('class', 'diagram-field');
|
|
6495
7170
|
if (ids && ids.length > 0) {
|
|
@@ -6500,12 +7175,17 @@ class DiagramCanvas {
|
|
|
6500
7175
|
enterSelection.style('box-sizing', 'border-box').on(Events.MouseOver, (_event, d) => {
|
|
6501
7176
|
if (!this.dragging) {
|
|
6502
7177
|
this.userHighlight.focusOn(d);
|
|
7178
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
6503
7179
|
}
|
|
6504
7180
|
}).on(Events.Click, (event, d) => {
|
|
6505
7181
|
if (!event.ctrlKey && !event.shiftKey) {
|
|
7182
|
+
const deselectedElements = this.userSelection.all();
|
|
6506
7183
|
this.userSelection.clear();
|
|
7184
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(deselectedElements, false));
|
|
6507
7185
|
}
|
|
6508
|
-
|
|
7186
|
+
const elementToBeToggled = getRelatedNodeOrItself(d);
|
|
7187
|
+
this.userSelection.toggle(elementToBeToggled);
|
|
7188
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
6509
7189
|
}).on(Events.ContextMenu, (event, d) => {
|
|
6510
7190
|
if (this.dragging) {
|
|
6511
7191
|
event.preventDefault();
|
|
@@ -6513,17 +7193,19 @@ class DiagramCanvas {
|
|
|
6513
7193
|
this.dragging = false;
|
|
6514
7194
|
return;
|
|
6515
7195
|
}
|
|
6516
|
-
const diagramEvent = new
|
|
7196
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
6517
7197
|
this.diagramEvent$.next(diagramEvent);
|
|
6518
7198
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
6519
7199
|
event.preventDefault();
|
|
6520
7200
|
const elementToSelect = getRelatedNodeOrItself(d);
|
|
6521
7201
|
this.userHighlight.focusOn(elementToSelect);
|
|
7202
|
+
this.diagramEvent$.next(new DiagramHighlightedEvent(elementToSelect));
|
|
6522
7203
|
this.userSelection.add(elementToSelect);
|
|
7204
|
+
this.diagramEvent$.next(new DiagramSelectionEvent([elementToSelect], true));
|
|
6523
7205
|
this.contextMenu.open(event);
|
|
6524
7206
|
}
|
|
6525
7207
|
}).on(Events.DoubleClick, (event, d) => {
|
|
6526
|
-
const diagramEvent = new
|
|
7208
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
6527
7209
|
this.diagramEvent$.next(diagramEvent);
|
|
6528
7210
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.EditField) && d.editable && !d.removed) {
|
|
6529
7211
|
this.currentAction = new EditFieldAction(this, d.id, d.text, '');
|
|
@@ -6595,7 +7277,7 @@ class DiagramCanvas {
|
|
|
6595
7277
|
mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('div').style('justify-content', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === VerticalAlign.Center ? 'center' : d.verticalAlign === VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : '100%').style('max-height', d => d.fit ? 'default' : '100%').style('overflow', d => d.fit ? 'default' : 'hidden').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'end' : 'start').style('font-size', d => `${d.fontSize}px`).style('font-family', d => d.fontFamily || "'Wonder Unit Sans', sans-serif").style('font-weight', d => d.highlighted ? 600 : 400).style('color', d => d.selected ? d.selectedColor || '#000000' : d.color || '#000000').html(d => d.text.replace(/</g, '<').replace(/>/g, '>').replace(/\n/g, '<br/>'));
|
|
6596
7278
|
}
|
|
6597
7279
|
updateObjectsInView(...ids) {
|
|
6598
|
-
let updateSelection = this.
|
|
7280
|
+
let updateSelection = this.selectCanvasElements().selectAll('foreignObject.diagram-object').data(this.model.objects.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
6599
7281
|
const exitSelection = updateSelection.exit();
|
|
6600
7282
|
const enterSelection = updateSelection.enter().append('foreignObject').attr('id', d => d.id).attr('class', 'diagram-object');
|
|
6601
7283
|
if (ids && ids.length > 0) {
|
|
@@ -6604,21 +7286,21 @@ class DiagramCanvas {
|
|
|
6604
7286
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
6605
7287
|
mergeSelection.attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.html);
|
|
6606
7288
|
exitSelection.remove();
|
|
6607
|
-
enterSelection.on(Events.ContextMenu, event => {
|
|
7289
|
+
enterSelection.on(Events.ContextMenu, (event, d) => {
|
|
6608
7290
|
if (this.dragging) {
|
|
6609
7291
|
event.preventDefault();
|
|
6610
7292
|
event.stopPropagation();
|
|
6611
7293
|
this.dragging = false;
|
|
6612
7294
|
return;
|
|
6613
7295
|
}
|
|
6614
|
-
const diagramEvent = new
|
|
7296
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
6615
7297
|
this.diagramEvent$.next(diagramEvent);
|
|
6616
7298
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
6617
7299
|
event.preventDefault();
|
|
6618
7300
|
this.contextMenu.open(event);
|
|
6619
7301
|
}
|
|
6620
7302
|
}).on(Events.DoubleClick, (event, d) => {
|
|
6621
|
-
const diagramEvent = new
|
|
7303
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
6622
7304
|
this.diagramEvent$.next(diagramEvent);
|
|
6623
7305
|
}).call(d3.drag().filter(event => {
|
|
6624
7306
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -6632,7 +7314,7 @@ class DiagramCanvas {
|
|
|
6632
7314
|
}));
|
|
6633
7315
|
}
|
|
6634
7316
|
updateDecoratorsInView(...ids) {
|
|
6635
|
-
let updateSelection = this.
|
|
7317
|
+
let updateSelection = this.selectCanvasElements().selectAll('foreignObject.diagram-decorator').data(this.model.decorators.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
6636
7318
|
const exitSelection = updateSelection.exit();
|
|
6637
7319
|
const enterSelection = updateSelection.enter().append('foreignObject').attr('id', d => d.id).attr('class', 'diagram-decorator');
|
|
6638
7320
|
if (ids && ids.length > 0) {
|
|
@@ -6641,21 +7323,21 @@ class DiagramCanvas {
|
|
|
6641
7323
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
6642
7324
|
mergeSelection.attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.html);
|
|
6643
7325
|
exitSelection.remove();
|
|
6644
|
-
enterSelection.on(Events.ContextMenu, event => {
|
|
7326
|
+
enterSelection.on(Events.ContextMenu, (event, d) => {
|
|
6645
7327
|
if (this.dragging) {
|
|
6646
7328
|
event.preventDefault();
|
|
6647
7329
|
event.stopPropagation();
|
|
6648
7330
|
this.dragging = false;
|
|
6649
7331
|
return;
|
|
6650
7332
|
}
|
|
6651
|
-
const diagramEvent = new
|
|
7333
|
+
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
6652
7334
|
this.diagramEvent$.next(diagramEvent);
|
|
6653
7335
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
6654
7336
|
event.preventDefault();
|
|
6655
7337
|
this.contextMenu.open(event);
|
|
6656
7338
|
}
|
|
6657
7339
|
}).on(Events.DoubleClick, (event, d) => {
|
|
6658
|
-
const diagramEvent = new
|
|
7340
|
+
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
6659
7341
|
this.diagramEvent$.next(diagramEvent);
|
|
6660
7342
|
}).call(d3.drag().filter(event => {
|
|
6661
7343
|
this.secondaryButton = isSecondaryButton(event);
|
|
@@ -6678,33 +7360,33 @@ class DiagramCanvas {
|
|
|
6678
7360
|
const pathLength = pathNode.getTotalLength();
|
|
6679
7361
|
// bind start labels
|
|
6680
7362
|
connectionSelection.select('g.diagram-connection-start-label text').attr('x', 0).attr('y', labelConfiguration.fontSize / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.fontFamily).attr('font-size', labelConfiguration.fontSize).attr('fill', connection.selected ? labelConfiguration.selectedColor : labelConfiguration.color).style('font-kerning', 'none').text(connection.startLabel);
|
|
6681
|
-
const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a ===
|
|
7363
|
+
const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a === undefined ? undefined : _a.getBoundingClientRect();
|
|
6682
7364
|
if (startLabelBoundingRect) {
|
|
6683
7365
|
// don't create space for the label if the label is empty
|
|
6684
|
-
const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding(labelConfiguration) + getRightPadding(labelConfiguration);
|
|
6685
|
-
const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / this.zoomTransform.k + getTopPadding(labelConfiguration) + getBottomPadding(labelConfiguration);
|
|
7366
|
+
const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
7367
|
+
const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
6686
7368
|
const pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
6687
7369
|
connectionSelection.select('g.diagram-connection-start-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.selected ? connection.type.selectedColor : connection.type.color).attr('stroke', 'none');
|
|
6688
7370
|
connectionSelection.select('g.diagram-connection-start-label').attr('transform', `translate(${pathStartLabelPoint.x},${pathStartLabelPoint.y})`);
|
|
6689
7371
|
}
|
|
6690
7372
|
// bind middle labels
|
|
6691
7373
|
connectionSelection.select('g.diagram-connection-middle-label text').attr('x', 0).attr('y', labelConfiguration.fontSize / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.fontFamily).attr('font-size', labelConfiguration.fontSize).attr('fill', connection.selected ? labelConfiguration.selectedColor : labelConfiguration.color).style('font-kerning', 'none').text(connection.middleLabel);
|
|
6692
|
-
const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b ===
|
|
7374
|
+
const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b === undefined ? undefined : _b.getBoundingClientRect();
|
|
6693
7375
|
if (middleLabelBoundingRect) {
|
|
6694
7376
|
// don't create space for the label if the label is empty
|
|
6695
|
-
const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding(labelConfiguration) + getRightPadding(labelConfiguration);
|
|
6696
|
-
const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / this.zoomTransform.k + getTopPadding(labelConfiguration) + getBottomPadding(labelConfiguration);
|
|
7377
|
+
const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
7378
|
+
const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
6697
7379
|
const pathMiddleLabelPoint = pathNode.getPointAtLength(pathLength / 2);
|
|
6698
7380
|
connectionSelection.select('g.diagram-connection-middle-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.selected ? connection.type.selectedColor : connection.type.color).attr('stroke', 'none');
|
|
6699
7381
|
connectionSelection.select('g.diagram-connection-middle-label').attr('transform', `translate(${pathMiddleLabelPoint.x},${pathMiddleLabelPoint.y})`);
|
|
6700
7382
|
}
|
|
6701
7383
|
// bind end labels
|
|
6702
7384
|
connectionSelection.select('g.diagram-connection-end-label text').attr('x', 0).attr('y', labelConfiguration.fontSize / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.fontFamily).attr('font-size', labelConfiguration.fontSize).attr('fill', connection.selected ? labelConfiguration.selectedColor : labelConfiguration.color).style('font-kerning', 'none').text(connection.endLabel);
|
|
6703
|
-
const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c ===
|
|
7385
|
+
const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c === undefined ? undefined : _c.getBoundingClientRect();
|
|
6704
7386
|
if (endLabelBoundingRect) {
|
|
6705
7387
|
// don't create space for the label if the label is empty
|
|
6706
|
-
const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding(labelConfiguration) + getRightPadding(labelConfiguration);
|
|
6707
|
-
const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / this.zoomTransform.k + getTopPadding(labelConfiguration) + getBottomPadding(labelConfiguration);
|
|
7388
|
+
const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
7389
|
+
const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
6708
7390
|
const pathEndLabelPoint = pathNode.getPointAtLength(pathLength - Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
6709
7391
|
connectionSelection.select('g.diagram-connection-end-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', connection.selected ? connection.type.selectedColor : connection.type.color).attr('stroke', 'none');
|
|
6710
7392
|
connectionSelection.select('g.diagram-connection-end-label').attr('transform', `translate(${pathEndLabelPoint.x},${pathEndLabelPoint.y})`);
|
|
@@ -6754,7 +7436,7 @@ class DiagramCanvas {
|
|
|
6754
7436
|
const fieldDimensions = this.minimumSizeOfField(field);
|
|
6755
7437
|
let minimumFieldWidth = fieldDimensions[0];
|
|
6756
7438
|
let minimumFieldHeight = fieldDimensions[1];
|
|
6757
|
-
for (const section of ((_a = field.rootElement.node) === null || _a ===
|
|
7439
|
+
for (const section of ((_a = field.rootElement.node) === null || _a === undefined ? undefined : _a.sections) || []) {
|
|
6758
7440
|
if (section.label) {
|
|
6759
7441
|
if (section.indexXInNode === field.rootElement.indexXInNode && section.indexYInNode !== field.rootElement.indexYInNode) {
|
|
6760
7442
|
minimumFieldWidth = Math.max(minimumFieldWidth, this.minimumSizeOfField(section.label)[0]);
|
|
@@ -6769,8 +7451,8 @@ class DiagramCanvas {
|
|
|
6769
7451
|
if (fieldDimensions[1] < minimumFieldHeight) {
|
|
6770
7452
|
fieldDimensions[1] = minimumFieldHeight;
|
|
6771
7453
|
}
|
|
6772
|
-
let stretchX = fieldDimensions[0] + getLeftMargin((_c = (_b = field.rootElement) === null || _b ===
|
|
6773
|
-
let stretchY = fieldDimensions[1] + getTopMargin((_g = (_f = field.rootElement) === null || _f ===
|
|
7454
|
+
let stretchX = fieldDimensions[0] + getLeftMargin((_c = (_b = field.rootElement) === null || _b === undefined ? undefined : _b.getConfig()) === null || _c === undefined ? undefined : _c.label) + getRightMargin((_e = (_d = field.rootElement) === null || _d === undefined ? undefined : _d.getConfig()) === null || _e === undefined ? undefined : _e.label) - field.rootElement.width;
|
|
7455
|
+
let stretchY = fieldDimensions[1] + getTopMargin((_g = (_f = field.rootElement) === null || _f === undefined ? undefined : _f.getConfig()) === null || _g === undefined ? undefined : _g.label) + getBottomMargin((_j = (_h = field.rootElement) === null || _h === undefined ? undefined : _h.getConfig()) === null || _j === undefined ? undefined : _j.label) - field.rootElement.height;
|
|
6774
7456
|
if (this.snapToGrid) {
|
|
6775
7457
|
stretchX = Math.ceil(stretchX / this.gridSize) * this.gridSize;
|
|
6776
7458
|
stretchY = Math.ceil(stretchY / this.gridSize) * this.gridSize;
|
|
@@ -6782,8 +7464,8 @@ class DiagramCanvas {
|
|
|
6782
7464
|
if (field.rootElement.height + stretchY < (field.rootElement.getMinHeight() || 0)) {
|
|
6783
7465
|
stretchY = (field.rootElement.getMinHeight() || 0) - field.rootElement.height;
|
|
6784
7466
|
}
|
|
6785
|
-
(_k = field.rootElement.node) === null || _k ===
|
|
6786
|
-
(_l = field.rootElement.node) === null || _l ===
|
|
7467
|
+
(_k = field.rootElement.node) === null || _k === undefined ? undefined : _k.stretchSections(Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
|
|
7468
|
+
(_l = field.rootElement.node) === null || _l === undefined ? undefined : _l.stretchSections(Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
|
|
6787
7469
|
}
|
|
6788
7470
|
}
|
|
6789
7471
|
fitNodeInView(id) {
|
|
@@ -6805,8 +7487,8 @@ class DiagramCanvas {
|
|
|
6805
7487
|
}
|
|
6806
7488
|
}
|
|
6807
7489
|
// add the margin that goes between the rightmost and bottommost points of the sections and the edge of the node
|
|
6808
|
-
newNodeWidth += ((_a = node.type.sectionGrid) === null || _a ===
|
|
6809
|
-
newNodeHeight += ((_b = node.type.sectionGrid) === null || _b ===
|
|
7490
|
+
newNodeWidth += ((_a = node.type.sectionGrid) === null || _a === undefined ? undefined : _a.margin) || 0;
|
|
7491
|
+
newNodeHeight += ((_b = node.type.sectionGrid) === null || _b === undefined ? undefined : _b.margin) || 0;
|
|
6810
7492
|
node.stretch(Side.Right, newNodeWidth - node.width);
|
|
6811
7493
|
node.stretch(Side.Bottom, newNodeHeight - node.height);
|
|
6812
7494
|
}
|
|
@@ -6820,42 +7502,21 @@ class DiagramCanvas {
|
|
|
6820
7502
|
selectCanvasElements() {
|
|
6821
7503
|
return this.selectRoot().select(`.daga-canvas-elements`);
|
|
6822
7504
|
}
|
|
6823
|
-
selectCanvasNodes() {
|
|
6824
|
-
return this.selectRoot().select(`.daga-canvas-nodes`);
|
|
6825
|
-
}
|
|
6826
|
-
selectCanvasSections() {
|
|
6827
|
-
return this.selectRoot().select(`.daga-canvas-sections`);
|
|
6828
|
-
}
|
|
6829
|
-
selectCanvasPorts() {
|
|
6830
|
-
return this.selectRoot().select(`.daga-canvas-ports`);
|
|
6831
|
-
}
|
|
6832
|
-
selectCanvasConnections() {
|
|
6833
|
-
return this.selectRoot().select(`.daga-canvas-connections`);
|
|
6834
|
-
}
|
|
6835
|
-
selectCanvasFields() {
|
|
6836
|
-
return this.selectRoot().select(`.daga-canvas-fields`);
|
|
6837
|
-
}
|
|
6838
|
-
selectCanvasObjects() {
|
|
6839
|
-
return this.selectRoot().select(`.daga-canvas-objects`);
|
|
6840
|
-
}
|
|
6841
|
-
selectCanvasDecorators() {
|
|
6842
|
-
return this.selectRoot().select(`.daga-canvas-decorators`);
|
|
6843
|
-
}
|
|
6844
7505
|
// User actions
|
|
6845
7506
|
startConnection(port) {
|
|
6846
7507
|
var _a, _b, _c, _d;
|
|
6847
|
-
if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a ===
|
|
7508
|
+
if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '') || this.connectionType.canFinishOnType(((_d = (_c = port.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || ''))) {
|
|
6848
7509
|
this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
6849
7510
|
} else {
|
|
6850
7511
|
if (this.inferConnectionType) {
|
|
6851
7512
|
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
6852
7513
|
var _a, _b;
|
|
6853
|
-
return t.canStartFromType(((_b = (_a = port.getNode()) === null || _a ===
|
|
7514
|
+
return t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
|
|
6854
7515
|
});
|
|
6855
7516
|
if (differentConnectionType === undefined) {
|
|
6856
7517
|
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
6857
7518
|
var _a, _b;
|
|
6858
|
-
return t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a ===
|
|
7519
|
+
return t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a === undefined ? undefined : _a.type) === null || _b === undefined ? undefined : _b.id) || '');
|
|
6859
7520
|
});
|
|
6860
7521
|
}
|
|
6861
7522
|
if (differentConnectionType !== undefined) {
|
|
@@ -6869,14 +7530,14 @@ class DiagramCanvas {
|
|
|
6869
7530
|
this.userHighlight.clear();
|
|
6870
7531
|
if (this.unfinishedConnection !== undefined) {
|
|
6871
7532
|
if (this.unfinishedConnection.start !== port) {
|
|
6872
|
-
if (this.unfinishedConnection.type.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a ===
|
|
6873
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_g = this.unfinishedConnection.start) === null || _g ===
|
|
7533
|
+
if (this.unfinishedConnection.type.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.start) === null || _b === undefined ? undefined : _b.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && this.unfinishedConnection.type.canFinishOnType(((_f = (_e = port.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '')) {
|
|
7534
|
+
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_g = this.unfinishedConnection.start) === null || _g === undefined ? undefined : _g.id, port.id);
|
|
6874
7535
|
// clean up the previous unfinished connection
|
|
6875
7536
|
this.dropConnection();
|
|
6876
7537
|
addConnectionAction.do();
|
|
6877
7538
|
this.actionStack.add(addConnectionAction);
|
|
6878
|
-
} else if (this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = (_h = this.unfinishedConnection) === null || _h ===
|
|
6879
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_p = this.unfinishedConnection.start) === null || _p ===
|
|
7539
|
+
} else if (this.unfinishedConnection.type.canFinishOnType(((_l = (_k = (_j = (_h = this.unfinishedConnection) === null || _h === undefined ? undefined : _h.start) === null || _j === undefined ? undefined : _j.getNode()) === null || _k === undefined ? undefined : _k.type) === null || _l === undefined ? undefined : _l.id) || '') && this.unfinishedConnection.type.canStartFromType(((_o = (_m = port.getNode()) === null || _m === undefined ? undefined : _m.type) === null || _o === undefined ? undefined : _o.id) || '')) {
|
|
7540
|
+
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_p = this.unfinishedConnection.start) === null || _p === undefined ? undefined : _p.id);
|
|
6880
7541
|
// clean up the previous unfinished connection
|
|
6881
7542
|
this.dropConnection();
|
|
6882
7543
|
addConnectionAction.do();
|
|
@@ -6885,18 +7546,18 @@ class DiagramCanvas {
|
|
|
6885
7546
|
if (this.inferConnectionType) {
|
|
6886
7547
|
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
6887
7548
|
var _a, _b, _c, _d, _e, _f;
|
|
6888
|
-
return t.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a ===
|
|
7549
|
+
return t.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.start) === null || _b === undefined ? undefined : _b.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && t.canFinishOnType(((_f = (_e = port.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '');
|
|
6889
7550
|
});
|
|
6890
7551
|
let invertConnection = false;
|
|
6891
7552
|
if (differentConnectionType === undefined) {
|
|
6892
7553
|
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
6893
7554
|
var _a, _b, _c, _d, _e, _f;
|
|
6894
|
-
return t.canFinishOnType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a ===
|
|
7555
|
+
return t.canFinishOnType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.start) === null || _b === undefined ? undefined : _b.getNode()) === null || _c === undefined ? undefined : _c.type) === null || _d === undefined ? undefined : _d.id) || '') && t.canStartFromType(((_f = (_e = port.getNode()) === null || _e === undefined ? undefined : _e.type) === null || _f === undefined ? undefined : _f.id) || '');
|
|
6895
7556
|
});
|
|
6896
7557
|
invertConnection = true;
|
|
6897
7558
|
}
|
|
6898
7559
|
if (differentConnectionType !== undefined) {
|
|
6899
|
-
const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_q = this.unfinishedConnection.start) === null || _q ===
|
|
7560
|
+
const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_q = this.unfinishedConnection.start) === null || _q === undefined ? undefined : _q.id, invertConnection ? (_r = this.unfinishedConnection.start) === null || _r === undefined ? undefined : _r.id : port.id);
|
|
6900
7561
|
// clean up the previous unfinished connection
|
|
6901
7562
|
this.dropConnection();
|
|
6902
7563
|
addConnectionAction.do();
|
|
@@ -6918,9 +7579,9 @@ class DiagramCanvas {
|
|
|
6918
7579
|
}
|
|
6919
7580
|
dropConnection() {
|
|
6920
7581
|
var _a, _b, _c, _d;
|
|
6921
|
-
(_a = this.unfinishedConnection) === null || _a ===
|
|
6922
|
-
(_b = this.unfinishedConnection) === null || _b ===
|
|
6923
|
-
(_d = (_c = this.unfinishedConnection) === null || _c ===
|
|
7582
|
+
(_a = this.unfinishedConnection) === null || _a === undefined ? undefined : _a.setStart(undefined);
|
|
7583
|
+
(_b = this.unfinishedConnection) === null || _b === undefined ? undefined : _b.setEnd(undefined);
|
|
7584
|
+
(_d = (_c = this.unfinishedConnection) === null || _c === undefined ? undefined : _c.select()) === null || _d === undefined ? undefined : _d.remove();
|
|
6924
7585
|
this.unfinishedConnection = undefined;
|
|
6925
7586
|
}
|
|
6926
7587
|
cancelAllUserActions() {
|
|
@@ -6965,9 +7626,9 @@ class DiagramCanvas {
|
|
|
6965
7626
|
// keep the field from shrinking below its original size
|
|
6966
7627
|
const newWidth = Math.max(inputFieldWidth, width);
|
|
6967
7628
|
const newHeight = Math.max(inputFieldHeight, height);
|
|
6968
|
-
inputFieldContainer === null || inputFieldContainer ===
|
|
7629
|
+
inputFieldContainer === null || inputFieldContainer === undefined ? undefined : inputFieldContainer.attr('width', `${newWidth}px`);
|
|
6969
7630
|
inputField.style('width', `${newWidth}px`);
|
|
6970
|
-
inputFieldContainer === null || inputFieldContainer ===
|
|
7631
|
+
inputFieldContainer === null || inputFieldContainer === undefined ? undefined : inputFieldContainer.attr('height', `${newHeight}px`);
|
|
6971
7632
|
inputField.style('height', `${newHeight}px`);
|
|
6972
7633
|
if (changeCallback) {
|
|
6973
7634
|
changeCallback(value);
|
|
@@ -6989,13 +7650,13 @@ class DiagramCanvas {
|
|
|
6989
7650
|
var _a, _b, _c;
|
|
6990
7651
|
// when removing an element, a blur event is emitted
|
|
6991
7652
|
// we remove the listener for blur so that it doesn't shoot again on element removal
|
|
6992
|
-
(_b = (_a = this.inputFieldContainer) === null || _a ===
|
|
6993
|
-
(_c = this.inputFieldContainer) === null || _c ===
|
|
7653
|
+
(_b = (_a = this.inputFieldContainer) === null || _a === undefined ? undefined : _a.select('input')) === null || _b === undefined ? undefined : _b.on(Events.Blur, null);
|
|
7654
|
+
(_c = this.inputFieldContainer) === null || _c === undefined ? undefined : _c.remove();
|
|
6994
7655
|
this.inputFieldContainer = undefined;
|
|
6995
7656
|
}
|
|
6996
7657
|
minimumSizeOfField(field) {
|
|
6997
7658
|
var _a, _b;
|
|
6998
|
-
const pNode = (_b = (_a = field.select()) === null || _a ===
|
|
7659
|
+
const pNode = (_b = (_a = field.select()) === null || _a === undefined ? undefined : _a.select('p')) === null || _b === undefined ? undefined : _b.node();
|
|
6999
7660
|
if (!pNode) {
|
|
7000
7661
|
// happens when a field has been created but not updated in view yet
|
|
7001
7662
|
return [0, 0];
|
|
@@ -7010,10 +7671,11 @@ class DiagramCanvas {
|
|
|
7010
7671
|
if (this.canUserPerformAction(DiagramActions.MoveNode) && !d.removed) {
|
|
7011
7672
|
setCursorStyle(CursorStyle.Grabbing);
|
|
7012
7673
|
this.draggingFrom = [event.x, event.y];
|
|
7013
|
-
if (d.selected) {
|
|
7674
|
+
if (d.selected && this.userSelection.count(e => e instanceof DiagramNode) > 1) {
|
|
7014
7675
|
this.currentAction = new MoveAction(this, this.userSelection.filter(e => e instanceof DiagramNode).map(n => n.id), d.coords);
|
|
7015
7676
|
} else {
|
|
7016
|
-
|
|
7677
|
+
const ancestorOfNode = d.getLastAncestor();
|
|
7678
|
+
this.currentAction = new SetGeometryAction(this, DiagramActions.MoveNode, d.id, d.getGeometry(), d.getGeometry(), ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.id, ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id), ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id));
|
|
7017
7679
|
}
|
|
7018
7680
|
} else {
|
|
7019
7681
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
@@ -7023,7 +7685,7 @@ class DiagramCanvas {
|
|
|
7023
7685
|
* Method to call to continue the moving of a node triggered by a user drag event.
|
|
7024
7686
|
*/
|
|
7025
7687
|
continueMovingNode(event, d) {
|
|
7026
|
-
if (this.canUserPerformAction(DiagramActions.MoveNode) && this.currentAction instanceof MoveAction && !d.removed) {
|
|
7688
|
+
if (this.canUserPerformAction(DiagramActions.MoveNode) && (this.currentAction instanceof MoveAction || this.currentAction instanceof SetGeometryAction) && !d.removed) {
|
|
7027
7689
|
const newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
7028
7690
|
if (d.selected) {
|
|
7029
7691
|
this.userSelection.move([newNodeCoords[0] - d.coords[0], newNodeCoords[1] - d.coords[1]]);
|
|
@@ -7038,24 +7700,58 @@ class DiagramCanvas {
|
|
|
7038
7700
|
* Method to call to finish the moving of a node triggered by a user drag event.
|
|
7039
7701
|
*/
|
|
7040
7702
|
finishMovingNode(event, d) {
|
|
7703
|
+
var _a, _b, _c;
|
|
7041
7704
|
if (this.canUserPerformAction(DiagramActions.MoveNode) && !d.removed) {
|
|
7042
7705
|
// prevent drag behavior if mouse hasn't moved
|
|
7043
|
-
if (
|
|
7706
|
+
if (this.draggingFrom[0] !== event.x || this.draggingFrom[1] !== event.y) {
|
|
7044
7707
|
let newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
7045
7708
|
if (this.snapToGrid) {
|
|
7046
7709
|
newNodeCoords = this.getClosestGridPoint(newNodeCoords);
|
|
7047
7710
|
}
|
|
7048
|
-
|
|
7049
|
-
|
|
7050
|
-
|
|
7051
|
-
|
|
7052
|
-
|
|
7053
|
-
|
|
7054
|
-
|
|
7711
|
+
if (this.currentAction instanceof MoveAction) {
|
|
7712
|
+
const movingFrom = this.currentAction.delta;
|
|
7713
|
+
this.currentAction.delta = [newNodeCoords[0] - movingFrom[0], newNodeCoords[1] - movingFrom[1]];
|
|
7714
|
+
// reset position of node prior to moving it again
|
|
7715
|
+
if (d.selected) {
|
|
7716
|
+
this.userSelection.move([movingFrom[0] - d.coords[0], movingFrom[1] - d.coords[1]]);
|
|
7717
|
+
} else {
|
|
7718
|
+
d.move(movingFrom);
|
|
7719
|
+
}
|
|
7720
|
+
} else if (this.currentAction instanceof SetGeometryAction) {
|
|
7721
|
+
d.move(newNodeCoords);
|
|
7722
|
+
// if moving a single node, we can change the node's parent,
|
|
7723
|
+
// so we check whether we dropped this node on a potential parent
|
|
7724
|
+
const nodesAtLocation = this.model.nodes.getAtCoordinates(event.x, event.y).filter(n => n.id !== d.id && !n.isDescendantOf(d));
|
|
7725
|
+
// filter by which nodes can have this node as a child
|
|
7726
|
+
const nodesAtLocationWhichCanHaveNodeAsAChild = nodesAtLocation.filter(n => n.type.childrenTypes.includes(d.type.id));
|
|
7727
|
+
// filter by which nodes don't have descendants in this collection
|
|
7728
|
+
const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
|
|
7729
|
+
const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
|
|
7730
|
+
if (droppedOn !== d.parent && (d.type.canBeParentless || droppedOn !== undefined)) {
|
|
7731
|
+
const ancestorOfDroppedOn = droppedOn === null || droppedOn === undefined ? undefined : droppedOn.getLastAncestor();
|
|
7732
|
+
const fromChildGeometry = this.currentAction.from;
|
|
7733
|
+
const setParentAction = new SetParentAction(this, d.id, (_a = d.parent) === null || _a === undefined ? undefined : _a.id, droppedOn === null || droppedOn === undefined ? undefined : droppedOn.id, fromChildGeometry, d.getGeometry(), ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.id, ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.getGeometry(d.id), ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.getGeometry(d.id));
|
|
7734
|
+
(_b = d.parent) === null || _b === undefined ? undefined : _b.removeChild(d);
|
|
7735
|
+
if (droppedOn !== undefined) {
|
|
7736
|
+
droppedOn.addChild(d);
|
|
7737
|
+
}
|
|
7738
|
+
setParentAction.toChildGeometry = d.getGeometry(d.id);
|
|
7739
|
+
setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === undefined ? undefined : ancestorOfDroppedOn.getGeometry(d.id);
|
|
7740
|
+
this.currentAction = setParentAction;
|
|
7741
|
+
} else {
|
|
7742
|
+
const ancestorOfNode = d === null || d === undefined ? undefined : d.getLastAncestor();
|
|
7743
|
+
this.currentAction.ancestorId = ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.id;
|
|
7744
|
+
this.currentAction.fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id);
|
|
7745
|
+
(_c = d.parent) === null || _c === undefined ? undefined : _c.fitToChild(d);
|
|
7746
|
+
this.currentAction.to = d.getGeometry(d.id);
|
|
7747
|
+
this.currentAction.toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === undefined ? undefined : ancestorOfNode.getGeometry(d.id);
|
|
7748
|
+
}
|
|
7749
|
+
}
|
|
7750
|
+
if (this.currentAction !== undefined) {
|
|
7751
|
+
this.currentAction.do();
|
|
7752
|
+
this.actionStack.add(this.currentAction);
|
|
7753
|
+
this.currentAction = undefined;
|
|
7055
7754
|
}
|
|
7056
|
-
this.currentAction.do();
|
|
7057
|
-
this.actionStack.add(this.currentAction);
|
|
7058
|
-
this.currentAction = undefined;
|
|
7059
7755
|
}
|
|
7060
7756
|
}
|
|
7061
7757
|
setCursorStyle();
|
|
@@ -7074,14 +7770,14 @@ class DiagramCanvas {
|
|
|
7074
7770
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7075
7771
|
if (this.draggingFrom[0] !== pointerCoords[0] || this.draggingFrom[1] !== pointerCoords[1]) {
|
|
7076
7772
|
setCursorStyle(CursorStyle.Crosshair);
|
|
7077
|
-
(_d = (_c = (_b = (_a = this.multipleSelectionContainer) === null || _a ===
|
|
7773
|
+
(_d = (_c = (_b = (_a = this.multipleSelectionContainer) === null || _a === undefined ? undefined : _a.attr('x', Math.min(this.draggingFrom[0], pointerCoords[0]))) === null || _b === undefined ? undefined : _b.attr('y', Math.min(this.draggingFrom[1], pointerCoords[1]))) === null || _c === undefined ? undefined : _c.attr('width', Math.abs(this.draggingFrom[0] - pointerCoords[0]))) === null || _d === undefined ? undefined : _d.attr('height', Math.abs(this.draggingFrom[1] - pointerCoords[1]));
|
|
7078
7774
|
this.dragging = true;
|
|
7079
7775
|
}
|
|
7080
7776
|
}
|
|
7081
7777
|
finishMultipleSelection(event) {
|
|
7082
7778
|
var _a;
|
|
7083
7779
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7084
|
-
(_a = this.multipleSelectionContainer) === null || _a ===
|
|
7780
|
+
(_a = this.multipleSelectionContainer) === null || _a === undefined ? undefined : _a.remove();
|
|
7085
7781
|
this.multipleSelectionContainer = undefined;
|
|
7086
7782
|
this.userSelection.clear();
|
|
7087
7783
|
for (const node of this.model.nodes) {
|
|
@@ -7090,6 +7786,7 @@ class DiagramCanvas {
|
|
|
7090
7786
|
}
|
|
7091
7787
|
}
|
|
7092
7788
|
this.multipleSelectionOn = false;
|
|
7789
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(this.userSelection.all(), true));
|
|
7093
7790
|
setCursorStyle();
|
|
7094
7791
|
}
|
|
7095
7792
|
}
|
|
@@ -7209,7 +7906,7 @@ class CollabClient {
|
|
|
7209
7906
|
const initialModel = message.initialModel;
|
|
7210
7907
|
new DagaImporter().import(session.canvas.model, initialModel);
|
|
7211
7908
|
this.startSyncing(session);
|
|
7212
|
-
(_a = session.joinRoomResolve) === null || _a ===
|
|
7909
|
+
(_a = session.joinRoomResolve) === null || _a === undefined ? undefined : _a.call(session);
|
|
7213
7910
|
session.joinRoomResolve = undefined;
|
|
7214
7911
|
break;
|
|
7215
7912
|
}
|
|
@@ -7232,7 +7929,7 @@ class CollabClient {
|
|
|
7232
7929
|
session.locator = message.locator;
|
|
7233
7930
|
this.pendingSessions.delete(message.refId);
|
|
7234
7931
|
this.sessions.set(session.locator, session);
|
|
7235
|
-
(_b = session.createRoomResolve) === null || _b ===
|
|
7932
|
+
(_b = session.createRoomResolve) === null || _b === undefined ? undefined : _b.call(session, session.locator);
|
|
7236
7933
|
session.createRoomResolve = undefined;
|
|
7237
7934
|
// Deliver queued AddMessages now that we have a locator.
|
|
7238
7935
|
for (const message of session.addQueue) {
|
|
@@ -7488,21 +8185,21 @@ class Grid {
|
|
|
7488
8185
|
*/
|
|
7489
8186
|
class AdjacencyLayout {
|
|
7490
8187
|
apply(model) {
|
|
7491
|
-
var _a
|
|
8188
|
+
var _a;
|
|
7492
8189
|
if (model.nodes.length === 0) {
|
|
7493
8190
|
// nothing to arrange...
|
|
7494
8191
|
return model;
|
|
7495
8192
|
}
|
|
7496
8193
|
// arrange nodes
|
|
7497
8194
|
const nodeArrangement = new Grid();
|
|
7498
|
-
const nodesToBeArranged = model.nodes.
|
|
8195
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7499
8196
|
while (nodesToBeArranged.length > 0) {
|
|
7500
8197
|
arrangeNode(nodesToBeArranged[0], nodeArrangement, [0, 0], nodesToBeArranged);
|
|
7501
8198
|
}
|
|
7502
8199
|
// place nodes according to arrangement
|
|
7503
8200
|
const maximumWidth = Math.max(...model.nodes.map(n => n.width));
|
|
7504
8201
|
const maximumHeight = Math.max(...model.nodes.map(n => n.height));
|
|
7505
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
8202
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
7506
8203
|
for (let y = nodeArrangement.minY(); y <= nodeArrangement.maxY(); ++y) {
|
|
7507
8204
|
for (let x = nodeArrangement.minX(); x <= nodeArrangement.maxX(); ++x) {
|
|
7508
8205
|
const node = nodeArrangement.get([x, y]);
|
|
@@ -7511,7 +8208,6 @@ class AdjacencyLayout {
|
|
|
7511
8208
|
}
|
|
7512
8209
|
}
|
|
7513
8210
|
}
|
|
7514
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7515
8211
|
return model;
|
|
7516
8212
|
}
|
|
7517
8213
|
}
|
|
@@ -7532,14 +8228,14 @@ const arrangeNode = (node, nodeArrangement, coords, nodesToBeArranged) => {
|
|
|
7532
8228
|
*/
|
|
7533
8229
|
class BreadthAdjacencyLayout {
|
|
7534
8230
|
apply(model) {
|
|
7535
|
-
var _a
|
|
8231
|
+
var _a;
|
|
7536
8232
|
if (model.nodes.length === 0) {
|
|
7537
8233
|
// nothing to arrange...
|
|
7538
8234
|
return model;
|
|
7539
8235
|
}
|
|
7540
8236
|
// arrange nodes
|
|
7541
8237
|
const nodeArrangement = new Grid();
|
|
7542
|
-
const nodesToBeArranged = model.nodes.
|
|
8238
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7543
8239
|
const nodeGridIndices = {};
|
|
7544
8240
|
const firstNode = nodesToBeArranged[0];
|
|
7545
8241
|
let currentNodeLevel = [firstNode];
|
|
@@ -7568,7 +8264,7 @@ class BreadthAdjacencyLayout {
|
|
|
7568
8264
|
// place nodes according to arrangement
|
|
7569
8265
|
const maximumWidth = Math.max(...model.nodes.map(n => n.width));
|
|
7570
8266
|
const maximumHeight = Math.max(...model.nodes.map(n => n.height));
|
|
7571
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
8267
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
7572
8268
|
for (let y = nodeArrangement.minY(); y <= nodeArrangement.maxY(); ++y) {
|
|
7573
8269
|
for (let x = nodeArrangement.minX(); x <= nodeArrangement.maxX(); ++x) {
|
|
7574
8270
|
const node = nodeArrangement.get([x, y]);
|
|
@@ -7577,7 +8273,6 @@ class BreadthAdjacencyLayout {
|
|
|
7577
8273
|
}
|
|
7578
8274
|
}
|
|
7579
8275
|
}
|
|
7580
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7581
8276
|
return model;
|
|
7582
8277
|
}
|
|
7583
8278
|
}
|
|
@@ -7588,13 +8283,13 @@ class BreadthAdjacencyLayout {
|
|
|
7588
8283
|
*/
|
|
7589
8284
|
class BreadthLayout {
|
|
7590
8285
|
apply(model) {
|
|
7591
|
-
var _a
|
|
8286
|
+
var _a;
|
|
7592
8287
|
if (model.nodes.length === 0) {
|
|
7593
8288
|
// nothing to arrange...
|
|
7594
8289
|
return model;
|
|
7595
8290
|
}
|
|
7596
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
7597
|
-
let nodesToBeArranged = model.nodes.
|
|
8291
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
8292
|
+
let nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7598
8293
|
// Arrange nodes by a breadth first search
|
|
7599
8294
|
const firstNode = nodesToBeArranged[0];
|
|
7600
8295
|
removeIfExists(nodesToBeArranged, firstNode);
|
|
@@ -7640,7 +8335,6 @@ class BreadthLayout {
|
|
|
7640
8335
|
for (const connection of model.connections) {
|
|
7641
8336
|
connection.tighten();
|
|
7642
8337
|
}
|
|
7643
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7644
8338
|
return model;
|
|
7645
8339
|
}
|
|
7646
8340
|
}
|
|
@@ -7651,14 +8345,14 @@ class BreadthLayout {
|
|
|
7651
8345
|
*/
|
|
7652
8346
|
class ForceLayout {
|
|
7653
8347
|
apply(model) {
|
|
7654
|
-
var _a
|
|
8348
|
+
var _a;
|
|
7655
8349
|
if (model.nodes.length === 0) {
|
|
7656
8350
|
// nothing to arrange...
|
|
7657
8351
|
return model;
|
|
7658
8352
|
}
|
|
7659
8353
|
// as a starting point, we apply a simple layout
|
|
7660
8354
|
new BreadthLayout().apply(model);
|
|
7661
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
8355
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
7662
8356
|
const coolingFactor = 0.99;
|
|
7663
8357
|
const minimumTemperature = 1;
|
|
7664
8358
|
const attractionFactor = 0.1;
|
|
@@ -7736,7 +8430,6 @@ class ForceLayout {
|
|
|
7736
8430
|
for (const connection of model.connections) {
|
|
7737
8431
|
connection.tighten();
|
|
7738
8432
|
}
|
|
7739
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7740
8433
|
return model;
|
|
7741
8434
|
}
|
|
7742
8435
|
}
|
|
@@ -7747,20 +8440,19 @@ class ForceLayout {
|
|
|
7747
8440
|
*/
|
|
7748
8441
|
class HorizontalLayout {
|
|
7749
8442
|
apply(model) {
|
|
7750
|
-
var _a
|
|
8443
|
+
var _a;
|
|
7751
8444
|
if (model.nodes.length === 0) {
|
|
7752
8445
|
// nothing to arrange...
|
|
7753
8446
|
return model;
|
|
7754
8447
|
}
|
|
7755
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
7756
|
-
const nodesToBeArranged = model.nodes.
|
|
8448
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
8449
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7757
8450
|
nodesToBeArranged.sort((a, b) => b.type.priority - a.type.priority);
|
|
7758
8451
|
let widthAccumulator = 0;
|
|
7759
8452
|
for (const node of nodesToBeArranged) {
|
|
7760
8453
|
node.move([widthAccumulator, 0]);
|
|
7761
8454
|
widthAccumulator += node.width + gapSize;
|
|
7762
8455
|
}
|
|
7763
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7764
8456
|
return model;
|
|
7765
8457
|
}
|
|
7766
8458
|
}
|
|
@@ -7771,7 +8463,7 @@ class HorizontalLayout {
|
|
|
7771
8463
|
*/
|
|
7772
8464
|
class PriorityLayout {
|
|
7773
8465
|
apply(model) {
|
|
7774
|
-
var _a
|
|
8466
|
+
var _a;
|
|
7775
8467
|
if (model.nodes.length === 0) {
|
|
7776
8468
|
// nothing to arrange...
|
|
7777
8469
|
return model;
|
|
@@ -7783,10 +8475,10 @@ class PriorityLayout {
|
|
|
7783
8475
|
new BreadthLayout().apply(model);
|
|
7784
8476
|
return model;
|
|
7785
8477
|
}
|
|
7786
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
7787
|
-
const nodesToBeArranged = model.nodes.
|
|
8478
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
8479
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7788
8480
|
const nodeArrangement = [];
|
|
7789
|
-
const nodesWithMaximumPriorityToBeArranged = model.nodes.filter(n => n.getPriority() >= maximumPriority);
|
|
8481
|
+
const nodesWithMaximumPriorityToBeArranged = model.nodes.filter(n => !n.parent).filter(n => n.getPriority() >= maximumPriority);
|
|
7790
8482
|
const nodesWithMaximumPriority = [];
|
|
7791
8483
|
if (nodesWithMaximumPriorityToBeArranged.length > 1) {
|
|
7792
8484
|
// use bfs to sort nodes by distance to the first node
|
|
@@ -7868,7 +8560,6 @@ class PriorityLayout {
|
|
|
7868
8560
|
for (const connection of model.connections) {
|
|
7869
8561
|
connection.tighten();
|
|
7870
8562
|
}
|
|
7871
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7872
8563
|
return model;
|
|
7873
8564
|
}
|
|
7874
8565
|
}
|
|
@@ -7879,7 +8570,7 @@ class PriorityLayout {
|
|
|
7879
8570
|
*/
|
|
7880
8571
|
class TreeLayout {
|
|
7881
8572
|
apply(model) {
|
|
7882
|
-
var _a
|
|
8573
|
+
var _a;
|
|
7883
8574
|
if (model.nodes.length === 0) {
|
|
7884
8575
|
// nothing to arrange...
|
|
7885
8576
|
return model;
|
|
@@ -7891,8 +8582,8 @@ class TreeLayout {
|
|
|
7891
8582
|
new BreadthLayout().apply(model);
|
|
7892
8583
|
return model;
|
|
7893
8584
|
}
|
|
7894
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
7895
|
-
const nodesToBeArranged =
|
|
8585
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
8586
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent).sort((n1, n2) => n2.getPriority() - n1.getPriority());
|
|
7896
8587
|
const branches = [];
|
|
7897
8588
|
while (nodesToBeArranged.length > 0) {
|
|
7898
8589
|
const nodeToBeArranged = nodesToBeArranged[0];
|
|
@@ -7921,7 +8612,6 @@ class TreeLayout {
|
|
|
7921
8612
|
for (const connection of model.connections) {
|
|
7922
8613
|
connection.tighten();
|
|
7923
8614
|
}
|
|
7924
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7925
8615
|
return model;
|
|
7926
8616
|
}
|
|
7927
8617
|
}
|
|
@@ -7978,20 +8668,19 @@ class Branch {
|
|
|
7978
8668
|
*/
|
|
7979
8669
|
class VerticalLayout {
|
|
7980
8670
|
apply(model) {
|
|
7981
|
-
var _a
|
|
8671
|
+
var _a;
|
|
7982
8672
|
if (model.nodes.length === 0) {
|
|
7983
8673
|
// nothing to arrange...
|
|
7984
8674
|
return model;
|
|
7985
8675
|
}
|
|
7986
|
-
const gapSize = (((_a = model.canvas) === null || _a ===
|
|
7987
|
-
const nodesToBeArranged = model.nodes.
|
|
8676
|
+
const gapSize = (((_a = model.canvas) === null || _a === undefined ? undefined : _a.gridSize) || 0) * 2;
|
|
8677
|
+
const nodesToBeArranged = model.nodes.filter(n => !n.parent);
|
|
7988
8678
|
nodesToBeArranged.sort((a, b) => b.type.priority - a.type.priority);
|
|
7989
8679
|
let heightAccumulator = 0;
|
|
7990
8680
|
for (const node of nodesToBeArranged) {
|
|
7991
8681
|
node.move([0, heightAccumulator]);
|
|
7992
8682
|
heightAccumulator += node.height + gapSize;
|
|
7993
8683
|
}
|
|
7994
|
-
(_b = model.canvas) === null || _b === void 0 ? void 0 : _b.diagramChange$.next();
|
|
7995
8684
|
return model;
|
|
7996
8685
|
}
|
|
7997
8686
|
}
|
|
@@ -8009,5 +8698,12 @@ const layouts = {
|
|
|
8009
8698
|
tree: new TreeLayout(),
|
|
8010
8699
|
vertical: new VerticalLayout()
|
|
8011
8700
|
};
|
|
8701
|
+
const getLocationsOfNodes = model => {
|
|
8702
|
+
const locations = {};
|
|
8703
|
+
for (const node of model.nodes) {
|
|
8704
|
+
locations[node.id] = node.coords;
|
|
8705
|
+
}
|
|
8706
|
+
return locations;
|
|
8707
|
+
};
|
|
8012
8708
|
|
|
8013
|
-
export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSection, DiagramSectionSet, DiagramUserHighlight, DiagramUserSelection, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, generalClosedPath, getBottomMargin, getBottomPadding, getLeftMargin, getLeftPadding, getRightMargin, getRightPadding, getTopMargin, getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
|
|
8709
|
+
export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramUserHighlight, DiagramUserSelection, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
|