@metadev/daga 5.1.1 → 5.1.3
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 +13 -0
- package/README.md +78 -78
- package/index.cjs.js +1280 -1167
- package/index.esm.js +1280 -1167
- package/package.json +1 -1
- package/src/lib/diagram/canvas/diagram-canvas-util.d.ts +9 -3
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +8 -51
- package/src/lib/diagram/canvas/diagram-context-menu.d.ts +1 -3
- package/src/lib/diagram/canvas/diagram-user-highlight.d.ts +1 -6
- package/src/lib/diagram/canvas/diagram-user-selection.d.ts +1 -5
- package/src/lib/diagram/collab/collab-action.d.ts +1 -1
- package/src/lib/diagram/collab/collab-client.d.ts +1 -23
- package/src/lib/diagram/config/diagram-config.d.ts +5 -0
- package/src/lib/diagram/diagram-action.d.ts +2 -6
- package/src/lib/diagram/model/diagram-connection.d.ts +3 -3
- package/src/lib/diagram/model/diagram-decorator.d.ts +1 -1
- package/src/lib/diagram/model/diagram-element.d.ts +1 -1
- package/src/lib/diagram/model/diagram-field.d.ts +2 -2
- package/src/lib/diagram/model/diagram-node.d.ts +15 -3
- package/src/lib/diagram/model/diagram-object.d.ts +1 -1
- package/src/lib/diagram/model/diagram-port.d.ts +3 -3
- package/src/lib/diagram/model/diagram-section.d.ts +1 -1
- package/src/lib/diagram/property/value.d.ts +1 -16
- package/src/lib/interfaces/canvas.d.ts +15 -4
- package/src/lib/util/grid.d.ts +1 -3
package/index.cjs.js
CHANGED
|
@@ -122,6 +122,53 @@ exports.VerticalAlign = void 0;
|
|
|
122
122
|
VerticalAlign["Bottom"] = "bottom";
|
|
123
123
|
})(exports.VerticalAlign || (exports.VerticalAlign = {}));
|
|
124
124
|
|
|
125
|
+
/******************************************************************************
|
|
126
|
+
Copyright (c) Microsoft Corporation.
|
|
127
|
+
|
|
128
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
129
|
+
purpose with or without fee is hereby granted.
|
|
130
|
+
|
|
131
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
132
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
133
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
134
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
135
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
136
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
137
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
138
|
+
***************************************************************************** */
|
|
139
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
function __rest(s, e) {
|
|
143
|
+
var t = {};
|
|
144
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
145
|
+
t[p] = s[p];
|
|
146
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
147
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
148
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
149
|
+
t[p[i]] = s[p[i]];
|
|
150
|
+
}
|
|
151
|
+
return t;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
155
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
156
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
157
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
161
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
162
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
163
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
164
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
168
|
+
var e = new Error(message);
|
|
169
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
170
|
+
};
|
|
171
|
+
|
|
125
172
|
/**
|
|
126
173
|
* Round the coordinates of the given point to the nearest whole number.
|
|
127
174
|
* @public
|
|
@@ -1214,40 +1261,6 @@ const clone = o => {
|
|
|
1214
1261
|
return res;
|
|
1215
1262
|
};
|
|
1216
1263
|
|
|
1217
|
-
/******************************************************************************
|
|
1218
|
-
Copyright (c) Microsoft Corporation.
|
|
1219
|
-
|
|
1220
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
1221
|
-
purpose with or without fee is hereby granted.
|
|
1222
|
-
|
|
1223
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1224
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1225
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1226
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1227
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1228
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1229
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
1230
|
-
***************************************************************************** */
|
|
1231
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
function __rest(s, e) {
|
|
1235
|
-
var t = {};
|
|
1236
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1237
|
-
t[p] = s[p];
|
|
1238
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1239
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1240
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1241
|
-
t[p[i]] = s[p[i]];
|
|
1242
|
-
}
|
|
1243
|
-
return t;
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
1247
|
-
var e = new Error(message);
|
|
1248
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1249
|
-
};
|
|
1250
|
-
|
|
1251
1264
|
/**
|
|
1252
1265
|
* Converts a configuration for a look into an easier to consult object of fully qualified looks for each case.
|
|
1253
1266
|
*
|
|
@@ -1505,6 +1518,7 @@ const diffProperties = (a, b, valueSet) => {
|
|
|
1505
1518
|
*/
|
|
1506
1519
|
const isObject = x => x !== undefined && x !== null && x.constructor === Object;
|
|
1507
1520
|
|
|
1521
|
+
var _ValueSet_instances, _a$1, _ValueSet_values, _ValueSet_valueSets, _ValueSet_ownTimestamps, _ValueSet_constructSubValueSet;
|
|
1508
1522
|
/**
|
|
1509
1523
|
* A set of values corresponding to a set of properties.
|
|
1510
1524
|
* @public
|
|
@@ -1512,17 +1526,18 @@ const isObject = x => x !== undefined && x !== null && x.constructor === Object;
|
|
|
1512
1526
|
*/
|
|
1513
1527
|
class ValueSet {
|
|
1514
1528
|
constructor(propertySet, rootElement) {
|
|
1529
|
+
_ValueSet_instances.add(this);
|
|
1515
1530
|
this.displayedProperties = [];
|
|
1516
1531
|
this.hiddenProperties = [];
|
|
1517
|
-
this
|
|
1518
|
-
this
|
|
1532
|
+
_ValueSet_values.set(this, {});
|
|
1533
|
+
_ValueSet_valueSets.set(this, {});
|
|
1519
1534
|
/**
|
|
1520
1535
|
* Collaborative timestamps for all keys in this.values that have ever been set,
|
|
1521
1536
|
* even if since they've since been set to the default value.
|
|
1522
1537
|
*
|
|
1523
1538
|
* Object values (in this.valueSets) store their own timestamps separately.
|
|
1524
1539
|
*/
|
|
1525
|
-
this
|
|
1540
|
+
_ValueSet_ownTimestamps.set(this, {});
|
|
1526
1541
|
this.propertySet = propertySet;
|
|
1527
1542
|
this.rootElement = rootElement;
|
|
1528
1543
|
this.resetValues();
|
|
@@ -1597,16 +1612,16 @@ class ValueSet {
|
|
|
1597
1612
|
*/
|
|
1598
1613
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1599
1614
|
getValue(key) {
|
|
1600
|
-
var
|
|
1601
|
-
const rootAttribute = (
|
|
1615
|
+
var _b;
|
|
1616
|
+
const rootAttribute = (_b = this.propertySet.getProperty(key)) === null || _b === void 0 ? void 0 : _b.rootAttribute;
|
|
1602
1617
|
if (rootAttribute !== undefined && rootAttribute !== null) {
|
|
1603
|
-
this
|
|
1618
|
+
__classPrivateFieldGet(this, _ValueSet_values, "f")[key] = this.getRootElementValue(rootAttribute);
|
|
1604
1619
|
}
|
|
1605
1620
|
const property = this.propertySet.getProperty(key);
|
|
1606
1621
|
if (property.type === exports.Type.Object) {
|
|
1607
|
-
return this
|
|
1622
|
+
return __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getValues();
|
|
1608
1623
|
} else {
|
|
1609
|
-
return this
|
|
1624
|
+
return __classPrivateFieldGet(this, _ValueSet_values, "f")[key];
|
|
1610
1625
|
}
|
|
1611
1626
|
}
|
|
1612
1627
|
/**
|
|
@@ -1619,7 +1634,7 @@ class ValueSet {
|
|
|
1619
1634
|
for (const key in this.propertySet.propertyMap) {
|
|
1620
1635
|
const property = this.propertySet.getProperty(key);
|
|
1621
1636
|
if (property.type === exports.Type.Object) {
|
|
1622
|
-
result[key] = this
|
|
1637
|
+
result[key] = __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getValues();
|
|
1623
1638
|
} else {
|
|
1624
1639
|
result[key] = this.getValue(key);
|
|
1625
1640
|
}
|
|
@@ -1636,7 +1651,7 @@ class ValueSet {
|
|
|
1636
1651
|
for (const key in keys) {
|
|
1637
1652
|
const property = this.propertySet.getProperty(key);
|
|
1638
1653
|
if (property.type === exports.Type.Object) {
|
|
1639
|
-
result[key] = this
|
|
1654
|
+
result[key] = __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getValuesForKeys(keys[key]);
|
|
1640
1655
|
} else {
|
|
1641
1656
|
result[key] = this.getValue(key);
|
|
1642
1657
|
}
|
|
@@ -1653,9 +1668,9 @@ class ValueSet {
|
|
|
1653
1668
|
for (const key in this.propertySet.propertyMap) {
|
|
1654
1669
|
const property = this.propertySet.getProperty(key);
|
|
1655
1670
|
if (property.type === exports.Type.Object) {
|
|
1656
|
-
result[key] = this
|
|
1671
|
+
result[key] = __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getTimestamps();
|
|
1657
1672
|
} else {
|
|
1658
|
-
const timestamp = this
|
|
1673
|
+
const timestamp = __classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key];
|
|
1659
1674
|
if (timestamp) result[key] = timestamp;
|
|
1660
1675
|
}
|
|
1661
1676
|
}
|
|
@@ -1708,9 +1723,9 @@ class ValueSet {
|
|
|
1708
1723
|
const property = this.propertySet.getProperty(key);
|
|
1709
1724
|
if (property) {
|
|
1710
1725
|
if (property.type === exports.Type.Object) {
|
|
1711
|
-
this
|
|
1726
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].setValues(value);
|
|
1712
1727
|
} else {
|
|
1713
|
-
this
|
|
1728
|
+
__classPrivateFieldGet(this, _ValueSet_values, "f")[key] = value;
|
|
1714
1729
|
if (!equals(value, property.defaultValue)) {
|
|
1715
1730
|
this.displayProperty(property);
|
|
1716
1731
|
}
|
|
@@ -1731,7 +1746,7 @@ class ValueSet {
|
|
|
1731
1746
|
for (const key in values) {
|
|
1732
1747
|
const property = this.propertySet.getProperty(key);
|
|
1733
1748
|
if (property.type === exports.Type.Object) {
|
|
1734
|
-
this
|
|
1749
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].setValues(values[key]);
|
|
1735
1750
|
} else {
|
|
1736
1751
|
this.setValue(key, values[key]);
|
|
1737
1752
|
}
|
|
@@ -1743,13 +1758,13 @@ class ValueSet {
|
|
|
1743
1758
|
* @param values An object containing all the CollabTimestamps in the set.
|
|
1744
1759
|
*/
|
|
1745
1760
|
setTimestamps(timestamps) {
|
|
1746
|
-
this
|
|
1761
|
+
__classPrivateFieldSet(this, _ValueSet_ownTimestamps, {}, "f");
|
|
1747
1762
|
for (const key in timestamps) {
|
|
1748
1763
|
const property = this.propertySet.getProperty(key);
|
|
1749
1764
|
if (property.type === exports.Type.Object) {
|
|
1750
|
-
this
|
|
1765
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].setTimestamps(timestamps[key]);
|
|
1751
1766
|
} else {
|
|
1752
|
-
this
|
|
1767
|
+
__classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key] = timestamps[key];
|
|
1753
1768
|
}
|
|
1754
1769
|
}
|
|
1755
1770
|
}
|
|
@@ -1762,7 +1777,7 @@ class ValueSet {
|
|
|
1762
1777
|
for (const key in values) {
|
|
1763
1778
|
const property = this.propertySet.getProperty(key);
|
|
1764
1779
|
if (property.type === exports.Type.Object) {
|
|
1765
|
-
this
|
|
1780
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].overwriteValues(values[key]);
|
|
1766
1781
|
} else {
|
|
1767
1782
|
this.setValue(key, values[key]);
|
|
1768
1783
|
}
|
|
@@ -1777,11 +1792,11 @@ class ValueSet {
|
|
|
1777
1792
|
for (const key in values) {
|
|
1778
1793
|
const property = this.propertySet.getProperty(key);
|
|
1779
1794
|
if (property.type === exports.Type.Object) {
|
|
1780
|
-
this
|
|
1795
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].overwriteValuesLww(values[key], timestamp);
|
|
1781
1796
|
} else {
|
|
1782
|
-
if (timestampWins(timestamp, this
|
|
1797
|
+
if (timestampWins(timestamp, __classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key])) {
|
|
1783
1798
|
this.setValue(key, values[key]);
|
|
1784
|
-
this
|
|
1799
|
+
__classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key] = timestamp;
|
|
1785
1800
|
}
|
|
1786
1801
|
}
|
|
1787
1802
|
}
|
|
@@ -1794,18 +1809,18 @@ class ValueSet {
|
|
|
1794
1809
|
resetValues() {
|
|
1795
1810
|
this.displayedProperties = [];
|
|
1796
1811
|
this.hiddenProperties = [];
|
|
1797
|
-
this
|
|
1812
|
+
__classPrivateFieldSet(this, _ValueSet_ownTimestamps, {}, "f");
|
|
1798
1813
|
for (const key in this.propertySet.propertyMap) {
|
|
1799
1814
|
const property = this.propertySet.getProperty(key);
|
|
1800
1815
|
const rootAttribute = property.rootAttribute;
|
|
1801
1816
|
if (property.type === exports.Type.Object) {
|
|
1802
|
-
this
|
|
1817
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key] = __classPrivateFieldGet(this, _ValueSet_instances, "m", _ValueSet_constructSubValueSet).call(this, key);
|
|
1803
1818
|
} else {
|
|
1804
|
-
this
|
|
1819
|
+
__classPrivateFieldGet(this, _ValueSet_values, "f")[key] = clone(property.defaultValue);
|
|
1805
1820
|
}
|
|
1806
1821
|
if (rootAttribute !== undefined && rootAttribute !== null) {
|
|
1807
1822
|
if (property.defaultValue !== undefined && !equals(this.getRootElementValue(rootAttribute), property.defaultValue)) {
|
|
1808
|
-
this.setRootElementValue(rootAttribute, this
|
|
1823
|
+
this.setRootElementValue(rootAttribute, __classPrivateFieldGet(this, _ValueSet_values, "f")[key]);
|
|
1809
1824
|
}
|
|
1810
1825
|
}
|
|
1811
1826
|
if (property.basic !== false) {
|
|
@@ -1815,19 +1830,6 @@ class ValueSet {
|
|
|
1815
1830
|
}
|
|
1816
1831
|
}
|
|
1817
1832
|
}
|
|
1818
|
-
/**
|
|
1819
|
-
* Constructs a ValueSet with its corresponding PropertySet representing the values of the object.
|
|
1820
|
-
* @private
|
|
1821
|
-
* @param key Key that the ValueSet is under.
|
|
1822
|
-
* @returns The constructed ValueSet.
|
|
1823
|
-
*/
|
|
1824
|
-
constructSubValueSet(key) {
|
|
1825
|
-
const property = this.propertySet.getProperty(key);
|
|
1826
|
-
const propertySet = new PropertySet(property.properties);
|
|
1827
|
-
const valueSet = new ValueSet(propertySet, this.rootElement);
|
|
1828
|
-
valueSet.overwriteValues(clone(property.defaultValue));
|
|
1829
|
-
return valueSet;
|
|
1830
|
-
}
|
|
1831
1833
|
/**
|
|
1832
1834
|
* Gets the ValueSet under the given key when there are nested ValueSets.
|
|
1833
1835
|
* @private
|
|
@@ -1835,7 +1837,7 @@ class ValueSet {
|
|
|
1835
1837
|
* @returns A ValueSet.
|
|
1836
1838
|
*/
|
|
1837
1839
|
getSubValueSet(key) {
|
|
1838
|
-
return this
|
|
1840
|
+
return __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key];
|
|
1839
1841
|
}
|
|
1840
1842
|
/**
|
|
1841
1843
|
* Moves the given property to the list of displayed properties.
|
|
@@ -1860,6 +1862,13 @@ class ValueSet {
|
|
|
1860
1862
|
}
|
|
1861
1863
|
}
|
|
1862
1864
|
}
|
|
1865
|
+
_a$1 = ValueSet, _ValueSet_values = new WeakMap(), _ValueSet_valueSets = new WeakMap(), _ValueSet_ownTimestamps = new WeakMap(), _ValueSet_instances = new WeakSet(), _ValueSet_constructSubValueSet = function _ValueSet_constructSubValueSet(key) {
|
|
1866
|
+
const property = this.propertySet.getProperty(key);
|
|
1867
|
+
const propertySet = new PropertySet(property.properties);
|
|
1868
|
+
const valueSet = new _a$1(propertySet, this.rootElement);
|
|
1869
|
+
valueSet.overwriteValues(clone(property.defaultValue));
|
|
1870
|
+
return valueSet;
|
|
1871
|
+
};
|
|
1863
1872
|
|
|
1864
1873
|
/**
|
|
1865
1874
|
* Represents a collection of diagram entities of a type that exists as part of a diagram model.
|
|
@@ -1997,6 +2006,7 @@ class DiagramEntitySet {
|
|
|
1997
2006
|
}
|
|
1998
2007
|
}
|
|
1999
2008
|
|
|
2009
|
+
var _DiagramElement_id;
|
|
2000
2010
|
/**
|
|
2001
2011
|
* Default priority value for diagram elements.
|
|
2002
2012
|
* @private
|
|
@@ -2014,7 +2024,7 @@ class DiagramElement {
|
|
|
2014
2024
|
* @public
|
|
2015
2025
|
*/
|
|
2016
2026
|
get id() {
|
|
2017
|
-
return this
|
|
2027
|
+
return __classPrivateFieldGet(this, _DiagramElement_id, "f");
|
|
2018
2028
|
}
|
|
2019
2029
|
/**
|
|
2020
2030
|
* Whether this diagram element is currently in the user highlight.
|
|
@@ -2032,6 +2042,7 @@ class DiagramElement {
|
|
|
2032
2042
|
return ((_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userSelection) === null || _b === void 0 ? void 0 : _b.contains(this.id)) || false;
|
|
2033
2043
|
}
|
|
2034
2044
|
constructor(model, id) {
|
|
2045
|
+
_DiagramElement_id.set(this, void 0);
|
|
2035
2046
|
/**
|
|
2036
2047
|
* Whether this diagram element has itself been explicitly removed.
|
|
2037
2048
|
*
|
|
@@ -2050,7 +2061,7 @@ class DiagramElement {
|
|
|
2050
2061
|
*/
|
|
2051
2062
|
this.selfRemovedTimestamp = null;
|
|
2052
2063
|
this.model = model;
|
|
2053
|
-
this
|
|
2064
|
+
__classPrivateFieldSet(this, _DiagramElement_id, id, "f");
|
|
2054
2065
|
}
|
|
2055
2066
|
/**
|
|
2056
2067
|
* Obtain the selection of this element.
|
|
@@ -2061,6 +2072,7 @@ class DiagramElement {
|
|
|
2061
2072
|
return (_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.selectCanvasView()) === null || _b === void 0 ? void 0 : _b.select(`[id='${escapeSelector(this.id)}']`);
|
|
2062
2073
|
}
|
|
2063
2074
|
}
|
|
2075
|
+
_DiagramElement_id = new WeakMap();
|
|
2064
2076
|
class DiagramElementSet extends DiagramEntitySet {
|
|
2065
2077
|
all(includeRemoved = false) {
|
|
2066
2078
|
if (includeRemoved) {
|
|
@@ -2138,6 +2150,7 @@ class DiagramElementSet extends DiagramEntitySet {
|
|
|
2138
2150
|
}
|
|
2139
2151
|
}
|
|
2140
2152
|
|
|
2153
|
+
var _DiagramConnection_type, _DiagramConnectionSet_model;
|
|
2141
2154
|
/**
|
|
2142
2155
|
* Default values of the parameters of a diagram connection.
|
|
2143
2156
|
* @private
|
|
@@ -2222,12 +2235,12 @@ class DiagramConnectionType {
|
|
|
2222
2235
|
*/
|
|
2223
2236
|
class DiagramConnection extends DiagramElement {
|
|
2224
2237
|
get type() {
|
|
2225
|
-
return this
|
|
2238
|
+
return __classPrivateFieldGet(this, _DiagramConnection_type, "f");
|
|
2226
2239
|
}
|
|
2227
2240
|
set type(type) {
|
|
2228
2241
|
var _a, _b;
|
|
2229
|
-
if (type !== this
|
|
2230
|
-
this
|
|
2242
|
+
if (type !== __classPrivateFieldGet(this, _DiagramConnection_type, "f")) {
|
|
2243
|
+
__classPrivateFieldSet(this, _DiagramConnection_type, type, "f");
|
|
2231
2244
|
if (this.valueSet) {
|
|
2232
2245
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
2233
2246
|
}
|
|
@@ -2423,6 +2436,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
2423
2436
|
throw new Error(`DiagramConnection cannot have an empty or null id`);
|
|
2424
2437
|
}
|
|
2425
2438
|
super(model, id);
|
|
2439
|
+
_DiagramConnection_type.set(this, void 0);
|
|
2426
2440
|
/**
|
|
2427
2441
|
* Coordinates of the start point of this connection.
|
|
2428
2442
|
* @public
|
|
@@ -2453,7 +2467,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
2453
2467
|
* @public
|
|
2454
2468
|
*/
|
|
2455
2469
|
this.points = [];
|
|
2456
|
-
this
|
|
2470
|
+
__classPrivateFieldSet(this, _DiagramConnection_type, type, "f");
|
|
2457
2471
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
2458
2472
|
this.originalData = {};
|
|
2459
2473
|
this.setStart(start);
|
|
@@ -2630,6 +2644,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
2630
2644
|
}
|
|
2631
2645
|
}
|
|
2632
2646
|
}
|
|
2647
|
+
_DiagramConnection_type = new WeakMap();
|
|
2633
2648
|
class DiagramConnectionSet extends DiagramElementSet {
|
|
2634
2649
|
/**
|
|
2635
2650
|
* Instance a set of connections for the given model. This method is used internally.
|
|
@@ -2637,12 +2652,13 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
2637
2652
|
*/
|
|
2638
2653
|
constructor(model) {
|
|
2639
2654
|
super();
|
|
2655
|
+
_DiagramConnectionSet_model.set(this, void 0);
|
|
2640
2656
|
/**
|
|
2641
2657
|
* Set of the possible types of connection that the connections of this set can have.
|
|
2642
2658
|
* @public
|
|
2643
2659
|
*/
|
|
2644
2660
|
this.types = new DiagramEntitySet();
|
|
2645
|
-
this
|
|
2661
|
+
__classPrivateFieldSet(this, _DiagramConnectionSet_model, model, "f");
|
|
2646
2662
|
}
|
|
2647
2663
|
/**
|
|
2648
2664
|
* Instance a new connection and add it to this set.
|
|
@@ -2665,7 +2681,7 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
2665
2681
|
}
|
|
2666
2682
|
connectionType = foundConnectionType;
|
|
2667
2683
|
}
|
|
2668
|
-
const connection = new DiagramConnection(this
|
|
2684
|
+
const connection = new DiagramConnection(__classPrivateFieldGet(this, _DiagramConnectionSet_model, "f"), connectionType, start, end, id);
|
|
2669
2685
|
super.add(connection);
|
|
2670
2686
|
connection.updateInView();
|
|
2671
2687
|
connection.valueSet.resetValues();
|
|
@@ -2687,6 +2703,7 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
2687
2703
|
}
|
|
2688
2704
|
}
|
|
2689
2705
|
}
|
|
2706
|
+
_DiagramConnectionSet_model = new WeakMap();
|
|
2690
2707
|
|
|
2691
2708
|
/**
|
|
2692
2709
|
* The different modes for when a node or section can be resized.
|
|
@@ -2710,6 +2727,7 @@ exports.ResizableMode = void 0;
|
|
|
2710
2727
|
ResizableMode[ResizableMode["Never"] = 2] = "Never";
|
|
2711
2728
|
})(exports.ResizableMode || (exports.ResizableMode = {}));
|
|
2712
2729
|
|
|
2730
|
+
var _DiagramField_text, _DiagramFieldSet_model;
|
|
2713
2731
|
/**
|
|
2714
2732
|
* Default values of the parameters of a diagram field.
|
|
2715
2733
|
* @private
|
|
@@ -2746,14 +2764,14 @@ class DiagramField extends DiagramElement {
|
|
|
2746
2764
|
* @public
|
|
2747
2765
|
*/
|
|
2748
2766
|
get text() {
|
|
2749
|
-
return this
|
|
2767
|
+
return __classPrivateFieldGet(this, _DiagramField_text, "f");
|
|
2750
2768
|
}
|
|
2751
2769
|
set text(value) {
|
|
2752
2770
|
var _a;
|
|
2753
2771
|
if (value === null || value === undefined || (value === null || value === void 0 ? void 0 : value.trim()) === '') {
|
|
2754
2772
|
value = this.defaultText;
|
|
2755
2773
|
}
|
|
2756
|
-
this
|
|
2774
|
+
__classPrivateFieldSet(this, _DiagramField_text, value, "f");
|
|
2757
2775
|
this.updateInView();
|
|
2758
2776
|
if (this.fit) {
|
|
2759
2777
|
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.fitFieldRootInView(this.id, this.shrink);
|
|
@@ -2784,6 +2802,7 @@ class DiagramField extends DiagramElement {
|
|
|
2784
2802
|
throw new Error('DiagramField for rootElement already exists');
|
|
2785
2803
|
}
|
|
2786
2804
|
super(model, id);
|
|
2805
|
+
_DiagramField_text.set(this, void 0);
|
|
2787
2806
|
/**
|
|
2788
2807
|
* Collaborative timestamp for text.
|
|
2789
2808
|
* @public
|
|
@@ -2822,7 +2841,7 @@ class DiagramField extends DiagramElement {
|
|
|
2822
2841
|
this.highlightedLook = looks.highlightedLook;
|
|
2823
2842
|
this.selectedAndHighlightedLook = looks.selectedAndHighlightedLook;
|
|
2824
2843
|
this.defaultText = text;
|
|
2825
|
-
this
|
|
2844
|
+
__classPrivateFieldSet(this, _DiagramField_text, text, "f");
|
|
2826
2845
|
this.editable = editable;
|
|
2827
2846
|
this.fit = fit;
|
|
2828
2847
|
this.shrink = shrink;
|
|
@@ -2852,6 +2871,7 @@ class DiagramField extends DiagramElement {
|
|
|
2852
2871
|
return ((_a = this.rootElement) === null || _a === void 0 ? void 0 : _a.getPriority()) || DEFAULT_PRIORITY;
|
|
2853
2872
|
}
|
|
2854
2873
|
}
|
|
2874
|
+
_DiagramField_text = new WeakMap();
|
|
2855
2875
|
class DiagramFieldSet extends DiagramElementSet {
|
|
2856
2876
|
/**
|
|
2857
2877
|
* Instance a set of fields for the given model. This method is used internally.
|
|
@@ -2859,14 +2879,15 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2859
2879
|
*/
|
|
2860
2880
|
constructor(model) {
|
|
2861
2881
|
super();
|
|
2862
|
-
this
|
|
2882
|
+
_DiagramFieldSet_model.set(this, void 0);
|
|
2883
|
+
__classPrivateFieldSet(this, _DiagramFieldSet_model, model, "f");
|
|
2863
2884
|
}
|
|
2864
2885
|
/**
|
|
2865
2886
|
* Instance a new field and add it to this set. This method is normally called when instancing an element with a field and it is rarely called by itself.
|
|
2866
2887
|
* @private
|
|
2867
2888
|
*/
|
|
2868
2889
|
new(rootElement, coords, width, height, horizontalAlign, verticalAlign, orientation, multiline, look, text, editable, fit, shrink) {
|
|
2869
|
-
const field = new DiagramField(this
|
|
2890
|
+
const field = new DiagramField(__classPrivateFieldGet(this, _DiagramFieldSet_model, "f"), rootElement, coords, width, height, horizontalAlign, verticalAlign, orientation, multiline, look, text, editable, fit, shrink);
|
|
2870
2891
|
super.add(field);
|
|
2871
2892
|
field.updateInView();
|
|
2872
2893
|
// add this field to its root element
|
|
@@ -2892,6 +2913,7 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2892
2913
|
}
|
|
2893
2914
|
}
|
|
2894
2915
|
}
|
|
2916
|
+
_DiagramFieldSet_model = new WeakMap();
|
|
2895
2917
|
const getBottomMargin = config => {
|
|
2896
2918
|
if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
|
|
2897
2919
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
@@ -3100,6 +3122,7 @@ class DiagramResizer {
|
|
|
3100
3122
|
}
|
|
3101
3123
|
const DIAGRAM_DEFAULT_RESIZER = new DiagramResizer(DIAGRAM_RESIZER_DEFAULTS);
|
|
3102
3124
|
|
|
3125
|
+
var _DiagramSectionSet_model;
|
|
3103
3126
|
/**
|
|
3104
3127
|
* Default value of the default width of a diagram section.
|
|
3105
3128
|
* @private
|
|
@@ -3587,7 +3610,8 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3587
3610
|
*/
|
|
3588
3611
|
constructor(model) {
|
|
3589
3612
|
super();
|
|
3590
|
-
this
|
|
3613
|
+
_DiagramSectionSet_model.set(this, void 0);
|
|
3614
|
+
__classPrivateFieldSet(this, _DiagramSectionSet_model, model, "f");
|
|
3591
3615
|
}
|
|
3592
3616
|
/**
|
|
3593
3617
|
* Instance a new section and add it to this set. This method is normally called when instancing an element with a section and it is rarely called by itself.
|
|
@@ -3595,7 +3619,7 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3595
3619
|
*/
|
|
3596
3620
|
new(node, indexXInNode, indexYInNode, coords, width, height, id) {
|
|
3597
3621
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3598
|
-
const section = new DiagramSection(this
|
|
3622
|
+
const section = new DiagramSection(__classPrivateFieldGet(this, _DiagramSectionSet_model, "f"), node, indexXInNode, indexYInNode, coords, width, height, id);
|
|
3599
3623
|
super.add(section);
|
|
3600
3624
|
section.updateInView();
|
|
3601
3625
|
// add this section to its node
|
|
@@ -3606,7 +3630,7 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3606
3630
|
if (sectionPorts && sectionPorts.length > 0) {
|
|
3607
3631
|
for (let i = 0; i < sectionPorts.length; ++i) {
|
|
3608
3632
|
const portConfig = sectionPorts[i];
|
|
3609
|
-
const port = this.
|
|
3633
|
+
const port = __classPrivateFieldGet(this, _DiagramSectionSet_model, "f").ports.new(portConfig.type !== undefined ? __classPrivateFieldGet(this, _DiagramSectionSet_model, "f").ports.types.get(portConfig.type) : undefined, section, [section.coords[0] + (portConfig.coords[0] || 0), section.coords[1] + (portConfig.coords[1] || 0)], portConfig.connectionPoint !== undefined ? [section.coords[0] + (portConfig.connectionPoint[0] || 0), section.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig === null || portConfig === void 0 ? void 0 : portConfig.direction, `${section.id}_${i}`, portConfig.anchorPointX || 'floating', portConfig.anchorPointY || 'floating');
|
|
3610
3634
|
if ((_e = port.type) === null || _e === void 0 ? void 0 : _e.label) {
|
|
3611
3635
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === void 0 ? void 0 : _f.label);
|
|
3612
3636
|
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
@@ -3625,7 +3649,7 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3625
3649
|
default:
|
|
3626
3650
|
labelCoords = port.coords;
|
|
3627
3651
|
}
|
|
3628
|
-
this.
|
|
3652
|
+
__classPrivateFieldGet(this, _DiagramSectionSet_model, "f").fields.new(port, labelCoords, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
|
|
3629
3653
|
}
|
|
3630
3654
|
}
|
|
3631
3655
|
}
|
|
@@ -3634,7 +3658,7 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3634
3658
|
if (sectionLabel) {
|
|
3635
3659
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), sectionLabel);
|
|
3636
3660
|
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
3637
|
-
this.
|
|
3661
|
+
__classPrivateFieldGet(this, _DiagramSectionSet_model, "f").fields.new(section, [section.coords[0] + getLeftMargin(labelConfiguration), section.coords[1] + getTopMargin(labelConfiguration)], section.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), section.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
|
|
3638
3662
|
}
|
|
3639
3663
|
return section;
|
|
3640
3664
|
}
|
|
@@ -3643,11 +3667,11 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3643
3667
|
if (section) {
|
|
3644
3668
|
// remove all ports
|
|
3645
3669
|
while (section.ports.length > 0) {
|
|
3646
|
-
this.
|
|
3670
|
+
__classPrivateFieldGet(this, _DiagramSectionSet_model, "f").ports.remove(section.ports[0].id);
|
|
3647
3671
|
}
|
|
3648
3672
|
// remove label
|
|
3649
3673
|
if (section.label) {
|
|
3650
|
-
this.
|
|
3674
|
+
__classPrivateFieldGet(this, _DiagramSectionSet_model, "f").fields.remove(section.label.id);
|
|
3651
3675
|
}
|
|
3652
3676
|
// remove from root element
|
|
3653
3677
|
if (section.node) {
|
|
@@ -3660,7 +3684,9 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3660
3684
|
}
|
|
3661
3685
|
}
|
|
3662
3686
|
}
|
|
3687
|
+
_DiagramSectionSet_model = new WeakMap();
|
|
3663
3688
|
|
|
3689
|
+
var _DiagramNode_type, _DiagramNodeSet_model;
|
|
3664
3690
|
/**
|
|
3665
3691
|
* Default values of the look of a diagram node.
|
|
3666
3692
|
* @private
|
|
@@ -3691,6 +3717,7 @@ const DIAGRAM_NODE_TYPE_DEFAULTS = {
|
|
|
3691
3717
|
defaultHeight: 1,
|
|
3692
3718
|
minWidth: 1,
|
|
3693
3719
|
minHeight: 1,
|
|
3720
|
+
defaultZ: 0,
|
|
3694
3721
|
resizableX: false,
|
|
3695
3722
|
resizableY: false,
|
|
3696
3723
|
snapToGridOffset: [0, 0, 0, 0],
|
|
@@ -3720,6 +3747,7 @@ class DiagramNodeType {
|
|
|
3720
3747
|
this.defaultHeight = values.defaultHeight;
|
|
3721
3748
|
this.minWidth = values.minWidth;
|
|
3722
3749
|
this.minHeight = values.minHeight;
|
|
3750
|
+
this.defaultZ = values.defaultZ;
|
|
3723
3751
|
if (typeof options.resizableX === 'undefined') {
|
|
3724
3752
|
this.resizerX = new DiagramResizer({
|
|
3725
3753
|
mode: exports.ResizableMode.Never
|
|
@@ -3771,12 +3799,12 @@ class DiagramNodeType {
|
|
|
3771
3799
|
*/
|
|
3772
3800
|
class DiagramNode extends DiagramElement {
|
|
3773
3801
|
get type() {
|
|
3774
|
-
return this
|
|
3802
|
+
return __classPrivateFieldGet(this, _DiagramNode_type, "f");
|
|
3775
3803
|
}
|
|
3776
3804
|
set type(type) {
|
|
3777
3805
|
var _a, _b;
|
|
3778
|
-
if (type !== this
|
|
3779
|
-
this
|
|
3806
|
+
if (type !== __classPrivateFieldGet(this, _DiagramNode_type, "f")) {
|
|
3807
|
+
__classPrivateFieldSet(this, _DiagramNode_type, type, "f");
|
|
3780
3808
|
if (this.valueSet) {
|
|
3781
3809
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
3782
3810
|
}
|
|
@@ -3869,6 +3897,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3869
3897
|
throw new Error(`DiagramNode cannot have an empty or null id`);
|
|
3870
3898
|
}
|
|
3871
3899
|
super(model, id);
|
|
3900
|
+
_DiagramNode_type.set(this, void 0);
|
|
3872
3901
|
/**
|
|
3873
3902
|
* Nodes contained within this node.
|
|
3874
3903
|
* @public
|
|
@@ -3894,12 +3923,13 @@ class DiagramNode extends DiagramElement {
|
|
|
3894
3923
|
* @public
|
|
3895
3924
|
*/
|
|
3896
3925
|
this.geometryTimestamp = null;
|
|
3897
|
-
this
|
|
3926
|
+
__classPrivateFieldSet(this, _DiagramNode_type, type, "f");
|
|
3898
3927
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
3899
3928
|
this.originalData = {};
|
|
3900
3929
|
this.coords = coords;
|
|
3901
3930
|
this.width = type.defaultWidth;
|
|
3902
3931
|
this.height = type.defaultHeight;
|
|
3932
|
+
this.z = type.defaultZ;
|
|
3903
3933
|
}
|
|
3904
3934
|
get removed() {
|
|
3905
3935
|
return this.selfRemoved;
|
|
@@ -3927,6 +3957,16 @@ class DiagramNode extends DiagramElement {
|
|
|
3927
3957
|
child.raise();
|
|
3928
3958
|
}
|
|
3929
3959
|
}
|
|
3960
|
+
/**
|
|
3961
|
+
* Put this element above other elements in the view if they have a lower z coordinate.
|
|
3962
|
+
*/
|
|
3963
|
+
raiseWithZ() {
|
|
3964
|
+
this.raise();
|
|
3965
|
+
const overlappingNodesWithHigherPriority = this.model.nodes.filter(n => n.id !== this.id && n.z > this.z && rectanglesIntersect([n.coords, [n.coords[0] + n.width, n.coords[1] + n.height]], [this.coords, [this.coords[0] + this.width, this.coords[1] + this.height]]));
|
|
3966
|
+
for (const n of overlappingNodesWithHigherPriority) {
|
|
3967
|
+
n.raiseWithZ();
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3930
3970
|
getPriority() {
|
|
3931
3971
|
return this.type.priority;
|
|
3932
3972
|
}
|
|
@@ -4230,6 +4270,7 @@ class DiagramNode extends DiagramElement {
|
|
|
4230
4270
|
}
|
|
4231
4271
|
this.setGeometry({
|
|
4232
4272
|
coords,
|
|
4273
|
+
z: this.z,
|
|
4233
4274
|
width: this.width,
|
|
4234
4275
|
height: this.height,
|
|
4235
4276
|
// We already moved the sections above - skip changing them in setDimensions.
|
|
@@ -4281,6 +4322,7 @@ class DiagramNode extends DiagramElement {
|
|
|
4281
4322
|
}
|
|
4282
4323
|
this.setGeometry({
|
|
4283
4324
|
coords: [newCoordsX[0], newCoordsY[0]],
|
|
4325
|
+
z: this.z,
|
|
4284
4326
|
width: newCoordsX[1] - newCoordsX[0],
|
|
4285
4327
|
height: newCoordsY[1] - newCoordsY[0],
|
|
4286
4328
|
// we ignore this.sections, the stretching of a node with sections is handled in the stretchSections method
|
|
@@ -4388,6 +4430,7 @@ class DiagramNode extends DiagramElement {
|
|
|
4388
4430
|
}
|
|
4389
4431
|
return {
|
|
4390
4432
|
coords: [...this.coords],
|
|
4433
|
+
z: this.z,
|
|
4391
4434
|
width: this.width,
|
|
4392
4435
|
height: this.height,
|
|
4393
4436
|
sections,
|
|
@@ -4404,6 +4447,7 @@ class DiagramNode extends DiagramElement {
|
|
|
4404
4447
|
const oldCoordsX = [this.coords[0], this.coords[0] + this.width];
|
|
4405
4448
|
const oldCoordsY = [this.coords[1], this.coords[1] + this.height];
|
|
4406
4449
|
this.coords = [...geometry.coords];
|
|
4450
|
+
this.z = geometry.z;
|
|
4407
4451
|
this.width = geometry.width;
|
|
4408
4452
|
this.height = geometry.height;
|
|
4409
4453
|
const newCoordsX = [this.coords[0], this.coords[0] + this.width];
|
|
@@ -4544,6 +4588,7 @@ class DiagramNode extends DiagramElement {
|
|
|
4544
4588
|
this.stretch(exports.Side.Bottom, margin + rowHeight);
|
|
4545
4589
|
}
|
|
4546
4590
|
}
|
|
4591
|
+
_DiagramNode_type = new WeakMap();
|
|
4547
4592
|
class DiagramNodeSet extends DiagramElementSet {
|
|
4548
4593
|
/**
|
|
4549
4594
|
* Instance a set of nodes for the given model. This method is used internally.
|
|
@@ -4551,12 +4596,13 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4551
4596
|
*/
|
|
4552
4597
|
constructor(model) {
|
|
4553
4598
|
super();
|
|
4599
|
+
_DiagramNodeSet_model.set(this, void 0);
|
|
4554
4600
|
/**
|
|
4555
4601
|
* Set of the possible types of node that the nodes of this set can have.
|
|
4556
4602
|
* @public
|
|
4557
4603
|
*/
|
|
4558
4604
|
this.types = new DiagramEntitySet();
|
|
4559
|
-
this
|
|
4605
|
+
__classPrivateFieldSet(this, _DiagramNodeSet_model, model, "f");
|
|
4560
4606
|
}
|
|
4561
4607
|
/**
|
|
4562
4608
|
* Instance a new node and add it to this set.
|
|
@@ -4578,7 +4624,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4578
4624
|
}
|
|
4579
4625
|
nodeType = foundNodeType;
|
|
4580
4626
|
}
|
|
4581
|
-
const node = new DiagramNode(this
|
|
4627
|
+
const node = new DiagramNode(__classPrivateFieldGet(this, _DiagramNodeSet_model, "f"), nodeType, coords, id);
|
|
4582
4628
|
super.add(node);
|
|
4583
4629
|
node.updateInView();
|
|
4584
4630
|
// add node sections
|
|
@@ -4588,7 +4634,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4588
4634
|
for (let j = 0; j < nodeType.sectionGrid.sections.length; ++j) {
|
|
4589
4635
|
let widthAccumulator = node.coords[0] + (nodeType.sectionGrid.margin || 0);
|
|
4590
4636
|
for (let i = 0; i < nodeType.sectionGrid.sections[j].length; ++i) {
|
|
4591
|
-
this.
|
|
4637
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").sections.new(node, i, j, [widthAccumulator, heightAccumulator], ((_a = nodeType.sectionGrid.defaultWidths) === null || _a === void 0 ? void 0 : _a[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH, ((_b = nodeType.sectionGrid.defaultHeights) === null || _b === void 0 ? void 0 : _b[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT, `${node.id}_${j}_${i}`);
|
|
4592
4638
|
widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c === void 0 ? void 0 : _c[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH) + (nodeType.sectionGrid.margin || 0);
|
|
4593
4639
|
}
|
|
4594
4640
|
heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d === void 0 ? void 0 : _d[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT) + (nodeType.sectionGrid.margin || 0);
|
|
@@ -4598,8 +4644,8 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4598
4644
|
if (nodeType.ports.length > 0) {
|
|
4599
4645
|
for (let i = 0; i < nodeType.ports.length; ++i) {
|
|
4600
4646
|
const portConfig = nodeType.ports[i];
|
|
4601
|
-
const portType = portConfig.type !== undefined ? this.
|
|
4602
|
-
const port = this.
|
|
4647
|
+
const portType = portConfig.type !== undefined ? __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").ports.types.get(portConfig.type) : undefined;
|
|
4648
|
+
const port = __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").ports.new(portType, node, [node.coords[0] + portConfig.coords[0], node.coords[1] + portConfig.coords[1]], portConfig.connectionPoint !== undefined ? [node.coords[0] + (portConfig.connectionPoint[0] || 0), node.coords[1] + (portConfig.connectionPoint[1] || 0)] : undefined, portConfig.direction, `${node.id}_port_${i}`, portConfig.anchorPointX || 'floating', portConfig.anchorPointY || 'floating');
|
|
4603
4649
|
if ((_e = port.type) === null || _e === void 0 ? void 0 : _e.label) {
|
|
4604
4650
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === void 0 ? void 0 : _f.label);
|
|
4605
4651
|
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
@@ -4618,7 +4664,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4618
4664
|
default:
|
|
4619
4665
|
labelCoords = port.coords;
|
|
4620
4666
|
}
|
|
4621
|
-
this.
|
|
4667
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").fields.new(port, labelCoords, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
|
|
4622
4668
|
}
|
|
4623
4669
|
}
|
|
4624
4670
|
}
|
|
@@ -4626,13 +4672,13 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4626
4672
|
if (nodeType.label) {
|
|
4627
4673
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), nodeType.label);
|
|
4628
4674
|
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
4629
|
-
this.
|
|
4675
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").fields.new(node, [node.coords[0] + getLeftMargin(labelConfiguration), node.coords[1] + getTopMargin(labelConfiguration)], node.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), node.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, labelConfiguration.look, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
|
|
4630
4676
|
}
|
|
4631
4677
|
// add node decorators
|
|
4632
4678
|
if (nodeType.decorators.length > 0) {
|
|
4633
4679
|
for (let i = 0; i < nodeType.decorators.length; ++i) {
|
|
4634
4680
|
const decoratorConfig = nodeType.decorators[i];
|
|
4635
|
-
this.
|
|
4681
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").decorators.new(node, [node.coords[0] + decoratorConfig.coords[0], node.coords[1] + decoratorConfig.coords[1]], decoratorConfig.width, decoratorConfig.height, node.getPriority(), decoratorConfig.svg, `${node.id}_decorator_${i}`, decoratorConfig.anchorPointX || 'floating', decoratorConfig.anchorPointY || 'floating');
|
|
4636
4682
|
}
|
|
4637
4683
|
}
|
|
4638
4684
|
node.valueSet.resetValues();
|
|
@@ -4648,23 +4694,23 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4648
4694
|
}
|
|
4649
4695
|
// remove all children
|
|
4650
4696
|
while (node.children.length > 0) {
|
|
4651
|
-
this.
|
|
4697
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").nodes.remove(node.children[0].id);
|
|
4652
4698
|
}
|
|
4653
4699
|
// remove all sections
|
|
4654
4700
|
while (node.sections.length > 0) {
|
|
4655
|
-
this.
|
|
4701
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").sections.remove(node.sections[0].id);
|
|
4656
4702
|
}
|
|
4657
4703
|
// remove all ports
|
|
4658
4704
|
while (node.ports.length > 0) {
|
|
4659
|
-
this.
|
|
4705
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").ports.remove(node.ports[0].id);
|
|
4660
4706
|
}
|
|
4661
4707
|
// remove all decorators
|
|
4662
4708
|
while (node.decorators.length > 0) {
|
|
4663
|
-
this.
|
|
4709
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").decorators.remove(node.decorators[0].id);
|
|
4664
4710
|
}
|
|
4665
4711
|
// remove label
|
|
4666
4712
|
if (node.label) {
|
|
4667
|
-
this.
|
|
4713
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").fields.remove(node.label.id);
|
|
4668
4714
|
}
|
|
4669
4715
|
// remove from set of nodes
|
|
4670
4716
|
super.remove(id);
|
|
@@ -4689,6 +4735,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4689
4735
|
return nodesAtLocation;
|
|
4690
4736
|
}
|
|
4691
4737
|
}
|
|
4738
|
+
_DiagramNodeSet_model = new WeakMap();
|
|
4692
4739
|
/**
|
|
4693
4740
|
* Removes any nodes from the given list which are a descendant of another node in the list.
|
|
4694
4741
|
* @param nodes A list of nodes.
|
|
@@ -4796,6 +4843,7 @@ const getTopPadding = config => {
|
|
|
4796
4843
|
}
|
|
4797
4844
|
};
|
|
4798
4845
|
|
|
4846
|
+
var _DiagramDecoratorSet_model;
|
|
4799
4847
|
/**
|
|
4800
4848
|
* A foreign object which is inserted with arbitrary SVG code into a diagram.
|
|
4801
4849
|
* Similar to a diagram object, but it's part of a node or section and it moves and stretches as its geometry changes.
|
|
@@ -4854,7 +4902,8 @@ class DiagramDecoratorSet extends DiagramElementSet {
|
|
|
4854
4902
|
*/
|
|
4855
4903
|
constructor(model) {
|
|
4856
4904
|
super();
|
|
4857
|
-
this
|
|
4905
|
+
_DiagramDecoratorSet_model.set(this, void 0);
|
|
4906
|
+
__classPrivateFieldSet(this, _DiagramDecoratorSet_model, model, "f");
|
|
4858
4907
|
}
|
|
4859
4908
|
/**
|
|
4860
4909
|
* Instance a new decorator and add it to this set.
|
|
@@ -4868,7 +4917,7 @@ class DiagramDecoratorSet extends DiagramElementSet {
|
|
|
4868
4917
|
* @returns The instanced decorator.
|
|
4869
4918
|
*/
|
|
4870
4919
|
new(rootElement, coords, width, height, priority, svg, id, anchorPointX = 'floating', anchorPointY = 'floating') {
|
|
4871
|
-
const decorator = new DiagramDecorator(this
|
|
4920
|
+
const decorator = new DiagramDecorator(__classPrivateFieldGet(this, _DiagramDecoratorSet_model, "f"), rootElement, coords, width, height, priority, svg, id, anchorPointX, anchorPointY);
|
|
4872
4921
|
super.add(decorator);
|
|
4873
4922
|
decorator.updateInView();
|
|
4874
4923
|
// add this port to its root element
|
|
@@ -4891,7 +4940,9 @@ class DiagramDecoratorSet extends DiagramElementSet {
|
|
|
4891
4940
|
}
|
|
4892
4941
|
}
|
|
4893
4942
|
}
|
|
4943
|
+
_DiagramDecoratorSet_model = new WeakMap();
|
|
4894
4944
|
|
|
4945
|
+
var _DiagramObjectSet_model;
|
|
4895
4946
|
/**
|
|
4896
4947
|
* A foreign object which is inserted with arbitrary SVG code into a diagram.
|
|
4897
4948
|
* Diagram objects are not serialized with other diagram elements.
|
|
@@ -4943,7 +4994,8 @@ class DiagramObjectSet extends DiagramElementSet {
|
|
|
4943
4994
|
*/
|
|
4944
4995
|
constructor(model) {
|
|
4945
4996
|
super();
|
|
4946
|
-
this
|
|
4997
|
+
_DiagramObjectSet_model.set(this, void 0);
|
|
4998
|
+
__classPrivateFieldSet(this, _DiagramObjectSet_model, model, "f");
|
|
4947
4999
|
}
|
|
4948
5000
|
/**
|
|
4949
5001
|
* Instance a new object and add it to this set.
|
|
@@ -4957,7 +5009,7 @@ class DiagramObjectSet extends DiagramElementSet {
|
|
|
4957
5009
|
* @returns The instanced object.
|
|
4958
5010
|
*/
|
|
4959
5011
|
new(coords, width, height, priority, svg, id) {
|
|
4960
|
-
const object = new DiagramObject(this
|
|
5012
|
+
const object = new DiagramObject(__classPrivateFieldGet(this, _DiagramObjectSet_model, "f"), coords, width, height, priority, svg, id);
|
|
4961
5013
|
super.add(object);
|
|
4962
5014
|
object.updateInView();
|
|
4963
5015
|
return object;
|
|
@@ -4972,7 +5024,9 @@ class DiagramObjectSet extends DiagramElementSet {
|
|
|
4972
5024
|
}
|
|
4973
5025
|
}
|
|
4974
5026
|
}
|
|
5027
|
+
_DiagramObjectSet_model = new WeakMap();
|
|
4975
5028
|
|
|
5029
|
+
var _DiagramPort_type, _DiagramPortSet_model;
|
|
4976
5030
|
/**
|
|
4977
5031
|
* Default values of the look of a diagram port.
|
|
4978
5032
|
* @private
|
|
@@ -5035,11 +5089,11 @@ class DiagramPortType {
|
|
|
5035
5089
|
*/
|
|
5036
5090
|
class DiagramPort extends DiagramElement {
|
|
5037
5091
|
get type() {
|
|
5038
|
-
return this
|
|
5092
|
+
return __classPrivateFieldGet(this, _DiagramPort_type, "f");
|
|
5039
5093
|
}
|
|
5040
5094
|
set type(type) {
|
|
5041
|
-
if (type !== this
|
|
5042
|
-
this
|
|
5095
|
+
if (type !== __classPrivateFieldGet(this, _DiagramPort_type, "f")) {
|
|
5096
|
+
__classPrivateFieldSet(this, _DiagramPort_type, type, "f");
|
|
5043
5097
|
this.updateInView();
|
|
5044
5098
|
}
|
|
5045
5099
|
}
|
|
@@ -5164,6 +5218,7 @@ class DiagramPort extends DiagramElement {
|
|
|
5164
5218
|
throw new Error(`DiagramPort cannot have an empty or null id`);
|
|
5165
5219
|
}
|
|
5166
5220
|
super(model, id);
|
|
5221
|
+
_DiagramPort_type.set(this, void 0);
|
|
5167
5222
|
/**
|
|
5168
5223
|
* Connections that start at this port.
|
|
5169
5224
|
* @public
|
|
@@ -5174,7 +5229,7 @@ class DiagramPort extends DiagramElement {
|
|
|
5174
5229
|
* @public
|
|
5175
5230
|
*/
|
|
5176
5231
|
this.incomingConnections = [];
|
|
5177
|
-
this
|
|
5232
|
+
__classPrivateFieldSet(this, _DiagramPort_type, type, "f");
|
|
5178
5233
|
this.rootElement = rootElement;
|
|
5179
5234
|
this.coords = coords;
|
|
5180
5235
|
this.connectionPoint = connectionPoint || coords;
|
|
@@ -5262,6 +5317,7 @@ class DiagramPort extends DiagramElement {
|
|
|
5262
5317
|
return distanceBetweenPoints(this.coords, coords);
|
|
5263
5318
|
}
|
|
5264
5319
|
}
|
|
5320
|
+
_DiagramPort_type = new WeakMap();
|
|
5265
5321
|
class DiagramPortSet extends DiagramElementSet {
|
|
5266
5322
|
/**
|
|
5267
5323
|
* Instance a set of ports for the given model. This method is used internally.
|
|
@@ -5269,19 +5325,20 @@ class DiagramPortSet extends DiagramElementSet {
|
|
|
5269
5325
|
*/
|
|
5270
5326
|
constructor(model) {
|
|
5271
5327
|
super();
|
|
5328
|
+
_DiagramPortSet_model.set(this, void 0);
|
|
5272
5329
|
/**
|
|
5273
5330
|
* Set of the possible types of port that the ports of this set can have.
|
|
5274
5331
|
* @public
|
|
5275
5332
|
*/
|
|
5276
5333
|
this.types = new DiagramEntitySet();
|
|
5277
|
-
this
|
|
5334
|
+
__classPrivateFieldSet(this, _DiagramPortSet_model, model, "f");
|
|
5278
5335
|
}
|
|
5279
5336
|
/**
|
|
5280
5337
|
* Instance a new port and add it to this set. This method is normally called when instancing an element with a port and it is rarely called by itself.
|
|
5281
5338
|
* @private
|
|
5282
5339
|
*/
|
|
5283
5340
|
new(type, rootElement, coords, connectionPoint, direction, id, anchorPointX = 'floating', anchorPointY = 'floating') {
|
|
5284
|
-
const port = new DiagramPort(this
|
|
5341
|
+
const port = new DiagramPort(__classPrivateFieldGet(this, _DiagramPortSet_model, "f"), type, rootElement, coords, connectionPoint, direction, id, anchorPointX, anchorPointY);
|
|
5285
5342
|
super.add(port);
|
|
5286
5343
|
port.updateInView();
|
|
5287
5344
|
// add this port to its root element
|
|
@@ -5295,14 +5352,14 @@ class DiagramPortSet extends DiagramElementSet {
|
|
|
5295
5352
|
if (port) {
|
|
5296
5353
|
// remove all connections
|
|
5297
5354
|
while (port.outgoingConnections.length > 0) {
|
|
5298
|
-
this.
|
|
5355
|
+
__classPrivateFieldGet(this, _DiagramPortSet_model, "f").connections.remove(port.outgoingConnections[0].id);
|
|
5299
5356
|
}
|
|
5300
5357
|
while (port.incomingConnections.length > 0) {
|
|
5301
|
-
this.
|
|
5358
|
+
__classPrivateFieldGet(this, _DiagramPortSet_model, "f").connections.remove(port.incomingConnections[0].id);
|
|
5302
5359
|
}
|
|
5303
5360
|
// remove label
|
|
5304
5361
|
if (port.label) {
|
|
5305
|
-
this.
|
|
5362
|
+
__classPrivateFieldGet(this, _DiagramPortSet_model, "f").fields.remove(port.label.id);
|
|
5306
5363
|
}
|
|
5307
5364
|
// remove from root element
|
|
5308
5365
|
if (port.rootElement instanceof DiagramNode || port.rootElement instanceof DiagramSection) {
|
|
@@ -5315,6 +5372,7 @@ class DiagramPortSet extends DiagramElementSet {
|
|
|
5315
5372
|
}
|
|
5316
5373
|
}
|
|
5317
5374
|
}
|
|
5375
|
+
_DiagramPortSet_model = new WeakMap();
|
|
5318
5376
|
|
|
5319
5377
|
/**
|
|
5320
5378
|
* Importer which imports a diagram from its daga model representation.
|
|
@@ -5551,6 +5609,7 @@ class DagaImporter {
|
|
|
5551
5609
|
}
|
|
5552
5610
|
}
|
|
5553
5611
|
|
|
5612
|
+
var _SetSelfRemovedCollabAction_instances, _SetSelfRemovedCollabAction_doOne;
|
|
5554
5613
|
/**
|
|
5555
5614
|
* Collaborative action which consists of adding a node.
|
|
5556
5615
|
* @private
|
|
@@ -5580,6 +5639,7 @@ class AddNodeCollabAction {
|
|
|
5580
5639
|
} else {
|
|
5581
5640
|
node.valueSet.resetValues();
|
|
5582
5641
|
}
|
|
5642
|
+
node.raiseWithZ();
|
|
5583
5643
|
}
|
|
5584
5644
|
serialize() {
|
|
5585
5645
|
return {
|
|
@@ -5738,6 +5798,7 @@ class SetGeometryCollabAction {
|
|
|
5738
5798
|
}
|
|
5739
5799
|
}
|
|
5740
5800
|
(_c = node.parent) === null || _c === void 0 ? void 0 : _c.fitToChild(node);
|
|
5801
|
+
node.raiseWithZ();
|
|
5741
5802
|
node.geometryTimestamp = this.timestamp;
|
|
5742
5803
|
}
|
|
5743
5804
|
}
|
|
@@ -5902,6 +5963,7 @@ class UpdateValuesCollabAction {
|
|
|
5902
5963
|
*/
|
|
5903
5964
|
class SetSelfRemovedCollabAction {
|
|
5904
5965
|
constructor(canvas, nodeIds, sectionIds, portIds, connectionIds, fieldIds, selfRemoved, timestamp) {
|
|
5966
|
+
_SetSelfRemovedCollabAction_instances.add(this);
|
|
5905
5967
|
this.canvas = canvas;
|
|
5906
5968
|
this.nodeIds = nodeIds;
|
|
5907
5969
|
this.sectionIds = sectionIds;
|
|
@@ -5911,27 +5973,21 @@ class SetSelfRemovedCollabAction {
|
|
|
5911
5973
|
this.selfRemoved = selfRemoved;
|
|
5912
5974
|
this.timestamp = timestamp;
|
|
5913
5975
|
}
|
|
5914
|
-
doOne(elt) {
|
|
5915
|
-
if (elt && timestampWins(this.timestamp, elt.selfRemovedTimestamp)) {
|
|
5916
|
-
elt.selfRemoved = this.selfRemoved;
|
|
5917
|
-
elt.selfRemovedTimestamp = this.timestamp;
|
|
5918
|
-
}
|
|
5919
|
-
}
|
|
5920
5976
|
do() {
|
|
5921
5977
|
for (const nodeId of this.nodeIds) {
|
|
5922
|
-
this.
|
|
5978
|
+
__classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.nodes.get(nodeId, true));
|
|
5923
5979
|
}
|
|
5924
5980
|
for (const sectionId of this.sectionIds) {
|
|
5925
|
-
this.
|
|
5981
|
+
__classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.sections.get(sectionId, true));
|
|
5926
5982
|
}
|
|
5927
5983
|
for (const portId of this.portIds) {
|
|
5928
|
-
this.
|
|
5984
|
+
__classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.ports.get(portId, true));
|
|
5929
5985
|
}
|
|
5930
5986
|
for (const connectionId of this.connectionIds) {
|
|
5931
|
-
this.
|
|
5987
|
+
__classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.connections.get(connectionId, true));
|
|
5932
5988
|
}
|
|
5933
5989
|
for (const fieldId of this.fieldIds) {
|
|
5934
|
-
this.
|
|
5990
|
+
__classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.fields.get(fieldId, true));
|
|
5935
5991
|
}
|
|
5936
5992
|
// update view
|
|
5937
5993
|
this.canvas.updateNodesInView(...this.nodeIds);
|
|
@@ -5958,6 +6014,12 @@ class SetSelfRemovedCollabAction {
|
|
|
5958
6014
|
return new SetSelfRemovedCollabAction(canvas, serialized.nodeIds, serialized.sectionIds, serialized.portIds, serialized.connectionIds, serialized.fieldIds, serialized.removed, serialized.timestamp);
|
|
5959
6015
|
}
|
|
5960
6016
|
}
|
|
6017
|
+
_SetSelfRemovedCollabAction_instances = new WeakSet(), _SetSelfRemovedCollabAction_doOne = function _SetSelfRemovedCollabAction_doOne(elt) {
|
|
6018
|
+
if (elt && timestampWins(this.timestamp, elt.selfRemovedTimestamp)) {
|
|
6019
|
+
elt.selfRemoved = this.selfRemoved;
|
|
6020
|
+
elt.selfRemovedTimestamp = this.timestamp;
|
|
6021
|
+
}
|
|
6022
|
+
};
|
|
5961
6023
|
/**
|
|
5962
6024
|
* Collaborative action which consists of pasting elements from an external source into a diagram.
|
|
5963
6025
|
*
|
|
@@ -6129,13 +6191,19 @@ class CollabEngine {
|
|
|
6129
6191
|
}
|
|
6130
6192
|
}
|
|
6131
6193
|
|
|
6194
|
+
var _ActionStack_canvas;
|
|
6132
6195
|
/**
|
|
6133
6196
|
* A stack of recent actions taken by the user.
|
|
6134
6197
|
* @private
|
|
6135
6198
|
*/
|
|
6136
6199
|
class ActionStack {
|
|
6137
6200
|
constructor(canvas, maximum) {
|
|
6138
|
-
|
|
6201
|
+
/**
|
|
6202
|
+
* Canvas that this action stack belongs to.
|
|
6203
|
+
* @private
|
|
6204
|
+
*/
|
|
6205
|
+
_ActionStack_canvas.set(this, void 0);
|
|
6206
|
+
__classPrivateFieldSet(this, _ActionStack_canvas, canvas, "f");
|
|
6139
6207
|
this.maximum = maximum;
|
|
6140
6208
|
this.history = [];
|
|
6141
6209
|
this.index = 0;
|
|
@@ -6155,7 +6223,7 @@ class ActionStack {
|
|
|
6155
6223
|
this.history.push(action);
|
|
6156
6224
|
++this.index;
|
|
6157
6225
|
}
|
|
6158
|
-
this.
|
|
6226
|
+
__classPrivateFieldGet(this, _ActionStack_canvas, "f").diagramChange$.next({
|
|
6159
6227
|
action,
|
|
6160
6228
|
method: exports.DiagramActionMethod.Do
|
|
6161
6229
|
});
|
|
@@ -6174,7 +6242,7 @@ class ActionStack {
|
|
|
6174
6242
|
hasEffect = action.undo();
|
|
6175
6243
|
} while (!hasEffect && this.index > 0);
|
|
6176
6244
|
}
|
|
6177
|
-
this.
|
|
6245
|
+
__classPrivateFieldGet(this, _ActionStack_canvas, "f").diagramChange$.next({
|
|
6178
6246
|
action,
|
|
6179
6247
|
method: exports.DiagramActionMethod.Undo
|
|
6180
6248
|
});
|
|
@@ -6193,12 +6261,13 @@ class ActionStack {
|
|
|
6193
6261
|
++this.index;
|
|
6194
6262
|
} while (!hasEffect && this.index < this.history.length);
|
|
6195
6263
|
}
|
|
6196
|
-
this.
|
|
6264
|
+
__classPrivateFieldGet(this, _ActionStack_canvas, "f").diagramChange$.next({
|
|
6197
6265
|
action,
|
|
6198
6266
|
method: exports.DiagramActionMethod.Redo
|
|
6199
6267
|
});
|
|
6200
6268
|
}
|
|
6201
6269
|
}
|
|
6270
|
+
_ActionStack_canvas = new WeakMap();
|
|
6202
6271
|
/**
|
|
6203
6272
|
* The different methods of an action.
|
|
6204
6273
|
* @private
|
|
@@ -6968,14 +7037,28 @@ class DiagramModel {
|
|
|
6968
7037
|
}
|
|
6969
7038
|
|
|
6970
7039
|
/**
|
|
6971
|
-
* Checks if the given
|
|
7040
|
+
* Checks if the given pointer event was produced with a secondary button press.
|
|
6972
7041
|
* @private
|
|
6973
|
-
* @param event A
|
|
6974
|
-
* @returns `true` if the given
|
|
7042
|
+
* @param event A pointer event.
|
|
7043
|
+
* @returns `true` if the given pointer event was produced with a secondary button press, `false` otherwise.
|
|
6975
7044
|
*/
|
|
6976
7045
|
const isSecondaryButton = event => {
|
|
6977
7046
|
return !!event.button;
|
|
6978
7047
|
};
|
|
7048
|
+
/**
|
|
7049
|
+
* Obtain the pointer event which is valid for passing to the `d3.pointer()` function.
|
|
7050
|
+
* @param event A pointer event.
|
|
7051
|
+
* @returns A pointer event which can be passed to the `d3.pointer()` function.
|
|
7052
|
+
*/
|
|
7053
|
+
const getEventHoldingCoordinates = event => {
|
|
7054
|
+
if (event.type === 'drag' || event.type === 'start' || event.type === 'end') {
|
|
7055
|
+
const sourceEvent = event.sourceEvent;
|
|
7056
|
+
if (sourceEvent && (sourceEvent.type === 'touchmove' || sourceEvent.type === 'touchstart' || sourceEvent.type === 'touchend')) {
|
|
7057
|
+
return sourceEvent.touches[0] || sourceEvent.changedTouches[0];
|
|
7058
|
+
}
|
|
7059
|
+
}
|
|
7060
|
+
return event;
|
|
7061
|
+
};
|
|
6979
7062
|
/**
|
|
6980
7063
|
* Get the SVG path of a diagram connection.
|
|
6981
7064
|
* @private
|
|
@@ -7182,6 +7265,7 @@ const getGridSpacingY = gridConfig => {
|
|
|
7182
7265
|
return value;
|
|
7183
7266
|
};
|
|
7184
7267
|
|
|
7268
|
+
var _DiagramContextMenu_canvas, _DiagramContextMenu_config, _DiagramContextMenu_contextMenuContainer;
|
|
7185
7269
|
const CONTEXT_MENU_MENU_RADIUS = 96;
|
|
7186
7270
|
const CONTEXT_MENU_BUTTON_RADIUS = 32;
|
|
7187
7271
|
const CONTEXT_MENU_TOTAL_RADIUS = CONTEXT_MENU_MENU_RADIUS + CONTEXT_MENU_BUTTON_RADIUS;
|
|
@@ -7202,8 +7286,11 @@ class DiagramContextMenu {
|
|
|
7202
7286
|
* @param canvas A canvas.
|
|
7203
7287
|
*/
|
|
7204
7288
|
constructor(canvas, config) {
|
|
7205
|
-
this
|
|
7206
|
-
this
|
|
7289
|
+
_DiagramContextMenu_canvas.set(this, void 0);
|
|
7290
|
+
_DiagramContextMenu_config.set(this, void 0);
|
|
7291
|
+
_DiagramContextMenu_contextMenuContainer.set(this, void 0);
|
|
7292
|
+
__classPrivateFieldSet(this, _DiagramContextMenu_canvas, canvas, "f");
|
|
7293
|
+
__classPrivateFieldSet(this, _DiagramContextMenu_config, config || CONTEXT_MENU_DEFAULTS, "f");
|
|
7207
7294
|
}
|
|
7208
7295
|
/**
|
|
7209
7296
|
* Opens the context menu at the location determined by the given mouse event.
|
|
@@ -7212,11 +7299,11 @@ class DiagramContextMenu {
|
|
|
7212
7299
|
*/
|
|
7213
7300
|
open(event) {
|
|
7214
7301
|
this.close();
|
|
7215
|
-
const coordsRelativeToRoot = this.
|
|
7216
|
-
const coordsRelativeToCanvas = this.
|
|
7302
|
+
const coordsRelativeToRoot = __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").getPointerLocationRelativeToRoot(event);
|
|
7303
|
+
const coordsRelativeToCanvas = __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").getPointerLocationRelativeToCanvas(event);
|
|
7217
7304
|
// append to the root (svg) element so the context menu is not affected by zoom transforms on the canvas view
|
|
7218
|
-
const contextMenuContainer = this.
|
|
7219
|
-
if (this.
|
|
7305
|
+
const contextMenuContainer = __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").selectSVGElement().append('foreignObject').attr('class', 'daga-context-menu').attr('x', `${coordsRelativeToRoot[0] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('y', `${coordsRelativeToRoot[1] - CONTEXT_MENU_TOTAL_RADIUS}px`).attr('width', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).attr('height', `${2 * CONTEXT_MENU_TOTAL_RADIUS}px`).style('pointer-events', 'none').on(exports.Events.ContextMenu, newEvent => {
|
|
7306
|
+
if (__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.ContextMenu)) {
|
|
7220
7307
|
event.preventDefault();
|
|
7221
7308
|
this.open(newEvent);
|
|
7222
7309
|
}
|
|
@@ -7224,9 +7311,9 @@ class DiagramContextMenu {
|
|
|
7224
7311
|
event.preventDefault();
|
|
7225
7312
|
this.close();
|
|
7226
7313
|
});
|
|
7227
|
-
this
|
|
7314
|
+
__classPrivateFieldSet(this, _DiagramContextMenu_contextMenuContainer, contextMenuContainer, "f");
|
|
7228
7315
|
const buttons = [];
|
|
7229
|
-
if (!(this.
|
|
7316
|
+
if (!(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").userSelection.length === 0) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.Clipboard) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.Remove)) {
|
|
7230
7317
|
buttons.push({
|
|
7231
7318
|
name: 'CUT',
|
|
7232
7319
|
imageClass: 'daga-cut',
|
|
@@ -7236,7 +7323,7 @@ class DiagramContextMenu {
|
|
|
7236
7323
|
}
|
|
7237
7324
|
});
|
|
7238
7325
|
}
|
|
7239
|
-
if (!(this.
|
|
7326
|
+
if (!(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").userSelection.length === 0) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.Clipboard)) {
|
|
7240
7327
|
buttons.push({
|
|
7241
7328
|
name: 'COPY',
|
|
7242
7329
|
imageClass: 'daga-copy',
|
|
@@ -7246,7 +7333,7 @@ class DiagramContextMenu {
|
|
|
7246
7333
|
}
|
|
7247
7334
|
});
|
|
7248
7335
|
}
|
|
7249
|
-
if (this.
|
|
7336
|
+
if (__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.Paste)) {
|
|
7250
7337
|
buttons.push({
|
|
7251
7338
|
name: 'PASTE',
|
|
7252
7339
|
imageClass: 'daga-paste',
|
|
@@ -7256,7 +7343,7 @@ class DiagramContextMenu {
|
|
|
7256
7343
|
}
|
|
7257
7344
|
});
|
|
7258
7345
|
}
|
|
7259
|
-
if (!(this.
|
|
7346
|
+
if (!(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").userSelection.length === 0) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(exports.DiagramActions.Remove)) {
|
|
7260
7347
|
buttons.push({
|
|
7261
7348
|
name: 'DELETE',
|
|
7262
7349
|
imageClass: 'daga-delete',
|
|
@@ -7266,8 +7353,8 @@ class DiagramContextMenu {
|
|
|
7266
7353
|
}
|
|
7267
7354
|
});
|
|
7268
7355
|
}
|
|
7269
|
-
for (const customButton of this.
|
|
7270
|
-
if (customButton.condition !== undefined ? customButton.condition(this
|
|
7356
|
+
for (const customButton of __classPrivateFieldGet(this, _DiagramContextMenu_config, "f").customButtons || CONTEXT_MENU_DEFAULTS.customButtons) {
|
|
7357
|
+
if (customButton.condition !== undefined ? customButton.condition(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f")) : true) {
|
|
7271
7358
|
buttons.push(customButton);
|
|
7272
7359
|
}
|
|
7273
7360
|
}
|
|
@@ -7286,12 +7373,12 @@ class DiagramContextMenu {
|
|
|
7286
7373
|
const buttonContainer = contextMenuContainer.append('xhtml:div').attr('class', `daga-context-menu-button ${button.onPress !== undefined ? ' daga-clickable' : ''}`).attr('tabindex', 0).style('position', 'absolute').style('box-sizing', 'border-box').style('width', `${2 * CONTEXT_MENU_BUTTON_RADIUS}px`).style('height', `${2 * CONTEXT_MENU_BUTTON_RADIUS}px`).style('border-radius', `${CONTEXT_MENU_BUTTON_RADIUS}px`).style('pointer-events', 'auto').on(exports.Events.Click, event => {
|
|
7287
7374
|
if (buttonOnPress) {
|
|
7288
7375
|
event.preventDefault();
|
|
7289
|
-
buttonOnPress(this
|
|
7376
|
+
buttonOnPress(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f"));
|
|
7290
7377
|
}
|
|
7291
7378
|
}).on(exports.Events.KeyDown, event => {
|
|
7292
7379
|
if (buttonOnPress && event.key === exports.Keys.Enter) {
|
|
7293
7380
|
event.preventDefault();
|
|
7294
|
-
buttonOnPress(this
|
|
7381
|
+
buttonOnPress(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f"));
|
|
7295
7382
|
}
|
|
7296
7383
|
});
|
|
7297
7384
|
if (button.imageClass !== undefined) {
|
|
@@ -7314,11 +7401,13 @@ class DiagramContextMenu {
|
|
|
7314
7401
|
*/
|
|
7315
7402
|
close() {
|
|
7316
7403
|
var _a;
|
|
7317
|
-
(_a = this
|
|
7318
|
-
this
|
|
7404
|
+
(_a = __classPrivateFieldGet(this, _DiagramContextMenu_contextMenuContainer, "f")) === null || _a === void 0 ? void 0 : _a.remove();
|
|
7405
|
+
__classPrivateFieldSet(this, _DiagramContextMenu_contextMenuContainer, undefined, "f");
|
|
7319
7406
|
}
|
|
7320
7407
|
}
|
|
7408
|
+
_DiagramContextMenu_canvas = new WeakMap(), _DiagramContextMenu_config = new WeakMap(), _DiagramContextMenu_contextMenuContainer = new WeakMap();
|
|
7321
7409
|
|
|
7410
|
+
var _DiagramUserHighlight_canvas, _DiagramUserHighlight_focus, _DiagramUserHighlight_highlightSections;
|
|
7322
7411
|
/**
|
|
7323
7412
|
* Stores the functionality regarding the user highlight of a diagram canvas.
|
|
7324
7413
|
* @public
|
|
@@ -7332,9 +7421,14 @@ class DiagramUserHighlight extends DiagramElementSet {
|
|
|
7332
7421
|
*/
|
|
7333
7422
|
constructor(canvas, highlightSections = true) {
|
|
7334
7423
|
super();
|
|
7335
|
-
this
|
|
7336
|
-
this
|
|
7337
|
-
|
|
7424
|
+
_DiagramUserHighlight_canvas.set(this, void 0);
|
|
7425
|
+
_DiagramUserHighlight_focus.set(this, undefined);
|
|
7426
|
+
/**
|
|
7427
|
+
* Whether sections can be highlighted individually or the whole node must be highlighted when highlighting a section.
|
|
7428
|
+
*/
|
|
7429
|
+
_DiagramUserHighlight_highlightSections.set(this, void 0);
|
|
7430
|
+
__classPrivateFieldSet(this, _DiagramUserHighlight_canvas, canvas, "f");
|
|
7431
|
+
__classPrivateFieldSet(this, _DiagramUserHighlight_highlightSections, highlightSections, "f");
|
|
7338
7432
|
}
|
|
7339
7433
|
/**
|
|
7340
7434
|
* Gets the focus of the user highlight, which is the element where the current user highlight started regardless of which other elements were highlighted as a consequence.
|
|
@@ -7342,7 +7436,7 @@ class DiagramUserHighlight extends DiagramElementSet {
|
|
|
7342
7436
|
* @returns A diagram element.
|
|
7343
7437
|
*/
|
|
7344
7438
|
getFocus() {
|
|
7345
|
-
return this
|
|
7439
|
+
return __classPrivateFieldGet(this, _DiagramUserHighlight_focus, "f");
|
|
7346
7440
|
}
|
|
7347
7441
|
/**
|
|
7348
7442
|
* Unhighlights all highlighted elements and highlights the given element as the main element of the user highlight.
|
|
@@ -7350,7 +7444,7 @@ class DiagramUserHighlight extends DiagramElementSet {
|
|
|
7350
7444
|
*/
|
|
7351
7445
|
focusOn(element) {
|
|
7352
7446
|
this.clear();
|
|
7353
|
-
this
|
|
7447
|
+
__classPrivateFieldSet(this, _DiagramUserHighlight_focus, element, "f");
|
|
7354
7448
|
if ((element instanceof DiagramField || element instanceof DiagramDecorator) && element.rootElement) {
|
|
7355
7449
|
this.focusOn(element.rootElement);
|
|
7356
7450
|
} else {
|
|
@@ -7360,51 +7454,51 @@ class DiagramUserHighlight extends DiagramElementSet {
|
|
|
7360
7454
|
add(element) {
|
|
7361
7455
|
super.add(element);
|
|
7362
7456
|
if (element instanceof DiagramNode) {
|
|
7363
|
-
if (!this
|
|
7457
|
+
if (!__classPrivateFieldGet(this, _DiagramUserHighlight_highlightSections, "f")) {
|
|
7364
7458
|
for (const section of element.sections) {
|
|
7365
7459
|
super.add(section);
|
|
7366
7460
|
for (const port of section.ports) {
|
|
7367
7461
|
super.add(port);
|
|
7368
|
-
this.
|
|
7462
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(port.id);
|
|
7369
7463
|
}
|
|
7370
7464
|
if (section.label) {
|
|
7371
7465
|
super.add(section.label);
|
|
7372
|
-
this.
|
|
7466
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(section.label.id);
|
|
7373
7467
|
}
|
|
7374
|
-
this.
|
|
7468
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateSectionsInView(section.id);
|
|
7375
7469
|
}
|
|
7376
7470
|
}
|
|
7377
7471
|
for (const port of element.ports) {
|
|
7378
7472
|
super.add(port);
|
|
7379
|
-
this.
|
|
7473
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(port.id);
|
|
7380
7474
|
}
|
|
7381
7475
|
if (element.label) {
|
|
7382
7476
|
super.add(element.label);
|
|
7383
|
-
this.
|
|
7477
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(element.label.id);
|
|
7384
7478
|
}
|
|
7385
|
-
this.
|
|
7479
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateNodesInView(element.id);
|
|
7386
7480
|
} else if (element instanceof DiagramSection) {
|
|
7387
|
-
if (!this
|
|
7481
|
+
if (!__classPrivateFieldGet(this, _DiagramUserHighlight_highlightSections, "f") && element.node) {
|
|
7388
7482
|
this.add(element.node);
|
|
7389
7483
|
} else {
|
|
7390
7484
|
for (const port of element.ports) {
|
|
7391
7485
|
super.add(port);
|
|
7392
|
-
this.
|
|
7486
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(port.id);
|
|
7393
7487
|
}
|
|
7394
7488
|
if (element.label) {
|
|
7395
7489
|
super.add(element.label);
|
|
7396
|
-
this.
|
|
7490
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(element.label.id);
|
|
7397
7491
|
}
|
|
7398
|
-
this.
|
|
7492
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateSectionsInView(element.id);
|
|
7399
7493
|
}
|
|
7400
7494
|
} else if (element instanceof DiagramPort) {
|
|
7401
7495
|
if (element.label) {
|
|
7402
7496
|
super.add(element.label);
|
|
7403
|
-
this.
|
|
7497
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(element.label.id);
|
|
7404
7498
|
}
|
|
7405
|
-
this.
|
|
7499
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(element.id);
|
|
7406
7500
|
} else if (element instanceof DiagramConnection) {
|
|
7407
|
-
this.
|
|
7501
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateConnectionsInView(element.id);
|
|
7408
7502
|
}
|
|
7409
7503
|
}
|
|
7410
7504
|
clear() {
|
|
@@ -7413,9 +7507,10 @@ class DiagramUserHighlight extends DiagramElementSet {
|
|
|
7413
7507
|
this.remove(entity.id);
|
|
7414
7508
|
entity.updateInView();
|
|
7415
7509
|
}
|
|
7416
|
-
this
|
|
7510
|
+
__classPrivateFieldSet(this, _DiagramUserHighlight_focus, undefined, "f");
|
|
7417
7511
|
}
|
|
7418
7512
|
}
|
|
7513
|
+
_DiagramUserHighlight_canvas = new WeakMap(), _DiagramUserHighlight_focus = new WeakMap(), _DiagramUserHighlight_highlightSections = new WeakMap();
|
|
7419
7514
|
|
|
7420
7515
|
const DAGA_FILE_VERSION = 1;
|
|
7421
7516
|
|
|
@@ -7627,6 +7722,7 @@ class DagaExporter {
|
|
|
7627
7722
|
}
|
|
7628
7723
|
}
|
|
7629
7724
|
|
|
7725
|
+
var _DiagramUserSelection_instances, _DiagramUserSelection_canvas, _DiagramUserSelection_diagramPropertiesText, _DiagramUserSelection_propertyEditorSelection, _DiagramUserSelection_propertyEditorValues, _DiagramUserSelection_makeUpdateValuesAction;
|
|
7630
7726
|
/**
|
|
7631
7727
|
* Text to display by default as the title of the property editor when editing the properties of a diagram's value set.
|
|
7632
7728
|
* @private
|
|
@@ -7647,12 +7743,17 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7647
7743
|
*/
|
|
7648
7744
|
constructor(canvas, diagramPropertiesText) {
|
|
7649
7745
|
super();
|
|
7650
|
-
this
|
|
7746
|
+
_DiagramUserSelection_instances.add(this);
|
|
7747
|
+
_DiagramUserSelection_canvas.set(this, void 0);
|
|
7748
|
+
_DiagramUserSelection_diagramPropertiesText.set(this, void 0);
|
|
7749
|
+
_DiagramUserSelection_propertyEditorSelection.set(this, void 0);
|
|
7750
|
+
_DiagramUserSelection_propertyEditorValues.set(this, void 0);
|
|
7751
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_canvas, canvas, "f");
|
|
7651
7752
|
// TODO: would be a good idea to be able to configure how often this fires, or whether at all
|
|
7652
|
-
this.
|
|
7653
|
-
this.
|
|
7753
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").propertyEditorChanges$.pipe(rxjs.debounceTime(2000)).subscribe(() => {
|
|
7754
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_instances, "m", _DiagramUserSelection_makeUpdateValuesAction).call(this);
|
|
7654
7755
|
});
|
|
7655
|
-
this
|
|
7756
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_diagramPropertiesText, diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT, "f");
|
|
7656
7757
|
}
|
|
7657
7758
|
add(element) {
|
|
7658
7759
|
if (this.contains(element.id)) {
|
|
@@ -7661,9 +7762,9 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7661
7762
|
}
|
|
7662
7763
|
if (this.length === 0) {
|
|
7663
7764
|
// if there is nothing else selected, open our selection in the property editor
|
|
7664
|
-
if (this
|
|
7765
|
+
if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === undefined && (element instanceof DiagramNode || element instanceof DiagramConnection)) {
|
|
7665
7766
|
this.openInPropertyEditor(element);
|
|
7666
|
-
} else if (this
|
|
7767
|
+
} else if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === undefined && element instanceof DiagramSection) {
|
|
7667
7768
|
this.openInPropertyEditor(element.node);
|
|
7668
7769
|
} else {
|
|
7669
7770
|
this.openInPropertyEditor(undefined);
|
|
@@ -7685,7 +7786,7 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7685
7786
|
remove(id) {
|
|
7686
7787
|
const element = this.get(id);
|
|
7687
7788
|
if (element) {
|
|
7688
|
-
if (this
|
|
7789
|
+
if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === element) {
|
|
7689
7790
|
this.openInPropertyEditor(undefined);
|
|
7690
7791
|
}
|
|
7691
7792
|
super.remove(id);
|
|
@@ -7756,9 +7857,9 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7756
7857
|
fieldIdsToBeDeleted.push(userSelectionElement.id);
|
|
7757
7858
|
}
|
|
7758
7859
|
}
|
|
7759
|
-
const removeAction = new RemoveAction(this
|
|
7860
|
+
const removeAction = new RemoveAction(__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f"), nodeIdsToBeDeleted, sectionIdsToBeDeleted, portIdsToBeDeleted, connectionIdsToBeDeleted, fieldIdsToBeDeleted);
|
|
7760
7861
|
removeAction.do();
|
|
7761
|
-
this.
|
|
7862
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").actionStack.add(removeAction);
|
|
7762
7863
|
}
|
|
7763
7864
|
}
|
|
7764
7865
|
/**
|
|
@@ -7801,8 +7902,8 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7801
7902
|
if (userSelection.type !== 'daga-user-selection') {
|
|
7802
7903
|
return;
|
|
7803
7904
|
}
|
|
7804
|
-
const action = new PasteAction(this
|
|
7805
|
-
this.
|
|
7905
|
+
const action = new PasteAction(__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f"), userSelection.nodes, userSelection.connections, coords);
|
|
7906
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").actionStack.add(action);
|
|
7806
7907
|
action.do();
|
|
7807
7908
|
} catch (_a) {
|
|
7808
7909
|
return;
|
|
@@ -7820,17 +7921,17 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7820
7921
|
openInPropertyEditor(selection, makeUpdateValuesAction = true) {
|
|
7821
7922
|
var _a;
|
|
7822
7923
|
if (makeUpdateValuesAction) {
|
|
7823
|
-
this.
|
|
7924
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_instances, "m", _DiagramUserSelection_makeUpdateValuesAction).call(this);
|
|
7824
7925
|
}
|
|
7825
|
-
const propertyEditor = (_a = this.
|
|
7926
|
+
const propertyEditor = (_a = __classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").parentComponent) === null || _a === void 0 ? void 0 : _a.propertyEditor;
|
|
7826
7927
|
if (propertyEditor === undefined) {
|
|
7827
7928
|
return;
|
|
7828
7929
|
}
|
|
7829
7930
|
const selectedValueSet = selection === null || selection === void 0 ? void 0 : selection.valueSet;
|
|
7830
7931
|
if (selectedValueSet) {
|
|
7831
|
-
this
|
|
7932
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorSelection, selection, "f");
|
|
7832
7933
|
if (makeUpdateValuesAction) {
|
|
7833
|
-
this
|
|
7934
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorValues, clone(selectedValueSet.getValues()), "f");
|
|
7834
7935
|
}
|
|
7835
7936
|
if (propertyEditor) {
|
|
7836
7937
|
if (selection instanceof DiagramNode || selection instanceof DiagramConnection) {
|
|
@@ -7847,42 +7948,43 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7847
7948
|
propertyEditor.valueSet = undefined;
|
|
7848
7949
|
propertyEditor.valueSet = selectedValueSet;
|
|
7849
7950
|
} else {
|
|
7850
|
-
propertyEditor.title = this
|
|
7951
|
+
propertyEditor.title = __classPrivateFieldGet(this, _DiagramUserSelection_diagramPropertiesText, "f");
|
|
7851
7952
|
// force the update of the valueSet
|
|
7852
7953
|
propertyEditor.valueSet = undefined;
|
|
7853
7954
|
propertyEditor.valueSet = selectedValueSet;
|
|
7854
7955
|
}
|
|
7855
7956
|
}
|
|
7856
7957
|
} else {
|
|
7857
|
-
this
|
|
7858
|
-
this
|
|
7958
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorSelection, undefined, "f");
|
|
7959
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorValues, undefined, "f");
|
|
7859
7960
|
if (propertyEditor) {
|
|
7860
7961
|
propertyEditor.title = '';
|
|
7861
7962
|
propertyEditor.valueSet = undefined;
|
|
7862
7963
|
}
|
|
7863
7964
|
}
|
|
7864
7965
|
}
|
|
7865
|
-
makeUpdateValuesAction() {
|
|
7866
|
-
var _a, _b, _c;
|
|
7867
|
-
if (this.propertyEditorSelection === undefined || this.propertyEditorValues === undefined) {
|
|
7868
|
-
return;
|
|
7869
|
-
}
|
|
7870
|
-
const previousSelectionId = this.propertyEditorSelection instanceof DiagramModel ? undefined : this.propertyEditorSelection.id;
|
|
7871
|
-
// check if there have been changes in the previously selected ValueSet,
|
|
7872
|
-
// and create an UpdateValuesAction if there have
|
|
7873
|
-
if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a === void 0 ? void 0 : _a.valueSet.getValues())) {
|
|
7874
|
-
return;
|
|
7875
|
-
}
|
|
7876
|
-
const from = this.propertyEditorValues;
|
|
7877
|
-
const to = clone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
|
|
7878
|
-
const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === void 0 ? void 0 : _c.valueSet);
|
|
7879
|
-
const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
|
|
7880
|
-
currentAction.do();
|
|
7881
|
-
this.canvas.actionStack.add(currentAction);
|
|
7882
|
-
this.propertyEditorValues = to;
|
|
7883
|
-
}
|
|
7884
7966
|
}
|
|
7967
|
+
_DiagramUserSelection_canvas = new WeakMap(), _DiagramUserSelection_diagramPropertiesText = new WeakMap(), _DiagramUserSelection_propertyEditorSelection = new WeakMap(), _DiagramUserSelection_propertyEditorValues = new WeakMap(), _DiagramUserSelection_instances = new WeakSet(), _DiagramUserSelection_makeUpdateValuesAction = function _DiagramUserSelection_makeUpdateValuesAction() {
|
|
7968
|
+
var _a, _b, _c;
|
|
7969
|
+
if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === undefined || __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorValues, "f") === undefined) {
|
|
7970
|
+
return;
|
|
7971
|
+
}
|
|
7972
|
+
const previousSelectionId = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") instanceof DiagramModel ? undefined : __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f").id;
|
|
7973
|
+
// check if there have been changes in the previously selected ValueSet,
|
|
7974
|
+
// and create an UpdateValuesAction if there have
|
|
7975
|
+
if (equals(__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorValues, "f"), (_a = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f")) === null || _a === void 0 ? void 0 : _a.valueSet.getValues())) {
|
|
7976
|
+
return;
|
|
7977
|
+
}
|
|
7978
|
+
const from = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorValues, "f");
|
|
7979
|
+
const to = clone((_b = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f")) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
|
|
7980
|
+
const [fromDiff, toDiff] = diffProperties(from, to, (_c = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f")) === null || _c === void 0 ? void 0 : _c.valueSet);
|
|
7981
|
+
const currentAction = new UpdateValuesAction(__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f"), previousSelectionId, fromDiff, toDiff);
|
|
7982
|
+
currentAction.do();
|
|
7983
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").actionStack.add(currentAction);
|
|
7984
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorValues, to, "f");
|
|
7985
|
+
};
|
|
7885
7986
|
|
|
7987
|
+
var _DiagramCanvas_instances, _a, _DiagramCanvas_canvasCount, _DiagramCanvas_diagramRoot, _DiagramCanvas_connectionType, _DiagramCanvas_gridPatternId, _DiagramCanvas_ancillaryGridPatternIds, _DiagramCanvas_zoomBehavior, _DiagramCanvas_zoomTransform, _DiagramCanvas_priorityThreshold, _DiagramCanvas_priorityThresholds, _DiagramCanvas_unfinishedConnection, _DiagramCanvas_unfinishedConnectionTracer, _DiagramCanvas_unfinishedConnectionPort, _DiagramCanvas_inputFieldContainer, _DiagramCanvas_multipleSelectionContainer, _DiagramCanvas_draggingFrom, _DiagramCanvas_dragging, _DiagramCanvas_secondaryButton, _DiagramCanvas_currentAction, _DiagramCanvas_updateConnectionLabelsInView, _DiagramCanvas_updateConnectionMarkersInView, _DiagramCanvas_startConnection, _DiagramCanvas_finishConnection, _DiagramCanvas_dropConnection, _DiagramCanvas_createInputField, _DiagramCanvas_removeInputField, _DiagramCanvas_minimumSizeOfField, _DiagramCanvas_setFieldTextAndWrap, _DiagramCanvas_setFieldText, _DiagramCanvas_startMovingNode, _DiagramCanvas_continueMovingNode, _DiagramCanvas_finishMovingNode, _DiagramCanvas_startMultipleSelection, _DiagramCanvas_continueMultipleSelection, _DiagramCanvas_finishMultipleSelection;
|
|
7886
7988
|
/**
|
|
7887
7989
|
* Thickness of the invisible path around a connection used to make it easier to click on, in diagram units.
|
|
7888
7990
|
* @private
|
|
@@ -7897,13 +7999,13 @@ const ACTION_STACK_SIZE = 25;
|
|
|
7897
7999
|
const UNFINISHED_CONNECTION_ID = 'diagram-connection-unfinished';
|
|
7898
8000
|
class DiagramCanvas {
|
|
7899
8001
|
get connectionType() {
|
|
7900
|
-
return this
|
|
8002
|
+
return __classPrivateFieldGet(this, _DiagramCanvas_connectionType, "f");
|
|
7901
8003
|
}
|
|
7902
8004
|
set connectionType(value) {
|
|
7903
|
-
var
|
|
7904
|
-
this
|
|
8005
|
+
var _b, _c;
|
|
8006
|
+
__classPrivateFieldSet(this, _DiagramCanvas_connectionType, value, "f");
|
|
7905
8007
|
// refresh the palette every time connectionType is set so that the palette keeps track of updates to the connectionType
|
|
7906
|
-
(
|
|
8008
|
+
(_c = (_b = this.parentComponent) === null || _b === void 0 ? void 0 : _b.palette) === null || _c === void 0 ? void 0 : _c.refreshPalette();
|
|
7907
8009
|
}
|
|
7908
8010
|
/**
|
|
7909
8011
|
* Constructs a canvas object.
|
|
@@ -7912,45 +8014,62 @@ class DiagramCanvas {
|
|
|
7912
8014
|
* @param config The configuration object used to set the parameters of this canvas.
|
|
7913
8015
|
*/
|
|
7914
8016
|
constructor(parentComponent, config) {
|
|
7915
|
-
var
|
|
7916
|
-
|
|
7917
|
-
this
|
|
7918
|
-
this
|
|
8017
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
8018
|
+
var _z, _0;
|
|
8019
|
+
_DiagramCanvas_instances.add(this);
|
|
8020
|
+
_DiagramCanvas_diagramRoot.set(this, void 0);
|
|
8021
|
+
_DiagramCanvas_connectionType.set(this, void 0);
|
|
8022
|
+
_DiagramCanvas_gridPatternId.set(this, `daga-grid-pattern-id-${__classPrivateFieldSet(_z = _a, _a, (_0 = __classPrivateFieldGet(_z, _a, "f", _DiagramCanvas_canvasCount), ++_0), "f", _DiagramCanvas_canvasCount)}`);
|
|
8023
|
+
_DiagramCanvas_ancillaryGridPatternIds.set(this, []);
|
|
8024
|
+
_DiagramCanvas_zoomBehavior.set(this, void 0);
|
|
8025
|
+
_DiagramCanvas_zoomTransform.set(this, d3__namespace.zoomIdentity);
|
|
8026
|
+
_DiagramCanvas_priorityThreshold.set(this, void 0);
|
|
8027
|
+
_DiagramCanvas_priorityThresholds.set(this, void 0);
|
|
8028
|
+
_DiagramCanvas_unfinishedConnection.set(this, void 0);
|
|
8029
|
+
/**
|
|
8030
|
+
* Invisible path followed by an unfinished connection. Used for making unfinished connections stop before the cursor rather than stopping right at the cursor.
|
|
8031
|
+
*/
|
|
8032
|
+
_DiagramCanvas_unfinishedConnectionTracer.set(this, void 0);
|
|
8033
|
+
_DiagramCanvas_unfinishedConnectionPort.set(this, void 0);
|
|
8034
|
+
_DiagramCanvas_inputFieldContainer.set(this, void 0);
|
|
8035
|
+
_DiagramCanvas_multipleSelectionContainer.set(this, void 0);
|
|
7919
8036
|
// used to distinguish drags from clicks when dragging elements and during multiple selection
|
|
7920
|
-
this
|
|
8037
|
+
_DiagramCanvas_draggingFrom.set(this, [0, 0]);
|
|
7921
8038
|
// used to distinguish drags from clicks during multiple selection
|
|
7922
|
-
this
|
|
8039
|
+
_DiagramCanvas_dragging.set(this, false);
|
|
7923
8040
|
// used to track whether a click is secondary or primary
|
|
7924
|
-
this
|
|
8041
|
+
_DiagramCanvas_secondaryButton.set(this, false);
|
|
8042
|
+
// current action that started but hasn't finished yet
|
|
8043
|
+
_DiagramCanvas_currentAction.set(this, void 0);
|
|
7925
8044
|
this.validatorChange$ = new rxjs.Subject();
|
|
7926
8045
|
this.diagramChange$ = new rxjs.Subject();
|
|
7927
8046
|
this.diagramEvent$ = new rxjs.Subject();
|
|
7928
8047
|
this.propertyEditorChanges$ = new rxjs.Subject();
|
|
7929
8048
|
this.parentComponent = parentComponent;
|
|
7930
8049
|
this.model = new DiagramModel(this, undefined, config.name || 'unnamed', '', config.type || '', config.properties || []);
|
|
7931
|
-
this.userSelection = new DiagramUserSelection(this, (
|
|
7932
|
-
this.userHighlight = new DiagramUserHighlight(this, ((
|
|
7933
|
-
this.contextMenu = new DiagramContextMenu(this, (
|
|
8050
|
+
this.userSelection = new DiagramUserSelection(this, (_c = (_b = config.components) === null || _b === void 0 ? void 0 : _b.propertyEditor) === null || _c === void 0 ? void 0 : _c.title);
|
|
8051
|
+
this.userHighlight = new DiagramUserHighlight(this, ((_d = config.canvas) === null || _d === void 0 ? void 0 : _d.highlightSections) !== false);
|
|
8052
|
+
this.contextMenu = new DiagramContextMenu(this, (_e = config.canvas) === null || _e === void 0 ? void 0 : _e.contextMenu);
|
|
7934
8053
|
// TODO
|
|
7935
|
-
this.backgroundConfig = (
|
|
7936
|
-
this.gridConfig = applyGridDefaults((
|
|
8054
|
+
this.backgroundConfig = (_g = (_f = config.canvas) === null || _f === void 0 ? void 0 : _f.background) !== null && _g !== void 0 ? _g : BACKGROUND_DEFAULTS;
|
|
8055
|
+
this.gridConfig = applyGridDefaults((_h = config.canvas) === null || _h === void 0 ? void 0 : _h.grid);
|
|
7937
8056
|
this.ancillaryGridsConfig = [];
|
|
7938
|
-
for (let i = 0; i < (((
|
|
7939
|
-
this.ancillaryGridsConfig.push(applyGridDefaults((
|
|
7940
|
-
this.
|
|
7941
|
-
}
|
|
7942
|
-
this.zoomFactor = ((
|
|
7943
|
-
this.panRate = ((
|
|
7944
|
-
this.inferConnectionType = ((
|
|
7945
|
-
this.autoTightenConnections = ((
|
|
7946
|
-
this.tightenConnectionsAcrossPortTypes = ((
|
|
7947
|
-
this.allowConnectionLoops = ((
|
|
7948
|
-
this.allowSharingPorts = ((
|
|
7949
|
-
this.allowSharingBothPorts = ((
|
|
7950
|
-
this.portHighlightRadius = ((
|
|
8057
|
+
for (let i = 0; i < (((_k = (_j = config.canvas) === null || _j === void 0 ? void 0 : _j.ancillaryGrids) === null || _k === void 0 ? void 0 : _k.length) || 0); ++i) {
|
|
8058
|
+
this.ancillaryGridsConfig.push(applyGridDefaults((_m = (_l = config.canvas) === null || _l === void 0 ? void 0 : _l.ancillaryGrids) === null || _m === void 0 ? void 0 : _m[i]));
|
|
8059
|
+
__classPrivateFieldGet(this, _DiagramCanvas_ancillaryGridPatternIds, "f").push(`${__classPrivateFieldGet(this, _DiagramCanvas_gridPatternId, "f")}-ancillary-${i}`);
|
|
8060
|
+
}
|
|
8061
|
+
this.zoomFactor = ((_o = config.canvas) === null || _o === void 0 ? void 0 : _o.zoomFactor) || 2;
|
|
8062
|
+
this.panRate = ((_p = config.canvas) === null || _p === void 0 ? void 0 : _p.panRate) || 100;
|
|
8063
|
+
this.inferConnectionType = ((_q = config.connectionSettings) === null || _q === void 0 ? void 0 : _q.inferConnectionType) || false;
|
|
8064
|
+
this.autoTightenConnections = ((_r = config.connectionSettings) === null || _r === void 0 ? void 0 : _r.autoTighten) !== false;
|
|
8065
|
+
this.tightenConnectionsAcrossPortTypes = ((_s = config.connectionSettings) === null || _s === void 0 ? void 0 : _s.tightenAcrossPortTypes) || false;
|
|
8066
|
+
this.allowConnectionLoops = ((_t = config.connectionSettings) === null || _t === void 0 ? void 0 : _t.allowLoops) || false;
|
|
8067
|
+
this.allowSharingPorts = ((_u = config.connectionSettings) === null || _u === void 0 ? void 0 : _u.sharePorts) !== false;
|
|
8068
|
+
this.allowSharingBothPorts = ((_v = config.connectionSettings) === null || _v === void 0 ? void 0 : _v.shareBothPorts) || false;
|
|
8069
|
+
this.portHighlightRadius = ((_w = config.connectionSettings) === null || _w === void 0 ? void 0 : _w.portHighlightRadius) || 100;
|
|
7951
8070
|
this.multipleSelectionOn = false;
|
|
7952
|
-
this
|
|
7953
|
-
this
|
|
8071
|
+
__classPrivateFieldSet(this, _DiagramCanvas_priorityThresholds, ((_x = config.canvas) === null || _x === void 0 ? void 0 : _x.priorityThresholds) || [], "f");
|
|
8072
|
+
__classPrivateFieldSet(this, _DiagramCanvas_priorityThreshold, __classPrivateFieldGet(this, _DiagramCanvas_priorityThresholds, "f") ? __classPrivateFieldGet(this, _DiagramCanvas_priorityThresholds, "f")[0] : undefined, "f");
|
|
7954
8073
|
this.layoutFormat = config.layoutFormat;
|
|
7955
8074
|
this.userActions = config.userActions || {};
|
|
7956
8075
|
this.validators = [];
|
|
@@ -7976,7 +8095,7 @@ class DiagramCanvas {
|
|
|
7976
8095
|
const connectionType = new DiagramConnectionType(Object.assign(Object.assign({}, config.connectionTypeDefaults), connectionTypeConfig));
|
|
7977
8096
|
this.model.connections.types.add(connectionType);
|
|
7978
8097
|
}
|
|
7979
|
-
this
|
|
8098
|
+
__classPrivateFieldSet(this, _DiagramCanvas_connectionType, ((_y = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _y === void 0 ? void 0 : _y.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined, "f");
|
|
7980
8099
|
}
|
|
7981
8100
|
}
|
|
7982
8101
|
addValidator(validator) {
|
|
@@ -7988,38 +8107,38 @@ class DiagramCanvas {
|
|
|
7988
8107
|
this.validatorChange$.next();
|
|
7989
8108
|
}
|
|
7990
8109
|
getPriorityThresholdOptions() {
|
|
7991
|
-
return this
|
|
8110
|
+
return __classPrivateFieldGet(this, _DiagramCanvas_priorityThresholds, "f");
|
|
7992
8111
|
}
|
|
7993
8112
|
getPriorityThreshold() {
|
|
7994
|
-
return this
|
|
8113
|
+
return __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f");
|
|
7995
8114
|
}
|
|
7996
8115
|
setPriorityThreshold(priority) {
|
|
7997
|
-
var
|
|
7998
|
-
this
|
|
8116
|
+
var _b, _c;
|
|
8117
|
+
__classPrivateFieldSet(this, _DiagramCanvas_priorityThreshold, priority, "f");
|
|
7999
8118
|
this.updateModelInView();
|
|
8000
8119
|
for (const node of this.model.nodes) {
|
|
8001
8120
|
this.fitNodeInView(node.id);
|
|
8002
8121
|
}
|
|
8003
|
-
(
|
|
8122
|
+
(_c = (_b = this.parentComponent) === null || _b === void 0 ? void 0 : _b.palette) === null || _c === void 0 ? void 0 : _c.refreshPalette();
|
|
8004
8123
|
}
|
|
8005
8124
|
// View methods
|
|
8006
8125
|
initView(appendTo) {
|
|
8007
8126
|
const appendToSelection = d3__namespace.select(appendTo);
|
|
8008
8127
|
// remove all children
|
|
8009
8128
|
appendToSelection.html('');
|
|
8010
|
-
this
|
|
8129
|
+
__classPrivateFieldSet(this, _DiagramCanvas_diagramRoot, appendToSelection.append('div').node(), "f");
|
|
8011
8130
|
this.selectRoot().attr('tabindex', 0) // make element focusable
|
|
8012
8131
|
.style('width', '100%').style('height', '100%').append('svg').style('width', '100%').style('height', '100%');
|
|
8013
8132
|
this.selectRoot().on(exports.Events.Click, () => {
|
|
8014
|
-
var
|
|
8133
|
+
var _b;
|
|
8015
8134
|
// focus on the diagram when clicking so that we can focus on the diagram
|
|
8016
8135
|
// keyboard events only work if we're focusing on the diagram
|
|
8017
|
-
(
|
|
8136
|
+
(_b = this.selectRoot().node()) === null || _b === void 0 ? void 0 : _b.focus();
|
|
8018
8137
|
}).on(exports.Events.ContextMenu, event => {
|
|
8019
|
-
if (this
|
|
8138
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
8020
8139
|
event.preventDefault();
|
|
8021
8140
|
event.stopPropagation();
|
|
8022
|
-
this
|
|
8141
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
8023
8142
|
return;
|
|
8024
8143
|
}
|
|
8025
8144
|
const diagramEvent = new DiagramSecondaryClickEvent(event, null);
|
|
@@ -8128,33 +8247,33 @@ class DiagramCanvas {
|
|
|
8128
8247
|
if (this.canUserPerformAction(exports.DiagramActions.Zoom)) {
|
|
8129
8248
|
event.preventDefault();
|
|
8130
8249
|
// move left, faster if we're zoomed out and slower if we're zoomed in
|
|
8131
|
-
this.translateBy(this.panRate / this.
|
|
8250
|
+
this.translateBy(this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, 0);
|
|
8132
8251
|
}
|
|
8133
8252
|
}
|
|
8134
8253
|
if (event.key === exports.Keys.ArrowRight) {
|
|
8135
8254
|
if (this.canUserPerformAction(exports.DiagramActions.Zoom)) {
|
|
8136
8255
|
event.preventDefault();
|
|
8137
8256
|
// move right, faster if we're zoomed out and slower if we're zoomed in
|
|
8138
|
-
this.translateBy(-this.panRate / this.
|
|
8257
|
+
this.translateBy(-this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, 0);
|
|
8139
8258
|
}
|
|
8140
8259
|
}
|
|
8141
8260
|
if (event.key === exports.Keys.ArrowDown) {
|
|
8142
8261
|
if (this.canUserPerformAction(exports.DiagramActions.Zoom)) {
|
|
8143
8262
|
event.preventDefault();
|
|
8144
8263
|
// move down, faster if we're zoomed out and slower if we're zoomed in
|
|
8145
|
-
this.translateBy(0, -this.panRate / this.
|
|
8264
|
+
this.translateBy(0, -this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k);
|
|
8146
8265
|
}
|
|
8147
8266
|
}
|
|
8148
8267
|
if (event.key === exports.Keys.ArrowUp) {
|
|
8149
8268
|
if (this.canUserPerformAction(exports.DiagramActions.Zoom)) {
|
|
8150
8269
|
event.preventDefault();
|
|
8151
8270
|
// move up, faster if we're zoomed out and slower if we're zoomed in
|
|
8152
|
-
this.translateBy(0, this.panRate / this.
|
|
8271
|
+
this.translateBy(0, this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k);
|
|
8153
8272
|
}
|
|
8154
8273
|
}
|
|
8155
8274
|
});
|
|
8156
8275
|
const canvasView = this.selectSVGElement().append('g').attr('class', 'daga-canvas-view').attr('width', `100%`).attr('height', `100%`);
|
|
8157
|
-
canvasView.call(this
|
|
8276
|
+
canvasView.call(__classPrivateFieldSet(this, _DiagramCanvas_zoomBehavior, d3__namespace.zoom().filter(event => {
|
|
8158
8277
|
// Disable double-click zoom by filtering out dblclick events
|
|
8159
8278
|
return event.type !== exports.Events.DoubleClick;
|
|
8160
8279
|
}).on(exports.ZoomEvents.Zoom, event => {
|
|
@@ -8175,29 +8294,29 @@ class DiagramCanvas {
|
|
|
8175
8294
|
setCursorStyle(exports.CursorStyle.AllScroll);
|
|
8176
8295
|
}
|
|
8177
8296
|
}
|
|
8178
|
-
this
|
|
8297
|
+
__classPrivateFieldSet(this, _DiagramCanvas_zoomTransform, event.transform, "f");
|
|
8179
8298
|
const transformAttribute = event.transform.toString();
|
|
8180
8299
|
this.selectCanvasElements().attr('transform', transformAttribute);
|
|
8181
|
-
for (const gridPatternId of [this
|
|
8300
|
+
for (const gridPatternId of [__classPrivateFieldGet(this, _DiagramCanvas_gridPatternId, "f"), ...__classPrivateFieldGet(this, _DiagramCanvas_ancillaryGridPatternIds, "f")]) {
|
|
8182
8301
|
this.selectCanvasView().select(`#${gridPatternId}`).attr('patternTransform', transformAttribute);
|
|
8183
8302
|
}
|
|
8184
8303
|
this.contextMenu.close();
|
|
8185
|
-
this.diagramEvent$.next(new DiagramZoomEvent([this.
|
|
8304
|
+
this.diagramEvent$.next(new DiagramZoomEvent([__classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x, __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y], __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k));
|
|
8186
8305
|
}).on(exports.ZoomEvents.End, () => {
|
|
8187
8306
|
setCursorStyle();
|
|
8188
|
-
}));
|
|
8307
|
+
}), "f"));
|
|
8189
8308
|
const canvasDefs = canvasView.append('defs');
|
|
8190
8309
|
const canvasBackground = [];
|
|
8191
8310
|
canvasBackground.push(initializeBackground(canvasView, this.backgroundConfig).attr('class', 'daga-background'));
|
|
8192
8311
|
for (let i = 0; i < this.ancillaryGridsConfig.length; ++i) {
|
|
8193
|
-
canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, this
|
|
8312
|
+
canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, __classPrivateFieldGet(this, _DiagramCanvas_ancillaryGridPatternIds, "f")[i], this.ancillaryGridsConfig[i]));
|
|
8194
8313
|
}
|
|
8195
|
-
canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, this
|
|
8314
|
+
canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, __classPrivateFieldGet(this, _DiagramCanvas_gridPatternId, "f"), this.gridConfig));
|
|
8196
8315
|
for (const canvasBackgroundElement of canvasBackground) {
|
|
8197
8316
|
canvasBackgroundElement.on(exports.Events.MouseMove, event => {
|
|
8198
|
-
if (this
|
|
8317
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") !== undefined) {
|
|
8199
8318
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8200
|
-
this.
|
|
8319
|
+
__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endCoords = pointerCoords;
|
|
8201
8320
|
}
|
|
8202
8321
|
});
|
|
8203
8322
|
canvasBackgroundElement.on(exports.Events.MouseOver, () => {
|
|
@@ -8222,55 +8341,55 @@ class DiagramCanvas {
|
|
|
8222
8341
|
canvasBackgroundElement.call(d3__namespace.drag().filter(event => {
|
|
8223
8342
|
return this.multipleSelectionOn || isSecondaryButton(event);
|
|
8224
8343
|
}).on(exports.DragEvents.Start, event => {
|
|
8225
|
-
this.
|
|
8344
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
8226
8345
|
}).on(exports.DragEvents.Drag, event => {
|
|
8227
|
-
this.
|
|
8346
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
8228
8347
|
}).on(exports.DragEvents.End, event => {
|
|
8229
|
-
this.
|
|
8348
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
8230
8349
|
}));
|
|
8231
8350
|
}
|
|
8232
8351
|
canvasView.append('g').attr('class', 'daga-canvas-elements');
|
|
8233
8352
|
}
|
|
8234
8353
|
getZoomLevel() {
|
|
8235
|
-
return this.
|
|
8354
|
+
return __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k;
|
|
8236
8355
|
}
|
|
8237
8356
|
zoomBy(factor) {
|
|
8238
8357
|
if (!isNaN(factor)) {
|
|
8239
|
-
this.
|
|
8358
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleBy(this.selectCanvasView(), factor);
|
|
8240
8359
|
}
|
|
8241
8360
|
}
|
|
8242
8361
|
zoomTo(level) {
|
|
8243
8362
|
if (!isNaN(level)) {
|
|
8244
|
-
this.
|
|
8363
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleTo(this.selectCanvasView(), level);
|
|
8245
8364
|
}
|
|
8246
8365
|
}
|
|
8247
8366
|
getViewCoordinates() {
|
|
8248
|
-
var
|
|
8249
|
-
const canvasViewBoundingBox = (
|
|
8367
|
+
var _b, _c, _d;
|
|
8368
|
+
const canvasViewBoundingBox = (_d = (_c = (_b = this.selectCanvasView()) === null || _b === void 0 ? void 0 : _b.select('.daga-background')) === null || _c === void 0 ? void 0 : _c.node()) === null || _d === void 0 ? void 0 : _d.getBBox();
|
|
8250
8369
|
/*
|
|
8251
8370
|
transform the coordinates of the zoomTransform to the coordinates
|
|
8252
8371
|
needed to point the zoomTransfrom to the center of the screen to
|
|
8253
8372
|
ensure that canvas.translateTo(getViewCoordinates()) has no effect
|
|
8254
8373
|
*/
|
|
8255
|
-
return [((canvasViewBoundingBox.width + canvasViewBoundingBox.x) / 2 - this.
|
|
8374
|
+
return [((canvasViewBoundingBox.width + canvasViewBoundingBox.x) / 2 - __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x) / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, ((canvasViewBoundingBox.height + canvasViewBoundingBox.y) / 2 - __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y) / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k];
|
|
8256
8375
|
}
|
|
8257
8376
|
translateBy(x, y) {
|
|
8258
8377
|
if (!isNaN(x) && !isNaN(y)) {
|
|
8259
|
-
this.
|
|
8378
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateBy(this.selectCanvasView(), x, y);
|
|
8260
8379
|
}
|
|
8261
8380
|
}
|
|
8262
8381
|
translateTo(x, y) {
|
|
8263
8382
|
if (!isNaN(x) && !isNaN(y)) {
|
|
8264
|
-
this.
|
|
8383
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateTo(this.selectCanvasView(), x, y);
|
|
8265
8384
|
}
|
|
8266
8385
|
}
|
|
8267
8386
|
zoomAndPanTo(x, y, z, duration) {
|
|
8268
8387
|
if (!duration || duration <= 0) {
|
|
8269
|
-
this.
|
|
8270
|
-
this.
|
|
8388
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleTo(this.selectCanvasView(), z);
|
|
8389
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateTo(this.selectCanvasView(), x, y);
|
|
8271
8390
|
return;
|
|
8272
8391
|
}
|
|
8273
|
-
this.
|
|
8392
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").interpolate(d3__namespace.interpolate);
|
|
8274
8393
|
const [startingX, startingY] = this.getViewCoordinates();
|
|
8275
8394
|
const startingZoom = this.getZoomLevel();
|
|
8276
8395
|
const targetX = x,
|
|
@@ -8284,8 +8403,8 @@ class DiagramCanvas {
|
|
|
8284
8403
|
const currentX = value * (targetX - startingX) + startingX;
|
|
8285
8404
|
const currentY = value * (targetY - startingY) + startingY;
|
|
8286
8405
|
const currentZoom = value * (targetZoom - startingZoom) + startingZoom;
|
|
8287
|
-
this.
|
|
8288
|
-
this.
|
|
8406
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleTo(this.selectCanvasView(), currentZoom);
|
|
8407
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateTo(this.selectCanvasView(), currentX, currentY);
|
|
8289
8408
|
}
|
|
8290
8409
|
} catch (e) {
|
|
8291
8410
|
console.warn('Animation has been interrupted.', e);
|
|
@@ -8295,10 +8414,10 @@ class DiagramCanvas {
|
|
|
8295
8414
|
});
|
|
8296
8415
|
}
|
|
8297
8416
|
center(nodeIds, maxZoomLevel, duration) {
|
|
8298
|
-
var
|
|
8417
|
+
var _b;
|
|
8299
8418
|
// if there are no nodes, we have nothing to do here
|
|
8300
8419
|
if (this.model.nodes.length > 0) {
|
|
8301
|
-
const canvasViewBoundingBox = (
|
|
8420
|
+
const canvasViewBoundingBox = (_b = this.selectCanvasView().select('.daga-background').node()) === null || _b === void 0 ? void 0 : _b.getBBox();
|
|
8302
8421
|
if (!canvasViewBoundingBox.width || !canvasViewBoundingBox.height) {
|
|
8303
8422
|
// prevent errors if the width or height is invalid
|
|
8304
8423
|
return;
|
|
@@ -8340,35 +8459,19 @@ class DiagramCanvas {
|
|
|
8340
8459
|
return [pointX, pointY];
|
|
8341
8460
|
}
|
|
8342
8461
|
getCoordinatesOnScreen() {
|
|
8343
|
-
var
|
|
8344
|
-
const rootBoundingClientRect = (
|
|
8462
|
+
var _b;
|
|
8463
|
+
const rootBoundingClientRect = (_b = this.selectSVGElement().node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
8345
8464
|
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.height) || 0];
|
|
8346
|
-
return [[-this.
|
|
8347
|
-
}
|
|
8348
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8349
|
-
getEventHoldingCoordinates(event) {
|
|
8350
|
-
if (event.type === 'drag' || event.type === 'start' || event.type === 'end') {
|
|
8351
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8352
|
-
const sourceEvent = event.sourceEvent;
|
|
8353
|
-
if (sourceEvent && (sourceEvent.type === 'touchmove' || sourceEvent.type === 'touchstart' || sourceEvent.type === 'touchend')) {
|
|
8354
|
-
return (
|
|
8355
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8356
|
-
event.sourceEvent.touches[0] ||
|
|
8357
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8358
|
-
event.sourceEvent.changedTouches[0]
|
|
8359
|
-
);
|
|
8360
|
-
}
|
|
8361
|
-
}
|
|
8362
|
-
return event;
|
|
8465
|
+
return [[-__classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, -__classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k], [(rootDimensions[0] - __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x) / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, (rootDimensions[1] - __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y) / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k]];
|
|
8363
8466
|
}
|
|
8364
8467
|
getPointerLocationRelativeToCanvas(event) {
|
|
8365
|
-
return d3__namespace.pointer(
|
|
8468
|
+
return d3__namespace.pointer(getEventHoldingCoordinates(event), this.selectCanvasElements().node());
|
|
8366
8469
|
}
|
|
8367
8470
|
getPointerLocationRelativeToRoot(event) {
|
|
8368
|
-
return d3__namespace.pointer(
|
|
8471
|
+
return d3__namespace.pointer(getEventHoldingCoordinates(event), this.selectSVGElement().node());
|
|
8369
8472
|
}
|
|
8370
8473
|
getPointerLocationRelativeToBody(event) {
|
|
8371
|
-
return d3__namespace.pointer(
|
|
8474
|
+
return d3__namespace.pointer(getEventHoldingCoordinates(event), d3__namespace.select('body').node());
|
|
8372
8475
|
}
|
|
8373
8476
|
getPointerLocationRelativeToScreen(event) {
|
|
8374
8477
|
const pointerLocationRelativeToBody = this.getPointerLocationRelativeToBody(event);
|
|
@@ -8384,7 +8487,7 @@ class DiagramCanvas {
|
|
|
8384
8487
|
this.updateDecoratorsInView();
|
|
8385
8488
|
}
|
|
8386
8489
|
updateNodesInView(...ids) {
|
|
8387
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-node').data(this.model.nodes.filter(e => this
|
|
8490
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-node').data(this.model.nodes.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
|
|
8388
8491
|
const exitSelection = updateSelection.exit();
|
|
8389
8492
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-node${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''}${needsResizerXY(d) ? ' resizable-xy' : ''} ${d.type.defaultLook.lookType}`);
|
|
8390
8493
|
if (ids && ids.length > 0) {
|
|
@@ -8393,7 +8496,7 @@ class DiagramCanvas {
|
|
|
8393
8496
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
8394
8497
|
exitSelection.remove();
|
|
8395
8498
|
enterSelection.on(exports.Events.MouseOver, (_event, d) => {
|
|
8396
|
-
if (!this
|
|
8499
|
+
if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
8397
8500
|
this.userHighlight.focusOn(d);
|
|
8398
8501
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
8399
8502
|
}
|
|
@@ -8406,10 +8509,10 @@ class DiagramCanvas {
|
|
|
8406
8509
|
this.userSelection.toggle(d);
|
|
8407
8510
|
this.diagramEvent$.next(new DiagramSelectionEvent([d], d.selected));
|
|
8408
8511
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
8409
|
-
if (this
|
|
8512
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
8410
8513
|
event.preventDefault();
|
|
8411
8514
|
event.stopPropagation();
|
|
8412
|
-
this
|
|
8515
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
8413
8516
|
return;
|
|
8414
8517
|
}
|
|
8415
8518
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -8426,27 +8529,27 @@ class DiagramCanvas {
|
|
|
8426
8529
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
8427
8530
|
this.diagramEvent$.next(diagramEvent);
|
|
8428
8531
|
}).call(d3__namespace.drag().filter(event => {
|
|
8429
|
-
this
|
|
8532
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
8430
8533
|
return true;
|
|
8431
8534
|
}).on(exports.DragEvents.Start, (event, d) => {
|
|
8432
|
-
if (this.multipleSelectionOn || this
|
|
8433
|
-
this.
|
|
8535
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8536
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
8434
8537
|
} else {
|
|
8435
|
-
this.
|
|
8538
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, d);
|
|
8436
8539
|
}
|
|
8437
8540
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
8438
|
-
if (this.multipleSelectionOn || this
|
|
8439
|
-
this.
|
|
8541
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8542
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
8440
8543
|
} else {
|
|
8441
|
-
this.
|
|
8544
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, d);
|
|
8442
8545
|
}
|
|
8443
8546
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8444
|
-
if (this.multipleSelectionOn || this
|
|
8445
|
-
this.
|
|
8547
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8548
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
8446
8549
|
} else {
|
|
8447
|
-
this.
|
|
8550
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, d);
|
|
8448
8551
|
}
|
|
8449
|
-
this
|
|
8552
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
|
|
8450
8553
|
}));
|
|
8451
8554
|
initializeLook(enterSelection);
|
|
8452
8555
|
enterSelection.filter('.resizable-x').append('rect').attr('class', 'left-resizer').on(exports.Events.MouseOver, (_event, d) => {
|
|
@@ -8460,7 +8563,7 @@ class DiagramCanvas {
|
|
|
8460
8563
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8461
8564
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
8462
8565
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
8463
|
-
this
|
|
8566
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8464
8567
|
} else {
|
|
8465
8568
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8466
8569
|
}
|
|
@@ -8470,7 +8573,7 @@ class DiagramCanvas {
|
|
|
8470
8573
|
d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
|
|
8471
8574
|
}
|
|
8472
8575
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8473
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this
|
|
8576
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
|
|
8474
8577
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8475
8578
|
if (this.gridConfig.snap) {
|
|
8476
8579
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8478,10 +8581,10 @@ class DiagramCanvas {
|
|
|
8478
8581
|
pointerCoords[1] += d.type.snapToGridOffset[1];
|
|
8479
8582
|
}
|
|
8480
8583
|
d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
|
|
8481
|
-
this.
|
|
8482
|
-
this.
|
|
8483
|
-
this.actionStack.add(this
|
|
8484
|
-
this
|
|
8584
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8585
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8586
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8587
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8485
8588
|
}
|
|
8486
8589
|
setCursorStyle();
|
|
8487
8590
|
}));
|
|
@@ -8496,7 +8599,7 @@ class DiagramCanvas {
|
|
|
8496
8599
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8497
8600
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
8498
8601
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
8499
|
-
this
|
|
8602
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8500
8603
|
} else {
|
|
8501
8604
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8502
8605
|
}
|
|
@@ -8506,7 +8609,7 @@ class DiagramCanvas {
|
|
|
8506
8609
|
d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
8507
8610
|
}
|
|
8508
8611
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8509
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this
|
|
8612
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
|
|
8510
8613
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8511
8614
|
if (this.gridConfig.snap) {
|
|
8512
8615
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
|
|
@@ -8514,10 +8617,10 @@ class DiagramCanvas {
|
|
|
8514
8617
|
pointerCoords[1] += d.type.snapToGridOffset[3];
|
|
8515
8618
|
}
|
|
8516
8619
|
d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
8517
|
-
this.
|
|
8518
|
-
this.
|
|
8519
|
-
this.actionStack.add(this
|
|
8520
|
-
this
|
|
8620
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8621
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8622
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8623
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8521
8624
|
}
|
|
8522
8625
|
setCursorStyle();
|
|
8523
8626
|
}));
|
|
@@ -8532,7 +8635,7 @@ class DiagramCanvas {
|
|
|
8532
8635
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8533
8636
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
8534
8637
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
8535
|
-
this
|
|
8638
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8536
8639
|
} else {
|
|
8537
8640
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8538
8641
|
}
|
|
@@ -8542,7 +8645,7 @@ class DiagramCanvas {
|
|
|
8542
8645
|
d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8543
8646
|
}
|
|
8544
8647
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8545
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this
|
|
8648
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
|
|
8546
8649
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8547
8650
|
if (this.gridConfig.snap) {
|
|
8548
8651
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8550,10 +8653,10 @@ class DiagramCanvas {
|
|
|
8550
8653
|
pointerCoords[1] += d.type.snapToGridOffset[1];
|
|
8551
8654
|
}
|
|
8552
8655
|
d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8553
|
-
this.
|
|
8554
|
-
this.
|
|
8555
|
-
this.actionStack.add(this
|
|
8556
|
-
this
|
|
8656
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8657
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8658
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8659
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8557
8660
|
}
|
|
8558
8661
|
setCursorStyle();
|
|
8559
8662
|
}));
|
|
@@ -8568,7 +8671,7 @@ class DiagramCanvas {
|
|
|
8568
8671
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8569
8672
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
8570
8673
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
8571
|
-
this
|
|
8674
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8572
8675
|
} else {
|
|
8573
8676
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8574
8677
|
}
|
|
@@ -8578,7 +8681,7 @@ class DiagramCanvas {
|
|
|
8578
8681
|
d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8579
8682
|
}
|
|
8580
8683
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8581
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this
|
|
8684
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
|
|
8582
8685
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8583
8686
|
if (this.gridConfig.snap) {
|
|
8584
8687
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
|
|
@@ -8586,10 +8689,10 @@ class DiagramCanvas {
|
|
|
8586
8689
|
pointerCoords[1] += d.type.snapToGridOffset[3];
|
|
8587
8690
|
}
|
|
8588
8691
|
d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8589
|
-
this.
|
|
8590
|
-
this.
|
|
8591
|
-
this.actionStack.add(this
|
|
8592
|
-
this
|
|
8692
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8693
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8694
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8695
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8593
8696
|
}
|
|
8594
8697
|
setCursorStyle();
|
|
8595
8698
|
}));
|
|
@@ -8604,7 +8707,7 @@ class DiagramCanvas {
|
|
|
8604
8707
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8605
8708
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
|
|
8606
8709
|
setCursorStyle(exports.CursorStyle.NWSEResize);
|
|
8607
|
-
this
|
|
8710
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8608
8711
|
} else {
|
|
8609
8712
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8610
8713
|
}
|
|
@@ -8615,7 +8718,7 @@ class DiagramCanvas {
|
|
|
8615
8718
|
d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8616
8719
|
}
|
|
8617
8720
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8618
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this
|
|
8721
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
|
|
8619
8722
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8620
8723
|
if (this.gridConfig.snap) {
|
|
8621
8724
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8624,10 +8727,10 @@ class DiagramCanvas {
|
|
|
8624
8727
|
}
|
|
8625
8728
|
d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
|
|
8626
8729
|
d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8627
|
-
this.
|
|
8628
|
-
this.
|
|
8629
|
-
this.actionStack.add(this
|
|
8630
|
-
this
|
|
8730
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8731
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8732
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8733
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8631
8734
|
}
|
|
8632
8735
|
setCursorStyle();
|
|
8633
8736
|
}));
|
|
@@ -8642,7 +8745,7 @@ class DiagramCanvas {
|
|
|
8642
8745
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8643
8746
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
|
|
8644
8747
|
setCursorStyle(exports.CursorStyle.NESWResize);
|
|
8645
|
-
this
|
|
8748
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8646
8749
|
} else {
|
|
8647
8750
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8648
8751
|
}
|
|
@@ -8653,7 +8756,7 @@ class DiagramCanvas {
|
|
|
8653
8756
|
d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8654
8757
|
}
|
|
8655
8758
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8656
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this
|
|
8759
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
|
|
8657
8760
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8658
8761
|
if (this.gridConfig.snap) {
|
|
8659
8762
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8662,10 +8765,10 @@ class DiagramCanvas {
|
|
|
8662
8765
|
}
|
|
8663
8766
|
d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
8664
8767
|
d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8665
|
-
this.
|
|
8666
|
-
this.
|
|
8667
|
-
this.actionStack.add(this
|
|
8668
|
-
this
|
|
8768
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8769
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8770
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8771
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8669
8772
|
}
|
|
8670
8773
|
setCursorStyle();
|
|
8671
8774
|
}));
|
|
@@ -8680,7 +8783,7 @@ class DiagramCanvas {
|
|
|
8680
8783
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8681
8784
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
|
|
8682
8785
|
setCursorStyle(exports.CursorStyle.NESWResize);
|
|
8683
|
-
this
|
|
8786
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8684
8787
|
} else {
|
|
8685
8788
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8686
8789
|
}
|
|
@@ -8691,7 +8794,7 @@ class DiagramCanvas {
|
|
|
8691
8794
|
d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8692
8795
|
}
|
|
8693
8796
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8694
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this
|
|
8797
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
|
|
8695
8798
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8696
8799
|
if (this.gridConfig.snap) {
|
|
8697
8800
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8700,10 +8803,10 @@ class DiagramCanvas {
|
|
|
8700
8803
|
}
|
|
8701
8804
|
d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
|
|
8702
8805
|
d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8703
|
-
this.
|
|
8704
|
-
this.
|
|
8705
|
-
this.actionStack.add(this
|
|
8706
|
-
this
|
|
8806
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8807
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8808
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8809
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8707
8810
|
}
|
|
8708
8811
|
setCursorStyle();
|
|
8709
8812
|
}));
|
|
@@ -8718,7 +8821,7 @@ class DiagramCanvas {
|
|
|
8718
8821
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8719
8822
|
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
|
|
8720
8823
|
setCursorStyle(exports.CursorStyle.NWSEResize);
|
|
8721
|
-
this
|
|
8824
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8722
8825
|
} else {
|
|
8723
8826
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8724
8827
|
}
|
|
@@ -8729,7 +8832,7 @@ class DiagramCanvas {
|
|
|
8729
8832
|
d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8730
8833
|
}
|
|
8731
8834
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8732
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this
|
|
8835
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchNode) {
|
|
8733
8836
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8734
8837
|
if (this.gridConfig.snap) {
|
|
8735
8838
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8738,10 +8841,10 @@ class DiagramCanvas {
|
|
|
8738
8841
|
}
|
|
8739
8842
|
d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
8740
8843
|
d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8741
|
-
this.
|
|
8742
|
-
this.
|
|
8743
|
-
this.actionStack.add(this
|
|
8744
|
-
this
|
|
8844
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8845
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8846
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8847
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8745
8848
|
}
|
|
8746
8849
|
setCursorStyle();
|
|
8747
8850
|
}));
|
|
@@ -8757,11 +8860,11 @@ class DiagramCanvas {
|
|
|
8757
8860
|
mergeSelection.filter('.resizable-xy').select('rect.bottom-right-resizer').style('pointer-events', d => d.getResizableXY() ? 'initial' : 'none').attr('x', d => d.width - d.getResizerXY().thickness + d.getResizerXY().outerMargin).attr('y', d => d.height - d.getResizerXY().thickness + d.getResizerXY().outerMargin).attr('width', d => d.getResizerXY().thickness).attr('height', d => d.getResizerXY().thickness).attr('fill', d => d.getResizerXY().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerXY().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerXY().getLook(d).borderThickness || 0);
|
|
8758
8861
|
}
|
|
8759
8862
|
updateSectionsInView(...ids) {
|
|
8760
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-section').data(this.model.sections.filter(e => this
|
|
8863
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-section').data(this.model.sections.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
|
|
8761
8864
|
const exitSelection = updateSelection.exit();
|
|
8762
8865
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
|
|
8763
|
-
var
|
|
8764
|
-
return `diagram-section${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''}${needsResizerXY(d) ? ' resizable-xy' : ''} ${(
|
|
8866
|
+
var _b;
|
|
8867
|
+
return `diagram-section${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''}${needsResizerXY(d) ? ' resizable-xy' : ''} ${(_b = d.look) === null || _b === void 0 ? void 0 : _b.lookType}`;
|
|
8765
8868
|
});
|
|
8766
8869
|
if (ids && ids.length > 0) {
|
|
8767
8870
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
@@ -8769,7 +8872,7 @@ class DiagramCanvas {
|
|
|
8769
8872
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
8770
8873
|
exitSelection.remove();
|
|
8771
8874
|
enterSelection.on(exports.Events.MouseOver, (_event, d) => {
|
|
8772
|
-
if (!this
|
|
8875
|
+
if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
8773
8876
|
this.userHighlight.focusOn(d);
|
|
8774
8877
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
8775
8878
|
}
|
|
@@ -8783,10 +8886,10 @@ class DiagramCanvas {
|
|
|
8783
8886
|
this.userSelection.toggle(elementToBeToggled);
|
|
8784
8887
|
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
8785
8888
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
8786
|
-
if (this
|
|
8889
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
8787
8890
|
event.preventDefault();
|
|
8788
8891
|
event.stopPropagation();
|
|
8789
|
-
this
|
|
8892
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
8790
8893
|
return;
|
|
8791
8894
|
}
|
|
8792
8895
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -8804,42 +8907,42 @@ class DiagramCanvas {
|
|
|
8804
8907
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
8805
8908
|
this.diagramEvent$.next(diagramEvent);
|
|
8806
8909
|
}).call(d3__namespace.drag().filter(event => {
|
|
8807
|
-
this
|
|
8910
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
8808
8911
|
return true;
|
|
8809
8912
|
}).on(exports.DragEvents.Start, (event, d) => {
|
|
8810
|
-
if (this.multipleSelectionOn || this
|
|
8811
|
-
this.
|
|
8913
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8914
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
8812
8915
|
} else {
|
|
8813
8916
|
const node = d === null || d === void 0 ? void 0 : d.node;
|
|
8814
8917
|
if (node) {
|
|
8815
|
-
this.
|
|
8918
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, node);
|
|
8816
8919
|
} else {
|
|
8817
8920
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8818
8921
|
}
|
|
8819
8922
|
}
|
|
8820
8923
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
8821
|
-
if (this.multipleSelectionOn || this
|
|
8822
|
-
this.
|
|
8924
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8925
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
8823
8926
|
} else {
|
|
8824
8927
|
const node = d === null || d === void 0 ? void 0 : d.node;
|
|
8825
8928
|
if (node) {
|
|
8826
|
-
this.
|
|
8929
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, node);
|
|
8827
8930
|
} else {
|
|
8828
8931
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8829
8932
|
}
|
|
8830
8933
|
}
|
|
8831
8934
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8832
|
-
if (this.multipleSelectionOn || this
|
|
8833
|
-
this.
|
|
8935
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8936
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
8834
8937
|
} else {
|
|
8835
8938
|
const node = d === null || d === void 0 ? void 0 : d.node;
|
|
8836
8939
|
if (node) {
|
|
8837
|
-
this.
|
|
8940
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, node);
|
|
8838
8941
|
} else {
|
|
8839
8942
|
setCursorStyle();
|
|
8840
8943
|
}
|
|
8841
8944
|
}
|
|
8842
|
-
this
|
|
8945
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
|
|
8843
8946
|
}));
|
|
8844
8947
|
initializeLook(enterSelection);
|
|
8845
8948
|
enterSelection.filter('.resizable-x').append('rect').attr('class', 'left-resizer').on(exports.Events.MouseOver, (_event, d) => {
|
|
@@ -8853,7 +8956,7 @@ class DiagramCanvas {
|
|
|
8853
8956
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8854
8957
|
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && d.node) {
|
|
8855
8958
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
8856
|
-
this
|
|
8959
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
8857
8960
|
} else {
|
|
8858
8961
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8859
8962
|
}
|
|
@@ -8863,16 +8966,16 @@ class DiagramCanvas {
|
|
|
8863
8966
|
d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
8864
8967
|
}
|
|
8865
8968
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8866
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && this
|
|
8969
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
|
|
8867
8970
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8868
8971
|
if (this.gridConfig.snap) {
|
|
8869
8972
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
8870
8973
|
}
|
|
8871
8974
|
d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
8872
|
-
this.
|
|
8873
|
-
this.
|
|
8874
|
-
this.actionStack.add(this
|
|
8875
|
-
this
|
|
8975
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
8976
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8977
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8978
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8876
8979
|
}
|
|
8877
8980
|
setCursorStyle();
|
|
8878
8981
|
}));
|
|
@@ -8887,7 +8990,7 @@ class DiagramCanvas {
|
|
|
8887
8990
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8888
8991
|
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && d.node) {
|
|
8889
8992
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
8890
|
-
this
|
|
8993
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
8891
8994
|
} else {
|
|
8892
8995
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8893
8996
|
}
|
|
@@ -8897,16 +9000,16 @@ class DiagramCanvas {
|
|
|
8897
9000
|
d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
8898
9001
|
}
|
|
8899
9002
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8900
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && this
|
|
9003
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
|
|
8901
9004
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8902
9005
|
if (this.gridConfig.snap) {
|
|
8903
9006
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
8904
9007
|
}
|
|
8905
9008
|
d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
8906
|
-
this.
|
|
8907
|
-
this.
|
|
8908
|
-
this.actionStack.add(this
|
|
8909
|
-
this
|
|
9009
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9010
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9011
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9012
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8910
9013
|
}
|
|
8911
9014
|
setCursorStyle();
|
|
8912
9015
|
}));
|
|
@@ -8921,7 +9024,7 @@ class DiagramCanvas {
|
|
|
8921
9024
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8922
9025
|
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && d.node) {
|
|
8923
9026
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
8924
|
-
this
|
|
9027
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
8925
9028
|
} else {
|
|
8926
9029
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8927
9030
|
}
|
|
@@ -8931,16 +9034,16 @@ class DiagramCanvas {
|
|
|
8931
9034
|
d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
8932
9035
|
}
|
|
8933
9036
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8934
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && this
|
|
9037
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
|
|
8935
9038
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8936
9039
|
if (this.gridConfig.snap) {
|
|
8937
9040
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
8938
9041
|
}
|
|
8939
9042
|
d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
8940
|
-
this.
|
|
8941
|
-
this.
|
|
8942
|
-
this.actionStack.add(this
|
|
8943
|
-
this
|
|
9043
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9044
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9045
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9046
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8944
9047
|
}
|
|
8945
9048
|
setCursorStyle();
|
|
8946
9049
|
}));
|
|
@@ -8955,7 +9058,7 @@ class DiagramCanvas {
|
|
|
8955
9058
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8956
9059
|
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && d.node) {
|
|
8957
9060
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
8958
|
-
this
|
|
9061
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
8959
9062
|
} else {
|
|
8960
9063
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8961
9064
|
}
|
|
@@ -8965,16 +9068,16 @@ class DiagramCanvas {
|
|
|
8965
9068
|
d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
8966
9069
|
}
|
|
8967
9070
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8968
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && this
|
|
9071
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
|
|
8969
9072
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8970
9073
|
if (this.gridConfig.snap) {
|
|
8971
9074
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
8972
9075
|
}
|
|
8973
9076
|
d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
8974
|
-
this.
|
|
8975
|
-
this.
|
|
8976
|
-
this.actionStack.add(this
|
|
8977
|
-
this
|
|
9077
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9078
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9079
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9080
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8978
9081
|
}
|
|
8979
9082
|
setCursorStyle();
|
|
8980
9083
|
}));
|
|
@@ -8989,7 +9092,7 @@ class DiagramCanvas {
|
|
|
8989
9092
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8990
9093
|
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
|
|
8991
9094
|
setCursorStyle(exports.CursorStyle.NWSEResize);
|
|
8992
|
-
this
|
|
9095
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
8993
9096
|
} else {
|
|
8994
9097
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8995
9098
|
}
|
|
@@ -9000,17 +9103,17 @@ class DiagramCanvas {
|
|
|
9000
9103
|
d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
9001
9104
|
}
|
|
9002
9105
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
9003
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this
|
|
9106
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
|
|
9004
9107
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
9005
9108
|
if (this.gridConfig.snap) {
|
|
9006
9109
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
9007
9110
|
}
|
|
9008
9111
|
d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
9009
9112
|
d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
9010
|
-
this.
|
|
9011
|
-
this.
|
|
9012
|
-
this.actionStack.add(this
|
|
9013
|
-
this
|
|
9113
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9114
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9115
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9116
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9014
9117
|
}
|
|
9015
9118
|
setCursorStyle();
|
|
9016
9119
|
}));
|
|
@@ -9025,7 +9128,7 @@ class DiagramCanvas {
|
|
|
9025
9128
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
9026
9129
|
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
|
|
9027
9130
|
setCursorStyle(exports.CursorStyle.NESWResize);
|
|
9028
|
-
this
|
|
9131
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
9029
9132
|
} else {
|
|
9030
9133
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
9031
9134
|
}
|
|
@@ -9036,17 +9139,17 @@ class DiagramCanvas {
|
|
|
9036
9139
|
d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
9037
9140
|
}
|
|
9038
9141
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
9039
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this
|
|
9142
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
|
|
9040
9143
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
9041
9144
|
if (this.gridConfig.snap) {
|
|
9042
9145
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
9043
9146
|
}
|
|
9044
9147
|
d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
9045
9148
|
d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
9046
|
-
this.
|
|
9047
|
-
this.
|
|
9048
|
-
this.actionStack.add(this
|
|
9049
|
-
this
|
|
9149
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9150
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9151
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9152
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9050
9153
|
}
|
|
9051
9154
|
setCursorStyle();
|
|
9052
9155
|
}));
|
|
@@ -9061,7 +9164,7 @@ class DiagramCanvas {
|
|
|
9061
9164
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
9062
9165
|
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
|
|
9063
9166
|
setCursorStyle(exports.CursorStyle.NESWResize);
|
|
9064
|
-
this
|
|
9167
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
9065
9168
|
} else {
|
|
9066
9169
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
9067
9170
|
}
|
|
@@ -9072,17 +9175,17 @@ class DiagramCanvas {
|
|
|
9072
9175
|
d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
9073
9176
|
}
|
|
9074
9177
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
9075
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this
|
|
9178
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
|
|
9076
9179
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
9077
9180
|
if (this.gridConfig.snap) {
|
|
9078
9181
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
9079
9182
|
}
|
|
9080
9183
|
d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
9081
9184
|
d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
9082
|
-
this.
|
|
9083
|
-
this.
|
|
9084
|
-
this.actionStack.add(this
|
|
9085
|
-
this
|
|
9185
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9186
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9187
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9188
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9086
9189
|
}
|
|
9087
9190
|
setCursorStyle();
|
|
9088
9191
|
}));
|
|
@@ -9097,7 +9200,7 @@ class DiagramCanvas {
|
|
|
9097
9200
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
9098
9201
|
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
|
|
9099
9202
|
setCursorStyle(exports.CursorStyle.NWSEResize);
|
|
9100
|
-
this
|
|
9203
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
9101
9204
|
} else {
|
|
9102
9205
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
9103
9206
|
}
|
|
@@ -9108,17 +9211,17 @@ class DiagramCanvas {
|
|
|
9108
9211
|
d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
9109
9212
|
}
|
|
9110
9213
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
9111
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this
|
|
9214
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === exports.DiagramActions.StretchSection && d.node) {
|
|
9112
9215
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
9113
9216
|
if (this.gridConfig.snap) {
|
|
9114
9217
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
9115
9218
|
}
|
|
9116
9219
|
d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
9117
9220
|
d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
9118
|
-
this.
|
|
9119
|
-
this.
|
|
9120
|
-
this.actionStack.add(this
|
|
9121
|
-
this
|
|
9221
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9222
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9223
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9224
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9122
9225
|
}
|
|
9123
9226
|
setCursorStyle();
|
|
9124
9227
|
}));
|
|
@@ -9134,7 +9237,7 @@ class DiagramCanvas {
|
|
|
9134
9237
|
mergeSelection.filter('.resizable-xy').select('rect.bottom-right-resizer').style('pointer-events', d => d.getResizableXY() ? 'initial' : 'none').attr('x', d => d.width - d.getResizerXY().thickness + d.getResizerXY().outerMargin).attr('y', d => d.height - d.getResizerXY().thickness + d.getResizerXY().outerMargin).attr('width', d => d.getResizerXY().thickness).attr('height', d => d.getResizerXY().thickness).attr('fill', d => d.getResizerXY().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerXY().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerXY().getLook(d).borderThickness || 0);
|
|
9135
9238
|
}
|
|
9136
9239
|
updatePortsInView(...ids) {
|
|
9137
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-port').data(this.model.ports.filter(e => this
|
|
9240
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-port').data(this.model.ports.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
|
|
9138
9241
|
const exitSelection = updateSelection.exit();
|
|
9139
9242
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-port ${d.look.lookType}`);
|
|
9140
9243
|
if (ids && ids.length > 0) {
|
|
@@ -9143,28 +9246,28 @@ class DiagramCanvas {
|
|
|
9143
9246
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
9144
9247
|
exitSelection.remove();
|
|
9145
9248
|
enterSelection.on(exports.Events.MouseOver, (_event, d) => {
|
|
9146
|
-
var
|
|
9147
|
-
if (!this
|
|
9249
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
9250
|
+
if (!__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") && !__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9148
9251
|
// if there is an unfinished connection, the port will be highlighted automatically if the pointer is close
|
|
9149
9252
|
this.userHighlight.focusOn(d);
|
|
9150
9253
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
9151
9254
|
}
|
|
9152
|
-
if (this
|
|
9255
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
|
|
9153
9256
|
const canConnectionFinishAtThisPort =
|
|
9154
9257
|
// can start at the starting port
|
|
9155
|
-
this.
|
|
9258
|
+
__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canStartFromType(((_d = (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_e = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _e === void 0 ? void 0 : _e.allowsOutgoing) &&
|
|
9156
9259
|
// can end at the ending port
|
|
9157
|
-
this.
|
|
9260
|
+
__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canFinishOnType(((_g = (_f = d.getNode()) === null || _f === void 0 ? void 0 : _f.type) === null || _g === void 0 ? void 0 : _g.id) || '') && d.allowsIncoming ||
|
|
9158
9261
|
// can start at the ending port
|
|
9159
|
-
this.
|
|
9262
|
+
__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canStartFromType(((_j = (_h = d.getNode()) === null || _h === void 0 ? void 0 : _h.type) === null || _j === void 0 ? void 0 : _j.id) || '') && d.allowsOutgoing &&
|
|
9160
9263
|
// can end at the starting port
|
|
9161
|
-
this.
|
|
9264
|
+
__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canFinishOnType(((_m = (_l = (_k = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _k === void 0 ? void 0 : _k.getNode()) === null || _l === void 0 ? void 0 : _l.type) === null || _m === void 0 ? void 0 : _m.id) || '') && ((_o = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _o === void 0 ? void 0 : _o.allowsIncoming);
|
|
9162
9265
|
if (!canConnectionFinishAtThisPort) {
|
|
9163
9266
|
setCursorStyle(exports.CursorStyle.NoDrop);
|
|
9164
9267
|
}
|
|
9165
9268
|
}
|
|
9166
9269
|
}).on(exports.Events.MouseOut, () => {
|
|
9167
|
-
if (this
|
|
9270
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
|
|
9168
9271
|
setCursorStyle(exports.CursorStyle.Grabbing);
|
|
9169
9272
|
}
|
|
9170
9273
|
}).on(exports.Events.Click, (event, d) => {
|
|
@@ -9177,10 +9280,10 @@ class DiagramCanvas {
|
|
|
9177
9280
|
this.userSelection.toggle(elementToBeToggled);
|
|
9178
9281
|
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
9179
9282
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
9180
|
-
if (this
|
|
9283
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9181
9284
|
event.preventDefault();
|
|
9182
9285
|
event.stopPropagation();
|
|
9183
|
-
this
|
|
9286
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
9184
9287
|
return;
|
|
9185
9288
|
}
|
|
9186
9289
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -9198,33 +9301,33 @@ class DiagramCanvas {
|
|
|
9198
9301
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
9199
9302
|
this.diagramEvent$.next(diagramEvent);
|
|
9200
9303
|
}).call(d3__namespace.drag().filter(event => {
|
|
9201
|
-
this
|
|
9304
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
9202
9305
|
return true;
|
|
9203
9306
|
}).on(exports.DragEvents.Start, (event, d) => {
|
|
9204
|
-
if (this.multipleSelectionOn || this
|
|
9205
|
-
this.
|
|
9307
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9308
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
9206
9309
|
} else {
|
|
9207
9310
|
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.filter(c => !c.removed).length === 0 && d.outgoingConnections.filter(c => !c.removed).length === 0) && !d.removed) {
|
|
9208
9311
|
setCursorStyle(exports.CursorStyle.Grabbing);
|
|
9209
|
-
this.
|
|
9312
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startConnection).call(this, d);
|
|
9210
9313
|
// should be true after having called this.startConnection()
|
|
9211
|
-
if (this
|
|
9212
|
-
this
|
|
9314
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
|
|
9315
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionTracer, this.selectCanvasElements().append('path').attr('stroke', 'none').attr('fill', 'none'), "f");
|
|
9213
9316
|
}
|
|
9214
9317
|
} else {
|
|
9215
9318
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
9216
9319
|
}
|
|
9217
9320
|
}
|
|
9218
9321
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
9219
|
-
var
|
|
9220
|
-
if (this.multipleSelectionOn || this
|
|
9221
|
-
this.
|
|
9322
|
+
var _b, _c, _d, _e, _f;
|
|
9323
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9324
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
9222
9325
|
} else {
|
|
9223
9326
|
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
|
|
9224
|
-
if (this
|
|
9327
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") !== undefined) {
|
|
9225
9328
|
const endCoords = [event.x, event.y];
|
|
9226
|
-
(
|
|
9227
|
-
const unfinishedConnectionGhostNode = (
|
|
9329
|
+
(_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionTracer, "f")) === null || _b === void 0 ? void 0 : _b.attr('d', getConnectionPath(__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").startCoords, endCoords, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").startDirection, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endDirection, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").points, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_c = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.defaultStartMarkerLook) === null || _c === void 0 ? void 0 : _c.width, (_d = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.defaultEndMarkerLook) === null || _d === void 0 ? void 0 : _d.width));
|
|
9330
|
+
const unfinishedConnectionGhostNode = (_e = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionTracer, "f")) === null || _e === void 0 ? void 0 : _e.node();
|
|
9228
9331
|
if (unfinishedConnectionGhostNode) {
|
|
9229
9332
|
let margin = 2;
|
|
9230
9333
|
const unfinishedConnectionTotalLength = unfinishedConnectionGhostNode.getTotalLength();
|
|
@@ -9232,13 +9335,13 @@ class DiagramCanvas {
|
|
|
9232
9335
|
margin = 0;
|
|
9233
9336
|
}
|
|
9234
9337
|
const beforeUnfinishedConnectionEnd = unfinishedConnectionGhostNode.getPointAtLength(unfinishedConnectionTotalLength - margin);
|
|
9235
|
-
this.
|
|
9338
|
+
__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endCoords = [beforeUnfinishedConnectionEnd.x, beforeUnfinishedConnectionEnd.y];
|
|
9236
9339
|
} else {
|
|
9237
9340
|
// if it fails, just use the event coordinates
|
|
9238
|
-
this.
|
|
9341
|
+
__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endCoords = endCoords;
|
|
9239
9342
|
}
|
|
9240
9343
|
this.updateConnectionsInView(UNFINISHED_CONNECTION_ID);
|
|
9241
|
-
(
|
|
9344
|
+
(_f = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionPort, "f")) === null || _f === void 0 ? void 0 : _f.raise(false);
|
|
9242
9345
|
// highlight closest target port
|
|
9243
9346
|
if (this.model.ports.length > 0) {
|
|
9244
9347
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
@@ -9261,17 +9364,17 @@ class DiagramCanvas {
|
|
|
9261
9364
|
}
|
|
9262
9365
|
}
|
|
9263
9366
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
9264
|
-
var
|
|
9265
|
-
if (this.multipleSelectionOn || this
|
|
9266
|
-
this.
|
|
9367
|
+
var _b;
|
|
9368
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9369
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
9267
9370
|
} else {
|
|
9268
9371
|
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
|
|
9269
|
-
(
|
|
9372
|
+
(_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionTracer, "f")) === null || _b === void 0 ? void 0 : _b.remove();
|
|
9270
9373
|
const userHighlight = this.userHighlight.getFocus();
|
|
9271
9374
|
if (userHighlight instanceof DiagramPort) {
|
|
9272
|
-
this.
|
|
9375
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishConnection).call(this, userHighlight);
|
|
9273
9376
|
} else if (userHighlight instanceof DiagramField && userHighlight.rootElement instanceof DiagramPort) {
|
|
9274
|
-
this.
|
|
9377
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishConnection).call(this, userHighlight.rootElement);
|
|
9275
9378
|
} else if (userHighlight instanceof DiagramNode || userHighlight instanceof DiagramSection || userHighlight instanceof DiagramField) {
|
|
9276
9379
|
let targetRootElement;
|
|
9277
9380
|
if (userHighlight instanceof DiagramNode || userHighlight instanceof DiagramSection) {
|
|
@@ -9279,22 +9382,22 @@ class DiagramCanvas {
|
|
|
9279
9382
|
} else if (userHighlight.rootElement instanceof DiagramNode || userHighlight.rootElement instanceof DiagramSection) {
|
|
9280
9383
|
targetRootElement = userHighlight.rootElement;
|
|
9281
9384
|
} else {
|
|
9282
|
-
this.
|
|
9385
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
9283
9386
|
return;
|
|
9284
9387
|
}
|
|
9285
9388
|
const closestPort = targetRootElement.getClosestPortToPoint([event.x, event.y]);
|
|
9286
9389
|
if (closestPort !== undefined) {
|
|
9287
|
-
this.
|
|
9390
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishConnection).call(this, closestPort);
|
|
9288
9391
|
} else {
|
|
9289
|
-
this.
|
|
9392
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
9290
9393
|
}
|
|
9291
9394
|
} else {
|
|
9292
|
-
this.
|
|
9395
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
9293
9396
|
}
|
|
9294
9397
|
}
|
|
9295
9398
|
setCursorStyle();
|
|
9296
9399
|
}
|
|
9297
|
-
this
|
|
9400
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
|
|
9298
9401
|
}));
|
|
9299
9402
|
enterSelection.filter('.image-look').append('image');
|
|
9300
9403
|
initializeLook(enterSelection);
|
|
@@ -9302,9 +9405,9 @@ class DiagramCanvas {
|
|
|
9302
9405
|
updateLook(mergeSelection);
|
|
9303
9406
|
}
|
|
9304
9407
|
updateConnectionsInView(...ids) {
|
|
9305
|
-
const connectionList = this.model.connections.filter(e => this
|
|
9306
|
-
if (this
|
|
9307
|
-
connectionList.push(this
|
|
9408
|
+
const connectionList = this.model.connections.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true);
|
|
9409
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
|
|
9410
|
+
connectionList.push(__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f"));
|
|
9308
9411
|
}
|
|
9309
9412
|
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-connection').data(connectionList, d => d.id);
|
|
9310
9413
|
const exitSelection = updateSelection.exit();
|
|
@@ -9315,7 +9418,7 @@ class DiagramCanvas {
|
|
|
9315
9418
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
9316
9419
|
exitSelection.remove();
|
|
9317
9420
|
enterSelection.on(exports.Events.MouseOver, (_event, d) => {
|
|
9318
|
-
if (d.end !== undefined && !this
|
|
9421
|
+
if (d.end !== undefined && !__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9319
9422
|
this.userHighlight.focusOn(d);
|
|
9320
9423
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
9321
9424
|
}
|
|
@@ -9328,10 +9431,10 @@ class DiagramCanvas {
|
|
|
9328
9431
|
this.userSelection.toggle(d);
|
|
9329
9432
|
this.diagramEvent$.next(new DiagramSelectionEvent([d], d.selected));
|
|
9330
9433
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
9331
|
-
if (this
|
|
9434
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9332
9435
|
event.preventDefault();
|
|
9333
9436
|
event.stopPropagation();
|
|
9334
|
-
this
|
|
9437
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
9335
9438
|
return;
|
|
9336
9439
|
}
|
|
9337
9440
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -9348,14 +9451,14 @@ class DiagramCanvas {
|
|
|
9348
9451
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
9349
9452
|
this.diagramEvent$.next(diagramEvent);
|
|
9350
9453
|
}).call(d3__namespace.drag().filter(event => {
|
|
9351
|
-
this
|
|
9454
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
9352
9455
|
return true;
|
|
9353
9456
|
}).on(exports.DragEvents.Start, event => {
|
|
9354
|
-
this.
|
|
9457
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
9355
9458
|
}).on(exports.DragEvents.Drag, event => {
|
|
9356
|
-
this.
|
|
9459
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
9357
9460
|
}).on(exports.DragEvents.End, event => {
|
|
9358
|
-
this.
|
|
9461
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
9359
9462
|
}));
|
|
9360
9463
|
enterSelection.append('path').attr('class', 'diagram-connection-path');
|
|
9361
9464
|
enterSelection.append('path').attr('class', 'diagram-connection-path-box');
|
|
@@ -9371,22 +9474,22 @@ class DiagramCanvas {
|
|
|
9371
9474
|
enterSelection.select('g.diagram-connection-end-label').append('path');
|
|
9372
9475
|
enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
|
|
9373
9476
|
mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
|
|
9374
|
-
var
|
|
9375
|
-
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.points, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (
|
|
9477
|
+
var _b, _c;
|
|
9478
|
+
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.points, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_b = d.type.defaultStartMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = d.type.defaultEndMarkerLook) === null || _c === void 0 ? void 0 : _c.width);
|
|
9376
9479
|
}).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.look.color || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.color).attr('stroke-width', d => d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
|
|
9377
9480
|
mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
|
|
9378
|
-
var
|
|
9379
|
-
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.points, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (
|
|
9481
|
+
var _b, _c;
|
|
9482
|
+
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.points, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_b = d.type.defaultStartMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = d.type.defaultEndMarkerLook) === null || _c === void 0 ? void 0 : _c.width);
|
|
9380
9483
|
}).attr('stroke', 'transparent')
|
|
9381
9484
|
// allow generating pointer events even when it is transparent
|
|
9382
9485
|
.attr('pointer-events', 'stroke').attr('stroke-width', d => (d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness) + CONNECTION_PATH_BOX_THICKNESS).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
|
|
9383
9486
|
mergeSelection.data().forEach(connection => {
|
|
9384
|
-
this.
|
|
9385
|
-
this.
|
|
9487
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_updateConnectionLabelsInView).call(this, connection);
|
|
9488
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_updateConnectionMarkersInView).call(this, connection);
|
|
9386
9489
|
});
|
|
9387
9490
|
}
|
|
9388
9491
|
updateFieldsInView(...ids) {
|
|
9389
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-field').data(this.model.fields.filter(e => this
|
|
9492
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-field').data(this.model.fields.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
|
|
9390
9493
|
const exitSelection = updateSelection.exit();
|
|
9391
9494
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-field');
|
|
9392
9495
|
if (ids && ids.length > 0) {
|
|
@@ -9395,7 +9498,7 @@ class DiagramCanvas {
|
|
|
9395
9498
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
9396
9499
|
exitSelection.remove();
|
|
9397
9500
|
enterSelection.on(exports.Events.MouseOver, (_event, d) => {
|
|
9398
|
-
if (!this
|
|
9501
|
+
if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9399
9502
|
this.userHighlight.focusOn(d);
|
|
9400
9503
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
9401
9504
|
}
|
|
@@ -9409,10 +9512,10 @@ class DiagramCanvas {
|
|
|
9409
9512
|
this.userSelection.toggle(elementToBeToggled);
|
|
9410
9513
|
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
9411
9514
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
9412
|
-
if (this
|
|
9515
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9413
9516
|
event.preventDefault();
|
|
9414
9517
|
event.stopPropagation();
|
|
9415
|
-
this
|
|
9518
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
9416
9519
|
return;
|
|
9417
9520
|
}
|
|
9418
9521
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -9430,15 +9533,14 @@ class DiagramCanvas {
|
|
|
9430
9533
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
9431
9534
|
this.diagramEvent$.next(diagramEvent);
|
|
9432
9535
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.EditField) && d.editable && !d.removed) {
|
|
9433
|
-
this.currentAction = new EditFieldAction(this, d.id, d.text, '');
|
|
9434
9536
|
this.openTextInput(d.id);
|
|
9435
9537
|
}
|
|
9436
9538
|
}).call(d3__namespace.drag().filter(event => {
|
|
9437
|
-
this
|
|
9539
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
9438
9540
|
return true;
|
|
9439
9541
|
}).on(exports.DragEvents.Start, (event, d) => {
|
|
9440
|
-
if (this.multipleSelectionOn || this
|
|
9441
|
-
this.
|
|
9542
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9543
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
9442
9544
|
} else {
|
|
9443
9545
|
let node;
|
|
9444
9546
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9447,14 +9549,14 @@ class DiagramCanvas {
|
|
|
9447
9549
|
node = d.rootElement.node;
|
|
9448
9550
|
}
|
|
9449
9551
|
if (node) {
|
|
9450
|
-
this.
|
|
9552
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, node);
|
|
9451
9553
|
} else {
|
|
9452
9554
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
9453
9555
|
}
|
|
9454
9556
|
}
|
|
9455
9557
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
9456
|
-
if (this.multipleSelectionOn || this
|
|
9457
|
-
this.
|
|
9558
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9559
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
9458
9560
|
} else {
|
|
9459
9561
|
let node;
|
|
9460
9562
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9463,14 +9565,14 @@ class DiagramCanvas {
|
|
|
9463
9565
|
node = d.rootElement.node;
|
|
9464
9566
|
}
|
|
9465
9567
|
if (node) {
|
|
9466
|
-
this.
|
|
9568
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, node);
|
|
9467
9569
|
} else {
|
|
9468
9570
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
9469
9571
|
}
|
|
9470
9572
|
}
|
|
9471
9573
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
9472
|
-
if (this.multipleSelectionOn || this
|
|
9473
|
-
this.
|
|
9574
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9575
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
9474
9576
|
} else {
|
|
9475
9577
|
let node;
|
|
9476
9578
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9479,24 +9581,24 @@ class DiagramCanvas {
|
|
|
9479
9581
|
node = d.rootElement.node;
|
|
9480
9582
|
}
|
|
9481
9583
|
if (node) {
|
|
9482
|
-
this.
|
|
9584
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, node);
|
|
9483
9585
|
} else {
|
|
9484
9586
|
setCursorStyle();
|
|
9485
9587
|
}
|
|
9486
9588
|
}
|
|
9487
|
-
this
|
|
9589
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
|
|
9488
9590
|
}));
|
|
9489
9591
|
enterSelection.append('text').style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
|
|
9490
9592
|
enterSelection.append('rect');
|
|
9491
9593
|
mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]}) rotate(${d.orientation} ${d.width / 2} ${d.height / 2})`).attr('opacity', d => d.removed ? 0.5 : 1).select('text').attr('x', d => d.horizontalAlign === exports.HorizontalAlign.Center ? d.width / 2 : d.horizontalAlign === exports.HorizontalAlign.Right ? d.width : 0).attr('text-anchor', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'middle' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'end' : 'start').attr('y', d => d.verticalAlign === exports.VerticalAlign.Center ? d.height / 2 : d.verticalAlign === exports.VerticalAlign.Bottom ? d.height : 0).attr('dominant-baseline', d => d.verticalAlign === exports.VerticalAlign.Center ? 'middle' : d.verticalAlign === exports.VerticalAlign.Bottom ? 'auto' : 'hanging').attr('font-size', d => d.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('font-family', d => d.look.fontFamily || "'Wonder Unit Sans', sans-serif").attr('font-weight', d => d.look.fontWeight || DIAGRAM_FIELD_DEFAULTS.look.fontWeight).attr('fill', d => d.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fontColor).style('font-kerning', 'none').each(d => {
|
|
9492
|
-
this.
|
|
9594
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_setFieldTextAndWrap).call(this, d);
|
|
9493
9595
|
});
|
|
9494
9596
|
mergeSelection
|
|
9495
9597
|
// add a transparent rectangle to capture pointer events on the text
|
|
9496
9598
|
.select('rect').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('fill', 'transparent');
|
|
9497
9599
|
}
|
|
9498
9600
|
updateObjectsInView(...ids) {
|
|
9499
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-object').data(this.model.objects.filter(e => this
|
|
9601
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-object').data(this.model.objects.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
|
|
9500
9602
|
const exitSelection = updateSelection.exit();
|
|
9501
9603
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-object');
|
|
9502
9604
|
if (ids && ids.length > 0) {
|
|
@@ -9506,10 +9608,10 @@ class DiagramCanvas {
|
|
|
9506
9608
|
mergeSelection.attr('width', d => d.width).attr('height', d => d.height).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.svg);
|
|
9507
9609
|
exitSelection.remove();
|
|
9508
9610
|
enterSelection.on(exports.Events.ContextMenu, (event, d) => {
|
|
9509
|
-
if (this
|
|
9611
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9510
9612
|
event.preventDefault();
|
|
9511
9613
|
event.stopPropagation();
|
|
9512
|
-
this
|
|
9614
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
9513
9615
|
return;
|
|
9514
9616
|
}
|
|
9515
9617
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -9522,24 +9624,24 @@ class DiagramCanvas {
|
|
|
9522
9624
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
9523
9625
|
this.diagramEvent$.next(diagramEvent);
|
|
9524
9626
|
}).call(d3__namespace.drag().filter(event => {
|
|
9525
|
-
this
|
|
9627
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
9526
9628
|
return true;
|
|
9527
9629
|
}).on(exports.DragEvents.Start, event => {
|
|
9528
|
-
if (this.multipleSelectionOn || this
|
|
9529
|
-
this.
|
|
9630
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9631
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
9530
9632
|
}
|
|
9531
9633
|
}).on(exports.DragEvents.Drag, event => {
|
|
9532
|
-
if (this.multipleSelectionOn || this
|
|
9533
|
-
this.
|
|
9634
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9635
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
9534
9636
|
}
|
|
9535
9637
|
}).on(exports.DragEvents.End, event => {
|
|
9536
|
-
if (this.multipleSelectionOn || this
|
|
9537
|
-
this.
|
|
9638
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9639
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
9538
9640
|
}
|
|
9539
9641
|
}));
|
|
9540
9642
|
}
|
|
9541
9643
|
updateDecoratorsInView(...ids) {
|
|
9542
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-decorator').data(this.model.decorators.filter(e => this
|
|
9644
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-decorator').data(this.model.decorators.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true), d => d.id);
|
|
9543
9645
|
const exitSelection = updateSelection.exit();
|
|
9544
9646
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-decorator');
|
|
9545
9647
|
if (ids && ids.length > 0) {
|
|
@@ -9549,7 +9651,7 @@ class DiagramCanvas {
|
|
|
9549
9651
|
mergeSelection.attr('width', d => d.width).attr('height', d => d.height).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.svg);
|
|
9550
9652
|
exitSelection.remove();
|
|
9551
9653
|
enterSelection.on(exports.Events.MouseOver, (_event, d) => {
|
|
9552
|
-
if (!this
|
|
9654
|
+
if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9553
9655
|
this.userHighlight.focusOn(d);
|
|
9554
9656
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
9555
9657
|
}
|
|
@@ -9565,10 +9667,10 @@ class DiagramCanvas {
|
|
|
9565
9667
|
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
9566
9668
|
}
|
|
9567
9669
|
}).on(exports.Events.ContextMenu, (event, d) => {
|
|
9568
|
-
if (this
|
|
9670
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9569
9671
|
event.preventDefault();
|
|
9570
9672
|
event.stopPropagation();
|
|
9571
|
-
this
|
|
9673
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
9572
9674
|
return;
|
|
9573
9675
|
}
|
|
9574
9676
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -9588,11 +9690,11 @@ class DiagramCanvas {
|
|
|
9588
9690
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
9589
9691
|
this.diagramEvent$.next(diagramEvent);
|
|
9590
9692
|
}).call(d3__namespace.drag().filter(event => {
|
|
9591
|
-
this
|
|
9693
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
9592
9694
|
return true;
|
|
9593
9695
|
}).on(exports.DragEvents.Start, (event, d) => {
|
|
9594
|
-
if (this.multipleSelectionOn || this
|
|
9595
|
-
this.
|
|
9696
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9697
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
9596
9698
|
} else {
|
|
9597
9699
|
let node;
|
|
9598
9700
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9601,14 +9703,14 @@ class DiagramCanvas {
|
|
|
9601
9703
|
node = d.rootElement.node;
|
|
9602
9704
|
}
|
|
9603
9705
|
if (node) {
|
|
9604
|
-
this.
|
|
9706
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, node);
|
|
9605
9707
|
} else {
|
|
9606
9708
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
9607
9709
|
}
|
|
9608
9710
|
}
|
|
9609
9711
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
9610
|
-
if (this.multipleSelectionOn || this
|
|
9611
|
-
this.
|
|
9712
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9713
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
9612
9714
|
} else {
|
|
9613
9715
|
let node;
|
|
9614
9716
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9617,14 +9719,14 @@ class DiagramCanvas {
|
|
|
9617
9719
|
node = d.rootElement.node;
|
|
9618
9720
|
}
|
|
9619
9721
|
if (node) {
|
|
9620
|
-
this.
|
|
9722
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, node);
|
|
9621
9723
|
} else {
|
|
9622
9724
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
9623
9725
|
}
|
|
9624
9726
|
}
|
|
9625
9727
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
9626
|
-
if (this.multipleSelectionOn || this
|
|
9627
|
-
this.
|
|
9728
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9729
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
9628
9730
|
} else {
|
|
9629
9731
|
let node;
|
|
9630
9732
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9633,187 +9735,76 @@ class DiagramCanvas {
|
|
|
9633
9735
|
node = d.rootElement.node;
|
|
9634
9736
|
}
|
|
9635
9737
|
if (node) {
|
|
9636
|
-
this.
|
|
9738
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, node);
|
|
9637
9739
|
} else {
|
|
9638
9740
|
setCursorStyle();
|
|
9639
9741
|
}
|
|
9640
9742
|
}
|
|
9641
|
-
this
|
|
9743
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
|
|
9642
9744
|
}));
|
|
9643
9745
|
}
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
const
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
if (pathNode) {
|
|
9652
|
-
const pathLength = pathNode.getTotalLength();
|
|
9653
|
-
let startLabelShiftX = 0;
|
|
9654
|
-
let startLabelShiftY = 0;
|
|
9655
|
-
let middleLabelShiftX = 0;
|
|
9656
|
-
let middleLabelShiftY = 0;
|
|
9657
|
-
let endLabelShiftX = 0;
|
|
9658
|
-
let endLabelShiftY = 0;
|
|
9659
|
-
if (labelConfiguration.look.fillColor === 'transparent') {
|
|
9660
|
-
// background color is transparent / not set, so we find an alternative position for the label
|
|
9661
|
-
const deltaX = connection.endCoords[0] - connection.startCoords[0];
|
|
9662
|
-
const deltaY = connection.endCoords[1] - connection.startCoords[1];
|
|
9663
|
-
switch (connection.startDirection) {
|
|
9664
|
-
case exports.Side.Top:
|
|
9665
|
-
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
9666
|
-
endLabelShiftX = startLabelShiftX;
|
|
9667
|
-
break;
|
|
9668
|
-
case exports.Side.Bottom:
|
|
9669
|
-
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
9670
|
-
endLabelShiftX = startLabelShiftX;
|
|
9671
|
-
break;
|
|
9672
|
-
case exports.Side.Left:
|
|
9673
|
-
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9674
|
-
endLabelShiftY = startLabelShiftY;
|
|
9675
|
-
break;
|
|
9676
|
-
case exports.Side.Right:
|
|
9677
|
-
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9678
|
-
endLabelShiftY = startLabelShiftY;
|
|
9679
|
-
break;
|
|
9680
|
-
default:
|
|
9681
|
-
startLabelShiftX = 0.5;
|
|
9682
|
-
endLabelShiftX = startLabelShiftX;
|
|
9683
|
-
startLabelShiftY = -0.5;
|
|
9684
|
-
endLabelShiftY = startLabelShiftY;
|
|
9685
|
-
}
|
|
9686
|
-
switch (connection.endDirection) {
|
|
9687
|
-
case exports.Side.Top:
|
|
9688
|
-
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
9689
|
-
break;
|
|
9690
|
-
case exports.Side.Bottom:
|
|
9691
|
-
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
9692
|
-
break;
|
|
9693
|
-
case exports.Side.Left:
|
|
9694
|
-
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
9695
|
-
break;
|
|
9696
|
-
case exports.Side.Right:
|
|
9697
|
-
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
9698
|
-
break;
|
|
9699
|
-
default:
|
|
9700
|
-
endLabelShiftX = 0.5;
|
|
9701
|
-
endLabelShiftY = -0.5;
|
|
9702
|
-
}
|
|
9703
|
-
if (Math.abs(deltaX) >= Math.abs(deltaY)) {
|
|
9704
|
-
// horizontal quadrant
|
|
9705
|
-
middleLabelShiftX = deltaX > 0 ? -0.5 : 0.5;
|
|
9706
|
-
middleLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
9707
|
-
} else {
|
|
9708
|
-
// vertical quadrant
|
|
9709
|
-
middleLabelShiftX = deltaX > 0 ? 0.5 : -0.5;
|
|
9710
|
-
middleLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9711
|
-
}
|
|
9712
|
-
}
|
|
9713
|
-
// bind start labels
|
|
9714
|
-
connectionSelection.select('g.diagram-connection-start-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fontColor).text(connection.startLabel);
|
|
9715
|
-
const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
9716
|
-
if (startLabelBoundingRect) {
|
|
9717
|
-
// don't create space for the label if the label is empty
|
|
9718
|
-
const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
9719
|
-
const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
9720
|
-
let pathStartLabelPoint;
|
|
9721
|
-
switch (connection.startDirection) {
|
|
9722
|
-
case exports.Side.Left:
|
|
9723
|
-
pathStartLabelPoint = pathNode.getPointAtLength(getRightMargin(labelConfiguration) + boundingWidth / 2);
|
|
9724
|
-
break;
|
|
9725
|
-
case exports.Side.Right:
|
|
9726
|
-
pathStartLabelPoint = pathNode.getPointAtLength(getLeftMargin(labelConfiguration) + boundingWidth / 2);
|
|
9727
|
-
break;
|
|
9728
|
-
case exports.Side.Top:
|
|
9729
|
-
pathStartLabelPoint = pathNode.getPointAtLength(getBottomMargin(labelConfiguration) + boundingHeight / 2);
|
|
9730
|
-
break;
|
|
9731
|
-
case exports.Side.Bottom:
|
|
9732
|
-
pathStartLabelPoint = pathNode.getPointAtLength(getTopMargin(labelConfiguration) + boundingHeight / 2);
|
|
9733
|
-
break;
|
|
9734
|
-
default:
|
|
9735
|
-
pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
9736
|
-
}
|
|
9737
|
-
connectionSelection.select('g.diagram-connection-start-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
|
|
9738
|
-
connectionSelection.select('g.diagram-connection-start-label').attr('transform', `translate(${pathStartLabelPoint.x + startLabelShiftX * boundingWidth},${pathStartLabelPoint.y + startLabelShiftY * boundingHeight})`);
|
|
9739
|
-
}
|
|
9740
|
-
// bind middle labels
|
|
9741
|
-
connectionSelection.select('g.diagram-connection-middle-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).style('font-kerning', 'none').text(connection.middleLabel);
|
|
9742
|
-
const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
9743
|
-
if (middleLabelBoundingRect) {
|
|
9744
|
-
// don't create space for the label if the label is empty
|
|
9745
|
-
const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
9746
|
-
const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
9747
|
-
const pathMiddleLabelPoint = pathNode.getPointAtLength(pathLength / 2);
|
|
9748
|
-
connectionSelection.select('g.diagram-connection-middle-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
|
|
9749
|
-
connectionSelection.select('g.diagram-connection-middle-label').attr('transform', `translate(${pathMiddleLabelPoint.x + middleLabelShiftX * boundingWidth},${pathMiddleLabelPoint.y + middleLabelShiftY * boundingHeight})`);
|
|
9750
|
-
}
|
|
9751
|
-
// bind end labels
|
|
9752
|
-
connectionSelection.select('g.diagram-connection-end-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fontColor).style('font-kerning', 'none').text(connection.endLabel);
|
|
9753
|
-
const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
9754
|
-
if (endLabelBoundingRect) {
|
|
9755
|
-
// don't create space for the label if the label is empty
|
|
9756
|
-
const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
9757
|
-
const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
9758
|
-
let pathEndLabelPoint;
|
|
9759
|
-
switch (connection.endDirection) {
|
|
9760
|
-
case exports.Side.Left:
|
|
9761
|
-
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getRightMargin(labelConfiguration) + boundingWidth / 2));
|
|
9762
|
-
break;
|
|
9763
|
-
case exports.Side.Right:
|
|
9764
|
-
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getLeftMargin(labelConfiguration) + boundingWidth / 2));
|
|
9765
|
-
break;
|
|
9766
|
-
case exports.Side.Top:
|
|
9767
|
-
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
9768
|
-
break;
|
|
9769
|
-
case exports.Side.Bottom:
|
|
9770
|
-
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getTopMargin(labelConfiguration) + boundingHeight / 2));
|
|
9771
|
-
break;
|
|
9772
|
-
default:
|
|
9773
|
-
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
9774
|
-
}
|
|
9775
|
-
connectionSelection.select('g.diagram-connection-end-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
|
|
9776
|
-
connectionSelection.select('g.diagram-connection-end-label').attr('transform', `translate(${pathEndLabelPoint.x + endLabelShiftX * boundingWidth},${pathEndLabelPoint.y + endLabelShiftY * boundingHeight})`);
|
|
9777
|
-
}
|
|
9778
|
-
}
|
|
9779
|
-
}
|
|
9780
|
-
updateConnectionMarkersInView(connection) {
|
|
9781
|
-
const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
|
|
9782
|
-
const startMarkerSelection = connectionSelection.select('marker.diagram-connection-start-marker');
|
|
9783
|
-
const endMarkerSelection = connectionSelection.select('marker.diagram-connection-end-marker');
|
|
9784
|
-
if (connection.startMarkerLook !== null) {
|
|
9785
|
-
startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.startMarkerLook.width).attr('markerHeight', connection.startMarkerLook.height).attr('refX', connection.startMarkerLook.refX).attr('refY', connection.startMarkerLook.refY).select('image').attr('href', connection.startMarkerLook.image).attr('width', connection.startMarkerLook.width).attr('height', connection.startMarkerLook.height);
|
|
9786
|
-
} else {
|
|
9787
|
-
startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
|
|
9788
|
-
}
|
|
9789
|
-
if (connection.endMarkerLook !== null) {
|
|
9790
|
-
endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.endMarkerLook.width).attr('markerHeight', connection.endMarkerLook.height).attr('refX', connection.endMarkerLook.refX).attr('refY', connection.endMarkerLook.refY).select('image').attr('href', connection.endMarkerLook.image).attr('width', connection.endMarkerLook.width).attr('height', connection.endMarkerLook.height);
|
|
9791
|
-
} else {
|
|
9792
|
-
endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
|
|
9746
|
+
bringToFront(node) {
|
|
9747
|
+
const overlappingNodes = this.model.nodes.filter(n => n.id !== node.id && rectanglesIntersect([n.coords, [n.coords[0] + n.width, n.coords[1] + n.height]], [node.coords, [node.coords[0] + node.width, node.coords[1] + node.height]]));
|
|
9748
|
+
let maximumZ = node.z;
|
|
9749
|
+
for (const n of overlappingNodes) {
|
|
9750
|
+
if (n.z > maximumZ) {
|
|
9751
|
+
maximumZ = n.z;
|
|
9752
|
+
}
|
|
9793
9753
|
}
|
|
9754
|
+
maximumZ += 1;
|
|
9755
|
+
const action = new SetGeometryAction(this, exports.DiagramActions.MoveNode, node.id, node.getGeometry(), node.getGeometry());
|
|
9756
|
+
node.setGeometry(Object.assign(Object.assign({}, node.getGeometry()), {
|
|
9757
|
+
z: maximumZ
|
|
9758
|
+
}));
|
|
9759
|
+
node.raiseWithZ();
|
|
9760
|
+
action.to = node.getGeometry();
|
|
9761
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, action, "f");
|
|
9762
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9763
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9764
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9765
|
+
}
|
|
9766
|
+
sendToBack(node) {
|
|
9767
|
+
const overlappingNodes = this.model.nodes.filter(n => n.id !== node.id && rectanglesIntersect([n.coords, [n.coords[0] + n.width, n.coords[1] + n.height]], [node.coords, [node.coords[0] + node.width, node.coords[1] + node.height]]));
|
|
9768
|
+
let minimumZ = node.z;
|
|
9769
|
+
for (const n of overlappingNodes) {
|
|
9770
|
+
if (n.z < minimumZ) {
|
|
9771
|
+
minimumZ = n.z;
|
|
9772
|
+
}
|
|
9773
|
+
}
|
|
9774
|
+
minimumZ -= 1;
|
|
9775
|
+
const action = new SetGeometryAction(this, exports.DiagramActions.MoveNode, node.id, node.getGeometry(), node.getGeometry());
|
|
9776
|
+
node.setGeometry(Object.assign(Object.assign({}, node.getGeometry()), {
|
|
9777
|
+
z: minimumZ
|
|
9778
|
+
}));
|
|
9779
|
+
node.raiseWithZ();
|
|
9780
|
+
action.to = node.getGeometry();
|
|
9781
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, action, "f");
|
|
9782
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9783
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9784
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9794
9785
|
}
|
|
9795
9786
|
fieldRootFitsInView(id) {
|
|
9796
|
-
var
|
|
9787
|
+
var _b, _c, _d, _e;
|
|
9797
9788
|
const field = this.model.fields.get(id);
|
|
9798
9789
|
if (!field) {
|
|
9799
9790
|
return false;
|
|
9800
9791
|
}
|
|
9801
9792
|
if (field.rootElement instanceof DiagramNode || field.rootElement instanceof DiagramSection) {
|
|
9802
|
-
const fieldDimensions = this.
|
|
9803
|
-
const stretchX = fieldDimensions[0] + getLeftMargin((
|
|
9804
|
-
const stretchY = fieldDimensions[1] + getTopMargin((
|
|
9793
|
+
const fieldDimensions = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
|
|
9794
|
+
const stretchX = fieldDimensions[0] + getLeftMargin((_b = field.rootElement.type) === null || _b === void 0 ? void 0 : _b.label) + getRightMargin((_c = field.rootElement.type) === null || _c === void 0 ? void 0 : _c.label) - field.rootElement.width;
|
|
9795
|
+
const stretchY = fieldDimensions[1] + getTopMargin((_d = field.rootElement.type) === null || _d === void 0 ? void 0 : _d.label) + getBottomMargin((_e = field.rootElement.type) === null || _e === void 0 ? void 0 : _e.label) - field.rootElement.height;
|
|
9805
9796
|
return stretchX <= 0 && stretchY <= 0;
|
|
9806
9797
|
}
|
|
9807
9798
|
return true;
|
|
9808
9799
|
}
|
|
9809
9800
|
fitFieldRootInView(id, shrink = true) {
|
|
9810
|
-
var
|
|
9801
|
+
var _b, _c, _d;
|
|
9811
9802
|
const field = this.model.fields.get(id);
|
|
9812
9803
|
if (!field) {
|
|
9813
9804
|
return;
|
|
9814
9805
|
}
|
|
9815
9806
|
if (field.rootElement instanceof DiagramNode) {
|
|
9816
|
-
const fieldDimensions = this.
|
|
9807
|
+
const fieldDimensions = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
|
|
9817
9808
|
let stretchX = fieldDimensions[0] + getLeftMargin(field.rootElement.type.label) + getRightMargin(field.rootElement.type.label) - field.rootElement.width;
|
|
9818
9809
|
let stretchY = fieldDimensions[1] + getTopMargin(field.rootElement.type.label) + getBottomMargin(field.rootElement.type.label) - field.rootElement.height;
|
|
9819
9810
|
const spacingX = getGridSpacingX(this.gridConfig);
|
|
@@ -9839,15 +9830,15 @@ class DiagramCanvas {
|
|
|
9839
9830
|
}
|
|
9840
9831
|
}
|
|
9841
9832
|
if (field.rootElement instanceof DiagramSection) {
|
|
9842
|
-
const fieldDimensions = this.
|
|
9833
|
+
const fieldDimensions = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
|
|
9843
9834
|
let minimumFieldWidth = fieldDimensions[0];
|
|
9844
9835
|
let minimumFieldHeight = fieldDimensions[1];
|
|
9845
|
-
for (const section of ((
|
|
9836
|
+
for (const section of ((_b = field.rootElement.node) === null || _b === void 0 ? void 0 : _b.sections) || []) {
|
|
9846
9837
|
if (section.label) {
|
|
9847
9838
|
if (section.indexXInNode === field.rootElement.indexXInNode && section.indexYInNode !== field.rootElement.indexYInNode) {
|
|
9848
|
-
minimumFieldWidth = Math.max(minimumFieldWidth, this.
|
|
9839
|
+
minimumFieldWidth = Math.max(minimumFieldWidth, __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, section.label)[0]);
|
|
9849
9840
|
} else if (section.indexXInNode !== field.rootElement.indexXInNode && section.indexYInNode === field.rootElement.indexYInNode) {
|
|
9850
|
-
minimumFieldHeight = Math.max(minimumFieldHeight, this.
|
|
9841
|
+
minimumFieldHeight = Math.max(minimumFieldHeight, __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, section.label)[1]);
|
|
9851
9842
|
}
|
|
9852
9843
|
}
|
|
9853
9844
|
}
|
|
@@ -9876,25 +9867,25 @@ class DiagramCanvas {
|
|
|
9876
9867
|
stretchY = (field.rootElement.getMinHeight() || 0) - field.rootElement.height;
|
|
9877
9868
|
}
|
|
9878
9869
|
if (shrink || stretchX > 0) {
|
|
9879
|
-
(
|
|
9870
|
+
(_c = field.rootElement.node) === null || _c === void 0 ? void 0 : _c.stretchSections(exports.Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
|
|
9880
9871
|
}
|
|
9881
9872
|
if (shrink || stretchY > 0) {
|
|
9882
|
-
(
|
|
9873
|
+
(_d = field.rootElement.node) === null || _d === void 0 ? void 0 : _d.stretchSections(exports.Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
|
|
9883
9874
|
}
|
|
9884
9875
|
}
|
|
9885
9876
|
}
|
|
9886
9877
|
fitNodeInView(id, shrink = true) {
|
|
9887
|
-
var
|
|
9878
|
+
var _b, _c;
|
|
9888
9879
|
const node = this.model.nodes.get(id);
|
|
9889
9880
|
if (!node) {
|
|
9890
9881
|
return;
|
|
9891
9882
|
}
|
|
9892
|
-
if (node.sections.length > 0 && this
|
|
9883
|
+
if (node.sections.length > 0 && __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f")) {
|
|
9893
9884
|
let newNodeWidth = 0;
|
|
9894
9885
|
let newNodeHeight = 0;
|
|
9895
9886
|
// calculate newNodeWidth, newNodeHeight as the rightmost and bottommost points of any of the sections of the node
|
|
9896
9887
|
for (const section of node.sections) {
|
|
9897
|
-
if (section.getPriority() >= this
|
|
9888
|
+
if (section.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f")) {
|
|
9898
9889
|
const sectionLastXCoordRelativeToNode = section.coords[0] + section.width - node.coords[0];
|
|
9899
9890
|
const sectionLastYCoordRelativeToNode = section.coords[1] + section.height - node.coords[1];
|
|
9900
9891
|
newNodeWidth = Math.max(newNodeWidth, sectionLastXCoordRelativeToNode);
|
|
@@ -9902,8 +9893,8 @@ class DiagramCanvas {
|
|
|
9902
9893
|
}
|
|
9903
9894
|
}
|
|
9904
9895
|
// add the margin that goes between the rightmost and bottommost points of the sections and the edge of the node
|
|
9905
|
-
newNodeWidth += ((
|
|
9906
|
-
newNodeHeight += ((
|
|
9896
|
+
newNodeWidth += ((_b = node.type.sectionGrid) === null || _b === void 0 ? void 0 : _b.margin) || 0;
|
|
9897
|
+
newNodeHeight += ((_c = node.type.sectionGrid) === null || _c === void 0 ? void 0 : _c.margin) || 0;
|
|
9907
9898
|
if (shrink || newNodeWidth > node.width) {
|
|
9908
9899
|
node.stretch(exports.Side.Right, newNodeWidth - node.width);
|
|
9909
9900
|
}
|
|
@@ -9913,7 +9904,7 @@ class DiagramCanvas {
|
|
|
9913
9904
|
}
|
|
9914
9905
|
}
|
|
9915
9906
|
selectRoot() {
|
|
9916
|
-
return d3__namespace.select(this
|
|
9907
|
+
return d3__namespace.select(__classPrivateFieldGet(this, _DiagramCanvas_diagramRoot, "f"));
|
|
9917
9908
|
}
|
|
9918
9909
|
selectSVGElement() {
|
|
9919
9910
|
return this.selectRoot().select('svg');
|
|
@@ -9924,107 +9915,10 @@ class DiagramCanvas {
|
|
|
9924
9915
|
selectCanvasElements() {
|
|
9925
9916
|
return this.selectCanvasView().select(`.daga-canvas-elements`);
|
|
9926
9917
|
}
|
|
9927
|
-
// User actions
|
|
9928
|
-
startConnection(port) {
|
|
9929
|
-
var _a, _b, _c, _d;
|
|
9930
|
-
if (port.allowsOutgoing || port.allowsIncoming) {
|
|
9931
|
-
if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '') && port.allowsOutgoing || this.connectionType.canFinishOnType(((_d = (_c = port.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && port.allowsIncoming)) {
|
|
9932
|
-
this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
9933
|
-
this.unfinishedConnectionPort = port;
|
|
9934
|
-
} else {
|
|
9935
|
-
if (this.inferConnectionType) {
|
|
9936
|
-
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
9937
|
-
var _a, _b;
|
|
9938
|
-
return port.allowsOutgoing && t.canStartFromType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '');
|
|
9939
|
-
});
|
|
9940
|
-
if (differentConnectionType === undefined) {
|
|
9941
|
-
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
9942
|
-
var _a, _b;
|
|
9943
|
-
return port.allowsIncoming && t.canFinishOnType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '');
|
|
9944
|
-
});
|
|
9945
|
-
}
|
|
9946
|
-
if (differentConnectionType !== undefined) {
|
|
9947
|
-
this.unfinishedConnection = new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
9948
|
-
this.unfinishedConnectionPort = port;
|
|
9949
|
-
}
|
|
9950
|
-
}
|
|
9951
|
-
}
|
|
9952
|
-
}
|
|
9953
|
-
}
|
|
9954
|
-
finishConnection(port) {
|
|
9955
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
9956
|
-
this.userHighlight.clear();
|
|
9957
|
-
if (this.unfinishedConnection !== undefined) {
|
|
9958
|
-
if (!this.allowConnectionLoops && this.unfinishedConnection.start === port) {
|
|
9959
|
-
this.dropConnection();
|
|
9960
|
-
return;
|
|
9961
|
-
}
|
|
9962
|
-
if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
|
|
9963
|
-
this.dropConnection();
|
|
9964
|
-
return;
|
|
9965
|
-
}
|
|
9966
|
-
if (!this.allowSharingBothPorts && this.model.connections.find(c => {
|
|
9967
|
-
var _a, _b;
|
|
9968
|
-
return !c.removed && (c.start === ((_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) && c.end === port || c.end === ((_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.start) && c.start === port);
|
|
9969
|
-
}) !== undefined) {
|
|
9970
|
-
this.dropConnection();
|
|
9971
|
-
return;
|
|
9972
|
-
}
|
|
9973
|
-
if (this.unfinishedConnection.type.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsOutgoing) && this.unfinishedConnection.type.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsIncoming) {
|
|
9974
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_j = this.unfinishedConnection.start) === null || _j === void 0 ? void 0 : _j.id, port.id);
|
|
9975
|
-
// clean up the previous unfinished connection
|
|
9976
|
-
this.dropConnection();
|
|
9977
|
-
addConnectionAction.do();
|
|
9978
|
-
this.actionStack.add(addConnectionAction);
|
|
9979
|
-
} else if (this.unfinishedConnection.type.canFinishOnType(((_o = (_m = (_l = (_k = this.unfinishedConnection) === null || _k === void 0 ? void 0 : _k.start) === null || _l === void 0 ? void 0 : _l.getNode()) === null || _m === void 0 ? void 0 : _m.type) === null || _o === void 0 ? void 0 : _o.id) || '') && ((_q = (_p = this.unfinishedConnection) === null || _p === void 0 ? void 0 : _p.start) === null || _q === void 0 ? void 0 : _q.allowsIncoming) && this.unfinishedConnection.type.canStartFromType(((_s = (_r = port.getNode()) === null || _r === void 0 ? void 0 : _r.type) === null || _s === void 0 ? void 0 : _s.id) || '') && port.allowsOutgoing) {
|
|
9980
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_t = this.unfinishedConnection.start) === null || _t === void 0 ? void 0 : _t.id);
|
|
9981
|
-
// clean up the previous unfinished connection
|
|
9982
|
-
this.dropConnection();
|
|
9983
|
-
addConnectionAction.do();
|
|
9984
|
-
this.actionStack.add(addConnectionAction);
|
|
9985
|
-
} else {
|
|
9986
|
-
if (this.inferConnectionType) {
|
|
9987
|
-
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
9988
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9989
|
-
return t.canStartFromType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsOutgoing) && t.canFinishOnType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsIncoming;
|
|
9990
|
-
});
|
|
9991
|
-
let invertConnection = false;
|
|
9992
|
-
if (differentConnectionType === undefined) {
|
|
9993
|
-
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
9994
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
9995
|
-
return t.canFinishOnType(((_d = (_c = (_b = (_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && ((_f = (_e = this.unfinishedConnection) === null || _e === void 0 ? void 0 : _e.start) === null || _f === void 0 ? void 0 : _f.allowsIncoming) && t.canStartFromType(((_h = (_g = port.getNode()) === null || _g === void 0 ? void 0 : _g.type) === null || _h === void 0 ? void 0 : _h.id) || '') && port.allowsOutgoing;
|
|
9996
|
-
});
|
|
9997
|
-
invertConnection = true;
|
|
9998
|
-
}
|
|
9999
|
-
if (differentConnectionType !== undefined) {
|
|
10000
|
-
const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_u = this.unfinishedConnection.start) === null || _u === void 0 ? void 0 : _u.id, invertConnection ? (_v = this.unfinishedConnection.start) === null || _v === void 0 ? void 0 : _v.id : port.id);
|
|
10001
|
-
// clean up the previous unfinished connection
|
|
10002
|
-
this.dropConnection();
|
|
10003
|
-
addConnectionAction.do();
|
|
10004
|
-
this.actionStack.add(addConnectionAction);
|
|
10005
|
-
} else {
|
|
10006
|
-
// error: connection target of wrong type and no allowed type can be found
|
|
10007
|
-
this.dropConnection();
|
|
10008
|
-
}
|
|
10009
|
-
} else {
|
|
10010
|
-
// error: connection target of wrong type and can't guess for a different type
|
|
10011
|
-
this.dropConnection();
|
|
10012
|
-
}
|
|
10013
|
-
}
|
|
10014
|
-
}
|
|
10015
|
-
}
|
|
10016
|
-
dropConnection() {
|
|
10017
|
-
var _a, _b, _c, _d;
|
|
10018
|
-
(_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.setStart(undefined);
|
|
10019
|
-
(_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.setEnd(undefined);
|
|
10020
|
-
(_d = (_c = this.unfinishedConnection) === null || _c === void 0 ? void 0 : _c.select()) === null || _d === void 0 ? void 0 : _d.remove();
|
|
10021
|
-
this.unfinishedConnection = undefined;
|
|
10022
|
-
this.unfinishedConnectionPort = undefined;
|
|
10023
|
-
}
|
|
10024
9918
|
cancelAllUserActions() {
|
|
10025
|
-
this
|
|
10026
|
-
this.
|
|
10027
|
-
this.
|
|
9919
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9920
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
9921
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
|
|
10028
9922
|
this.contextMenu.close();
|
|
10029
9923
|
this.userSelection.clear();
|
|
10030
9924
|
}
|
|
@@ -10034,7 +9928,8 @@ class DiagramCanvas {
|
|
|
10034
9928
|
openTextInput(id) {
|
|
10035
9929
|
const field = this.model.fields.get(id);
|
|
10036
9930
|
if (field) {
|
|
10037
|
-
this
|
|
9931
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new EditFieldAction(this, field.id, field.text, ''), "f");
|
|
9932
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_createInputField).call(this, field.text, field.coords, field.width, field.height, field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize, field.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily, field.orientation, field.multiline, () => {
|
|
10038
9933
|
// (_text)
|
|
10039
9934
|
/*
|
|
10040
9935
|
Empty for now
|
|
@@ -10043,257 +9938,483 @@ class DiagramCanvas {
|
|
|
10043
9938
|
*/
|
|
10044
9939
|
}, text => {
|
|
10045
9940
|
field.text = text;
|
|
10046
|
-
if (this
|
|
10047
|
-
this.
|
|
10048
|
-
this.
|
|
10049
|
-
this.actionStack.add(this
|
|
10050
|
-
this
|
|
9941
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof EditFieldAction) {
|
|
9942
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = text;
|
|
9943
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9944
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9945
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
10051
9946
|
}
|
|
10052
9947
|
});
|
|
10053
9948
|
}
|
|
10054
9949
|
}
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10074
|
-
|
|
10075
|
-
|
|
10076
|
-
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10083
|
-
|
|
10084
|
-
|
|
10085
|
-
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
|
|
10091
|
-
|
|
10092
|
-
|
|
9950
|
+
}
|
|
9951
|
+
_a = DiagramCanvas, _DiagramCanvas_diagramRoot = new WeakMap(), _DiagramCanvas_connectionType = new WeakMap(), _DiagramCanvas_gridPatternId = new WeakMap(), _DiagramCanvas_ancillaryGridPatternIds = new WeakMap(), _DiagramCanvas_zoomBehavior = new WeakMap(), _DiagramCanvas_zoomTransform = new WeakMap(), _DiagramCanvas_priorityThreshold = new WeakMap(), _DiagramCanvas_priorityThresholds = new WeakMap(), _DiagramCanvas_unfinishedConnection = new WeakMap(), _DiagramCanvas_unfinishedConnectionTracer = new WeakMap(), _DiagramCanvas_unfinishedConnectionPort = new WeakMap(), _DiagramCanvas_inputFieldContainer = new WeakMap(), _DiagramCanvas_multipleSelectionContainer = new WeakMap(), _DiagramCanvas_draggingFrom = new WeakMap(), _DiagramCanvas_dragging = new WeakMap(), _DiagramCanvas_secondaryButton = new WeakMap(), _DiagramCanvas_currentAction = new WeakMap(), _DiagramCanvas_instances = new WeakSet(), _DiagramCanvas_updateConnectionLabelsInView = function _DiagramCanvas_updateConnectionLabelsInView(connection) {
|
|
9952
|
+
var _b, _c, _d;
|
|
9953
|
+
const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
|
|
9954
|
+
const pathSelection = connectionSelection.select('path');
|
|
9955
|
+
const pathNode = pathSelection.node();
|
|
9956
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), connection.type.label);
|
|
9957
|
+
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
9958
|
+
if (pathNode) {
|
|
9959
|
+
const pathLength = pathNode.getTotalLength();
|
|
9960
|
+
let startLabelShiftX = 0;
|
|
9961
|
+
let startLabelShiftY = 0;
|
|
9962
|
+
let middleLabelShiftX = 0;
|
|
9963
|
+
let middleLabelShiftY = 0;
|
|
9964
|
+
let endLabelShiftX = 0;
|
|
9965
|
+
let endLabelShiftY = 0;
|
|
9966
|
+
if (labelConfiguration.look.fillColor === 'transparent') {
|
|
9967
|
+
// background color is transparent / not set, so we find an alternative position for the label
|
|
9968
|
+
const deltaX = connection.endCoords[0] - connection.startCoords[0];
|
|
9969
|
+
const deltaY = connection.endCoords[1] - connection.startCoords[1];
|
|
9970
|
+
switch (connection.startDirection) {
|
|
9971
|
+
case exports.Side.Top:
|
|
9972
|
+
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
9973
|
+
endLabelShiftX = startLabelShiftX;
|
|
9974
|
+
break;
|
|
9975
|
+
case exports.Side.Bottom:
|
|
9976
|
+
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
9977
|
+
endLabelShiftX = startLabelShiftX;
|
|
9978
|
+
break;
|
|
9979
|
+
case exports.Side.Left:
|
|
9980
|
+
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9981
|
+
endLabelShiftY = startLabelShiftY;
|
|
9982
|
+
break;
|
|
9983
|
+
case exports.Side.Right:
|
|
9984
|
+
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9985
|
+
endLabelShiftY = startLabelShiftY;
|
|
9986
|
+
break;
|
|
9987
|
+
default:
|
|
9988
|
+
startLabelShiftX = 0.5;
|
|
9989
|
+
endLabelShiftX = startLabelShiftX;
|
|
9990
|
+
startLabelShiftY = -0.5;
|
|
9991
|
+
endLabelShiftY = startLabelShiftY;
|
|
10093
9992
|
}
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
9993
|
+
switch (connection.endDirection) {
|
|
9994
|
+
case exports.Side.Top:
|
|
9995
|
+
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
9996
|
+
break;
|
|
9997
|
+
case exports.Side.Bottom:
|
|
9998
|
+
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
9999
|
+
break;
|
|
10000
|
+
case exports.Side.Left:
|
|
10001
|
+
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
10002
|
+
break;
|
|
10003
|
+
case exports.Side.Right:
|
|
10004
|
+
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
10005
|
+
break;
|
|
10006
|
+
default:
|
|
10007
|
+
endLabelShiftX = 0.5;
|
|
10008
|
+
endLabelShiftY = -0.5;
|
|
10101
10009
|
}
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10010
|
+
if (Math.abs(deltaX) >= Math.abs(deltaY)) {
|
|
10011
|
+
// horizontal quadrant
|
|
10012
|
+
middleLabelShiftX = deltaX > 0 ? -0.5 : 0.5;
|
|
10013
|
+
middleLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
10014
|
+
} else {
|
|
10015
|
+
// vertical quadrant
|
|
10016
|
+
middleLabelShiftX = deltaX > 0 ? 0.5 : -0.5;
|
|
10017
|
+
middleLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
10018
|
+
}
|
|
10019
|
+
}
|
|
10020
|
+
// bind start labels
|
|
10021
|
+
connectionSelection.select('g.diagram-connection-start-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fontColor).text(connection.startLabel);
|
|
10022
|
+
const startLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
10023
|
+
if (startLabelBoundingRect) {
|
|
10024
|
+
// don't create space for the label if the label is empty
|
|
10025
|
+
const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
10026
|
+
const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
10027
|
+
let pathStartLabelPoint;
|
|
10028
|
+
switch (connection.startDirection) {
|
|
10029
|
+
case exports.Side.Left:
|
|
10030
|
+
pathStartLabelPoint = pathNode.getPointAtLength(getRightMargin(labelConfiguration) + boundingWidth / 2);
|
|
10031
|
+
break;
|
|
10032
|
+
case exports.Side.Right:
|
|
10033
|
+
pathStartLabelPoint = pathNode.getPointAtLength(getLeftMargin(labelConfiguration) + boundingWidth / 2);
|
|
10034
|
+
break;
|
|
10035
|
+
case exports.Side.Top:
|
|
10036
|
+
pathStartLabelPoint = pathNode.getPointAtLength(getBottomMargin(labelConfiguration) + boundingHeight / 2);
|
|
10037
|
+
break;
|
|
10038
|
+
case exports.Side.Bottom:
|
|
10039
|
+
pathStartLabelPoint = pathNode.getPointAtLength(getTopMargin(labelConfiguration) + boundingHeight / 2);
|
|
10040
|
+
break;
|
|
10041
|
+
default:
|
|
10042
|
+
pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
10043
|
+
}
|
|
10044
|
+
connectionSelection.select('g.diagram-connection-start-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
|
|
10045
|
+
connectionSelection.select('g.diagram-connection-start-label').attr('transform', `translate(${pathStartLabelPoint.x + startLabelShiftX * boundingWidth},${pathStartLabelPoint.y + startLabelShiftY * boundingHeight})`);
|
|
10046
|
+
}
|
|
10047
|
+
// bind middle labels
|
|
10048
|
+
connectionSelection.select('g.diagram-connection-middle-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).style('font-kerning', 'none').text(connection.middleLabel);
|
|
10049
|
+
const middleLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
10050
|
+
if (middleLabelBoundingRect) {
|
|
10051
|
+
// don't create space for the label if the label is empty
|
|
10052
|
+
const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
10053
|
+
const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
10054
|
+
const pathMiddleLabelPoint = pathNode.getPointAtLength(pathLength / 2);
|
|
10055
|
+
connectionSelection.select('g.diagram-connection-middle-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
|
|
10056
|
+
connectionSelection.select('g.diagram-connection-middle-label').attr('transform', `translate(${pathMiddleLabelPoint.x + middleLabelShiftX * boundingWidth},${pathMiddleLabelPoint.y + middleLabelShiftY * boundingHeight})`);
|
|
10057
|
+
}
|
|
10058
|
+
// bind end labels
|
|
10059
|
+
connectionSelection.select('g.diagram-connection-end-label text').attr('x', 0).attr('y', (labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) / 3).attr('text-anchor', 'middle').attr('font-family', labelConfiguration.look.fontFamily || DIAGRAM_FIELD_DEFAULTS.look.fontFamily).attr('font-size', labelConfiguration.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize).attr('fill', labelConfiguration.look.fontColor || DIAGRAM_FIELD_DEFAULTS.look.fontColor).style('font-kerning', 'none').text(connection.endLabel);
|
|
10060
|
+
const endLabelBoundingRect = (_d = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _d === void 0 ? void 0 : _d.getBoundingClientRect();
|
|
10061
|
+
if (endLabelBoundingRect) {
|
|
10062
|
+
// don't create space for the label if the label is empty
|
|
10063
|
+
const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
10064
|
+
const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
10065
|
+
let pathEndLabelPoint;
|
|
10066
|
+
switch (connection.endDirection) {
|
|
10067
|
+
case exports.Side.Left:
|
|
10068
|
+
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getRightMargin(labelConfiguration) + boundingWidth / 2));
|
|
10069
|
+
break;
|
|
10070
|
+
case exports.Side.Right:
|
|
10071
|
+
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getLeftMargin(labelConfiguration) + boundingWidth / 2));
|
|
10072
|
+
break;
|
|
10073
|
+
case exports.Side.Top:
|
|
10074
|
+
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
10075
|
+
break;
|
|
10076
|
+
case exports.Side.Bottom:
|
|
10077
|
+
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getTopMargin(labelConfiguration) + boundingHeight / 2));
|
|
10078
|
+
break;
|
|
10079
|
+
default:
|
|
10080
|
+
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
10081
|
+
}
|
|
10082
|
+
connectionSelection.select('g.diagram-connection-end-label path').attr('d', pillPath(-boundingWidth / 2, -boundingHeight / 2, boundingWidth, boundingHeight)).attr('fill', labelConfiguration.look.fillColor || DIAGRAM_FIELD_DEFAULTS.look.fillColor).attr('stroke', 'none');
|
|
10083
|
+
connectionSelection.select('g.diagram-connection-end-label').attr('transform', `translate(${pathEndLabelPoint.x + endLabelShiftX * boundingWidth},${pathEndLabelPoint.y + endLabelShiftY * boundingHeight})`);
|
|
10084
|
+
}
|
|
10106
10085
|
}
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
(
|
|
10113
|
-
|
|
10086
|
+
}, _DiagramCanvas_updateConnectionMarkersInView = function _DiagramCanvas_updateConnectionMarkersInView(connection) {
|
|
10087
|
+
const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
|
|
10088
|
+
const startMarkerSelection = connectionSelection.select('marker.diagram-connection-start-marker');
|
|
10089
|
+
const endMarkerSelection = connectionSelection.select('marker.diagram-connection-end-marker');
|
|
10090
|
+
if (connection.startMarkerLook !== null) {
|
|
10091
|
+
startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.startMarkerLook.width).attr('markerHeight', connection.startMarkerLook.height).attr('refX', connection.startMarkerLook.refX).attr('refY', connection.startMarkerLook.refY).select('image').attr('href', connection.startMarkerLook.image).attr('width', connection.startMarkerLook.width).attr('height', connection.startMarkerLook.height);
|
|
10092
|
+
} else {
|
|
10093
|
+
startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
|
|
10114
10094
|
}
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10095
|
+
if (connection.endMarkerLook !== null) {
|
|
10096
|
+
endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', connection.endMarkerLook.width).attr('markerHeight', connection.endMarkerLook.height).attr('refX', connection.endMarkerLook.refX).attr('refY', connection.endMarkerLook.refY).select('image').attr('href', connection.endMarkerLook.image).attr('width', connection.endMarkerLook.width).attr('height', connection.endMarkerLook.height);
|
|
10097
|
+
} else {
|
|
10098
|
+
endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
|
|
10099
|
+
}
|
|
10100
|
+
}, _DiagramCanvas_startConnection = function _DiagramCanvas_startConnection(port) {
|
|
10101
|
+
var _b, _c, _d, _e;
|
|
10102
|
+
if (port.allowsOutgoing || port.allowsIncoming) {
|
|
10103
|
+
if (this.connectionType && (this.connectionType.canStartFromType(((_c = (_b = port.getNode()) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.id) || '') && port.allowsOutgoing || this.connectionType.canFinishOnType(((_e = (_d = port.getNode()) === null || _d === void 0 ? void 0 : _d.type) === null || _e === void 0 ? void 0 : _e.id) || '') && port.allowsIncoming)) {
|
|
10104
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnection, new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID), "f");
|
|
10105
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionPort, port, "f");
|
|
10106
|
+
} else {
|
|
10107
|
+
if (this.inferConnectionType) {
|
|
10108
|
+
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
10109
|
+
var _b, _c;
|
|
10110
|
+
return port.allowsOutgoing && t.canStartFromType(((_c = (_b = port.getNode()) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.id) || '');
|
|
10111
|
+
});
|
|
10112
|
+
if (differentConnectionType === undefined) {
|
|
10113
|
+
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
10114
|
+
var _b, _c;
|
|
10115
|
+
return port.allowsIncoming && t.canFinishOnType(((_c = (_b = port.getNode()) === null || _b === void 0 ? void 0 : _b.type) === null || _c === void 0 ? void 0 : _c.id) || '');
|
|
10116
|
+
});
|
|
10117
|
+
}
|
|
10118
|
+
if (differentConnectionType !== undefined) {
|
|
10119
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnection, new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID), "f");
|
|
10120
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionPort, port, "f");
|
|
10121
|
+
}
|
|
10122
|
+
}
|
|
10121
10123
|
}
|
|
10122
|
-
const textBoundingBox = textNode.getBoundingClientRect();
|
|
10123
|
-
return [textBoundingBox.width / this.zoomTransform.k, textBoundingBox.height / this.zoomTransform.k];
|
|
10124
10124
|
}
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
10129
|
-
if (
|
|
10130
|
-
this
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10125
|
+
}, _DiagramCanvas_finishConnection = function _DiagramCanvas_finishConnection(port) {
|
|
10126
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
10127
|
+
this.userHighlight.clear();
|
|
10128
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") !== undefined) {
|
|
10129
|
+
if (!this.allowConnectionLoops && __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start === port) {
|
|
10130
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10131
|
+
return;
|
|
10132
|
+
}
|
|
10133
|
+
if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
|
|
10134
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10134
10135
|
return;
|
|
10135
10136
|
}
|
|
10136
|
-
if (
|
|
10137
|
-
|
|
10137
|
+
if (!this.allowSharingBothPorts && this.model.connections.find(c => {
|
|
10138
|
+
var _b, _c;
|
|
10139
|
+
return !c.removed && (c.start === ((_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.start) && c.end === port || c.end === ((_c = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _c === void 0 ? void 0 : _c.start) && c.start === port);
|
|
10140
|
+
}) !== undefined) {
|
|
10141
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10138
10142
|
return;
|
|
10139
10143
|
}
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10144
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canStartFromType(((_e = (_d = (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.getNode()) === null || _d === void 0 ? void 0 : _d.type) === null || _e === void 0 ? void 0 : _e.id) || '') && ((_g = (_f = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _f === void 0 ? void 0 : _f.start) === null || _g === void 0 ? void 0 : _g.allowsOutgoing) && __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canFinishOnType(((_j = (_h = port.getNode()) === null || _h === void 0 ? void 0 : _h.type) === null || _j === void 0 ? void 0 : _j.id) || '') && port.allowsIncoming) {
|
|
10145
|
+
const addConnectionAction = new AddConnectionAction(this, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type, (_k = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _k === void 0 ? void 0 : _k.id, port.id);
|
|
10146
|
+
// clean up the previous unfinished connection
|
|
10147
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10148
|
+
addConnectionAction.do();
|
|
10149
|
+
this.actionStack.add(addConnectionAction);
|
|
10150
|
+
} else if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canFinishOnType(((_p = (_o = (_m = (_l = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _l === void 0 ? void 0 : _l.start) === null || _m === void 0 ? void 0 : _m.getNode()) === null || _o === void 0 ? void 0 : _o.type) === null || _p === void 0 ? void 0 : _p.id) || '') && ((_r = (_q = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _q === void 0 ? void 0 : _q.start) === null || _r === void 0 ? void 0 : _r.allowsIncoming) && __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type.canStartFromType(((_t = (_s = port.getNode()) === null || _s === void 0 ? void 0 : _s.type) === null || _t === void 0 ? void 0 : _t.id) || '') && port.allowsOutgoing) {
|
|
10151
|
+
const addConnectionAction = new AddConnectionAction(this, __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").type, port.id, (_u = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _u === void 0 ? void 0 : _u.id);
|
|
10152
|
+
// clean up the previous unfinished connection
|
|
10153
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10154
|
+
addConnectionAction.do();
|
|
10155
|
+
this.actionStack.add(addConnectionAction);
|
|
10156
|
+
} else {
|
|
10157
|
+
if (this.inferConnectionType) {
|
|
10158
|
+
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
10159
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10160
|
+
return t.canStartFromType(((_e = (_d = (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.getNode()) === null || _d === void 0 ? void 0 : _d.type) === null || _e === void 0 ? void 0 : _e.id) || '') && ((_g = (_f = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _f === void 0 ? void 0 : _f.start) === null || _g === void 0 ? void 0 : _g.allowsOutgoing) && t.canFinishOnType(((_j = (_h = port.getNode()) === null || _h === void 0 ? void 0 : _h.type) === null || _j === void 0 ? void 0 : _j.id) || '') && port.allowsIncoming;
|
|
10161
|
+
});
|
|
10162
|
+
let invertConnection = false;
|
|
10163
|
+
if (differentConnectionType === undefined) {
|
|
10164
|
+
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
10165
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10166
|
+
return t.canFinishOnType(((_e = (_d = (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.start) === null || _c === void 0 ? void 0 : _c.getNode()) === null || _d === void 0 ? void 0 : _d.type) === null || _e === void 0 ? void 0 : _e.id) || '') && ((_g = (_f = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _f === void 0 ? void 0 : _f.start) === null || _g === void 0 ? void 0 : _g.allowsIncoming) && t.canStartFromType(((_j = (_h = port.getNode()) === null || _h === void 0 ? void 0 : _h.type) === null || _j === void 0 ? void 0 : _j.id) || '') && port.allowsOutgoing;
|
|
10167
|
+
});
|
|
10168
|
+
invertConnection = true;
|
|
10169
|
+
}
|
|
10170
|
+
if (differentConnectionType !== undefined) {
|
|
10171
|
+
const addConnectionAction = new AddConnectionAction(this, differentConnectionType, invertConnection ? port.id : (_v = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _v === void 0 ? void 0 : _v.id, invertConnection ? (_w = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start) === null || _w === void 0 ? void 0 : _w.id : port.id);
|
|
10172
|
+
// clean up the previous unfinished connection
|
|
10173
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10174
|
+
addConnectionAction.do();
|
|
10175
|
+
this.actionStack.add(addConnectionAction);
|
|
10176
|
+
} else {
|
|
10177
|
+
// error: connection target of wrong type and no allowed type can be found
|
|
10178
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10179
|
+
}
|
|
10146
10180
|
} else {
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10181
|
+
// error: connection target of wrong type and can't guess for a different type
|
|
10182
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10183
|
+
}
|
|
10184
|
+
}
|
|
10185
|
+
}
|
|
10186
|
+
}, _DiagramCanvas_dropConnection = function _DiagramCanvas_dropConnection() {
|
|
10187
|
+
var _b, _c, _d, _e;
|
|
10188
|
+
(_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.setStart(undefined);
|
|
10189
|
+
(_c = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _c === void 0 ? void 0 : _c.setEnd(undefined);
|
|
10190
|
+
(_e = (_d = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _d === void 0 ? void 0 : _d.select()) === null || _e === void 0 ? void 0 : _e.remove();
|
|
10191
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnection, undefined, "f");
|
|
10192
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionPort, undefined, "f");
|
|
10193
|
+
}, _DiagramCanvas_createInputField = function _DiagramCanvas_createInputField(text, coords, width, height, fontSize, fontFamily, orientation, multiline, changeCallback, finishCallback) {
|
|
10194
|
+
// if we have a text input open, close it before creating a new one
|
|
10195
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
|
|
10196
|
+
const inputFieldContainer = this.selectCanvasElements().append('foreignObject').attr('x', `${coords[0]}px`).attr('y', `${coords[1]}px`).attr('width', `${width}px`).attr('height', `${height}px`).style('box-sizing', 'border-box').style('border', '1px solid');
|
|
10197
|
+
__classPrivateFieldSet(this, _DiagramCanvas_inputFieldContainer, inputFieldContainer, "f");
|
|
10198
|
+
const inputField = inputFieldContainer.append('xhtml:textarea');
|
|
10199
|
+
let inputFieldWidth;
|
|
10200
|
+
let inputFieldHeight;
|
|
10201
|
+
inputField.text(text).style('box-sizing', 'border-box').style('width', `${width}px`).style('height', `${height}px`).style('font-size', `${fontSize}px`).style('font-family', fontFamily).style('resize', 'none').style('outline', 0).style('border', 0).style('margin', 0).style('padding', 0).on(exports.Events.KeyDown, event => {
|
|
10202
|
+
event.stopPropagation();
|
|
10203
|
+
if (event.key === exports.Keys.Escape || event.key === exports.Keys.Enter && !multiline) {
|
|
10204
|
+
const value = inputField.property('value') || '';
|
|
10205
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
|
|
10206
|
+
if (finishCallback) {
|
|
10207
|
+
finishCallback(value);
|
|
10155
10208
|
}
|
|
10156
|
-
minimumSize = this.minimumSizeOfField(field);
|
|
10157
10209
|
}
|
|
10158
|
-
}
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10210
|
+
}).on(exports.Events.KeyUp, event => {
|
|
10211
|
+
event.stopPropagation();
|
|
10212
|
+
}).on(exports.Events.Input, () => {
|
|
10213
|
+
const value = inputField.property('value');
|
|
10214
|
+
inputField.attr('cols', numberOfColumns(value) + 1);
|
|
10215
|
+
inputField.attr('rows', numberOfRows(value) + 1);
|
|
10216
|
+
// reset width and height so that later the scrollWidth and scrollHeight are fit to the size of the text
|
|
10217
|
+
inputField.style('width', '');
|
|
10218
|
+
inputField.style('height', '');
|
|
10219
|
+
// add one diagram unit of margin of error
|
|
10220
|
+
inputFieldWidth = inputField.property('scrollWidth') + 1;
|
|
10221
|
+
inputFieldHeight = inputField.property('scrollHeight') + 1;
|
|
10222
|
+
// keep the field from shrinking below its original size
|
|
10223
|
+
const newWidth = Math.max(inputFieldWidth, width);
|
|
10224
|
+
const newHeight = Math.max(inputFieldHeight, height);
|
|
10225
|
+
inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('width', `${newWidth}px`);
|
|
10226
|
+
inputField.style('width', `${newWidth}px`);
|
|
10227
|
+
inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('height', `${newHeight}px`);
|
|
10228
|
+
inputField.style('height', `${newHeight}px`);
|
|
10229
|
+
if (changeCallback) {
|
|
10230
|
+
changeCallback(value);
|
|
10231
|
+
}
|
|
10232
|
+
}).on(exports.Events.Click, event => {
|
|
10233
|
+
event.stopPropagation();
|
|
10234
|
+
}).on(exports.Events.FocusOut, () => {
|
|
10235
|
+
const value = inputField.property('value');
|
|
10236
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
|
|
10237
|
+
if (finishCallback) {
|
|
10238
|
+
finishCallback(value);
|
|
10164
10239
|
}
|
|
10165
|
-
}
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10240
|
+
});
|
|
10241
|
+
const htmlInput = inputField.node();
|
|
10242
|
+
htmlInput.focus();
|
|
10243
|
+
htmlInput.select();
|
|
10244
|
+
}, _DiagramCanvas_removeInputField = function _DiagramCanvas_removeInputField() {
|
|
10245
|
+
var _b, _c, _d;
|
|
10246
|
+
// when removing an element, a blur event is emitted
|
|
10247
|
+
// we remove the listener for blur so that it does not emit again on element removal
|
|
10248
|
+
(_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_inputFieldContainer, "f")) === null || _b === void 0 ? void 0 : _b.select('input')) === null || _c === void 0 ? void 0 : _c.on(exports.Events.Blur, null);
|
|
10249
|
+
(_d = __classPrivateFieldGet(this, _DiagramCanvas_inputFieldContainer, "f")) === null || _d === void 0 ? void 0 : _d.remove();
|
|
10250
|
+
__classPrivateFieldSet(this, _DiagramCanvas_inputFieldContainer, undefined, "f");
|
|
10251
|
+
}, _DiagramCanvas_minimumSizeOfField = function _DiagramCanvas_minimumSizeOfField(field) {
|
|
10252
|
+
var _b, _c;
|
|
10253
|
+
const textNode = (_c = (_b = field.select()) === null || _b === void 0 ? void 0 : _b.select('text')) === null || _c === void 0 ? void 0 : _c.node();
|
|
10254
|
+
if (!textNode) {
|
|
10255
|
+
// happens when a field has been created but not updated in view yet
|
|
10256
|
+
return [0, 0];
|
|
10257
|
+
}
|
|
10258
|
+
const textBoundingBox = textNode.getBoundingClientRect();
|
|
10259
|
+
return [textBoundingBox.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, textBoundingBox.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k];
|
|
10260
|
+
}, _DiagramCanvas_setFieldTextAndWrap = function _DiagramCanvas_setFieldTextAndWrap(field) {
|
|
10261
|
+
var _b, _c, _d, _e;
|
|
10262
|
+
const textSelection = (_b = field.select()) === null || _b === void 0 ? void 0 : _b.select('text');
|
|
10263
|
+
const textNode = textSelection === null || textSelection === void 0 ? void 0 : textSelection.node();
|
|
10264
|
+
if (textSelection && textNode) {
|
|
10265
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_setFieldText).call(this, field, textSelection, field.text);
|
|
10266
|
+
} else {
|
|
10267
|
+
// can happen if a field has been created but not updated in view yet
|
|
10268
|
+
// not sure if this still happens but should check just in case
|
|
10269
|
+
return;
|
|
10270
|
+
}
|
|
10271
|
+
if (field.fit) {
|
|
10272
|
+
// no need to wrap
|
|
10273
|
+
return;
|
|
10274
|
+
}
|
|
10275
|
+
let minimumSize = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
|
|
10276
|
+
while (minimumSize[0] > field.width || minimumSize[1] > field.height) {
|
|
10277
|
+
const textString = ((_e = (_d = (_c = textSelection === null || textSelection === void 0 ? void 0 : textSelection.html()) === null || _c === void 0 ? void 0 : _c.replace(/<\/tspan>/g, '\n')) === null || _d === void 0 ? void 0 : _d.replace(/<tspan[^>]*>/g, '')) === null || _e === void 0 ? void 0 : _e.slice(0, -1)) || '';
|
|
10278
|
+
let newTextString = '...';
|
|
10279
|
+
if (textString.endsWith('...')) {
|
|
10280
|
+
newTextString = textString.slice(0, -4) + '...';
|
|
10179
10281
|
} else {
|
|
10180
|
-
|
|
10282
|
+
newTextString = textString.slice(0, -1) + '...';
|
|
10181
10283
|
}
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
* Method to call to continue the moving of a node triggered by a user drag event.
|
|
10185
|
-
*/
|
|
10186
|
-
continueMovingNode(event, d) {
|
|
10187
|
-
if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && (this.currentAction instanceof MoveAction || this.currentAction instanceof SetGeometryAction) && !d.removed) {
|
|
10188
|
-
const newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
10189
|
-
if (d.selected) {
|
|
10190
|
-
this.userSelection.move([newNodeCoords[0] - d.coords[0], newNodeCoords[1] - d.coords[1]]);
|
|
10191
|
-
} else {
|
|
10192
|
-
d.move(newNodeCoords);
|
|
10193
|
-
}
|
|
10194
|
-
this.userHighlight.clear();
|
|
10195
|
-
this.dragging = true;
|
|
10196
|
-
this.diagramEvent$.next(new DiagramDraggingNodeEvent(d));
|
|
10284
|
+
if (textSelection) {
|
|
10285
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_setFieldText).call(this, field, textSelection, newTextString);
|
|
10197
10286
|
}
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
*/
|
|
10202
|
-
finishMovingNode(event, d) {
|
|
10203
|
-
var _a, _b, _c, _d;
|
|
10204
|
-
if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && !d.removed) {
|
|
10205
|
-
// prevent drag behavior if mouse hasn't moved
|
|
10206
|
-
if (this.draggingFrom[0] !== event.x || this.draggingFrom[1] !== event.y) {
|
|
10207
|
-
let newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
10208
|
-
if ((_a = this.gridConfig) === null || _a === void 0 ? void 0 : _a.snap) {
|
|
10209
|
-
newNodeCoords = this.getClosestGridPoint([newNodeCoords[0] - d.type.snapToGridOffset[0], newNodeCoords[1] - d.type.snapToGridOffset[1]]);
|
|
10210
|
-
newNodeCoords[0] += d.type.snapToGridOffset[0];
|
|
10211
|
-
newNodeCoords[1] += d.type.snapToGridOffset[1];
|
|
10212
|
-
}
|
|
10213
|
-
if (this.currentAction instanceof MoveAction) {
|
|
10214
|
-
const movingFrom = this.currentAction.delta;
|
|
10215
|
-
this.currentAction.delta = [newNodeCoords[0] - movingFrom[0], newNodeCoords[1] - movingFrom[1]];
|
|
10216
|
-
// reset position of node prior to moving it again
|
|
10217
|
-
if (d.selected) {
|
|
10218
|
-
this.userSelection.move([movingFrom[0] - d.coords[0], movingFrom[1] - d.coords[1]]);
|
|
10219
|
-
} else {
|
|
10220
|
-
d.move(movingFrom);
|
|
10221
|
-
}
|
|
10222
|
-
} else if (this.currentAction instanceof SetGeometryAction) {
|
|
10223
|
-
d.move(newNodeCoords);
|
|
10224
|
-
// if moving a single node, we can change the node's parent,
|
|
10225
|
-
// so we check whether we dropped this node on a potential parent
|
|
10226
|
-
const nodesAtLocation = this.model.nodes.getAtCoordinates(event.x, event.y).filter(n => n.id !== d.id && !n.isDescendantOf(d));
|
|
10227
|
-
// filter by which nodes can have this node as a child
|
|
10228
|
-
const nodesAtLocationWhichCanHaveNodeAsAChild = nodesAtLocation.filter(n => n.type.childrenTypes.includes(d.type.id));
|
|
10229
|
-
// filter by which nodes don't have descendants in this collection
|
|
10230
|
-
const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
|
|
10231
|
-
const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
|
|
10232
|
-
if (droppedOn !== d.parent && (d.type.canBeParentless || droppedOn !== undefined)) {
|
|
10233
|
-
const ancestorOfDroppedOn = droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.getLastAncestor();
|
|
10234
|
-
const fromChildGeometry = this.currentAction.from;
|
|
10235
|
-
const setParentAction = new SetParentAction(this, d.id, (_b = d.parent) === null || _b === void 0 ? void 0 : _b.id, droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.id, fromChildGeometry, d.getGeometry(), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.id, ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id));
|
|
10236
|
-
(_c = d.parent) === null || _c === void 0 ? void 0 : _c.removeChild(d);
|
|
10237
|
-
if (droppedOn !== undefined) {
|
|
10238
|
-
droppedOn.addChild(d);
|
|
10239
|
-
}
|
|
10240
|
-
setParentAction.toChildGeometry = d.getGeometry(d.id);
|
|
10241
|
-
setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id);
|
|
10242
|
-
this.currentAction = setParentAction;
|
|
10243
|
-
} else {
|
|
10244
|
-
const ancestorOfNode = d === null || d === void 0 ? void 0 : d.getLastAncestor();
|
|
10245
|
-
this.currentAction.ancestorId = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id;
|
|
10246
|
-
this.currentAction.fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
|
|
10247
|
-
(_d = d.parent) === null || _d === void 0 ? void 0 : _d.fitToChild(d);
|
|
10248
|
-
this.currentAction.to = d.getGeometry(d.id);
|
|
10249
|
-
this.currentAction.toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
|
|
10250
|
-
}
|
|
10251
|
-
}
|
|
10252
|
-
if (this.currentAction !== undefined) {
|
|
10253
|
-
this.currentAction.do();
|
|
10254
|
-
this.actionStack.add(this.currentAction);
|
|
10255
|
-
this.currentAction = undefined;
|
|
10256
|
-
}
|
|
10257
|
-
}
|
|
10287
|
+
if (newTextString === '...') {
|
|
10288
|
+
// if no more characters can be removed and the new text is a bare ellipsis, stop the execution
|
|
10289
|
+
return;
|
|
10258
10290
|
}
|
|
10259
|
-
|
|
10260
|
-
this.dragging = false;
|
|
10291
|
+
minimumSize = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
|
|
10261
10292
|
}
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
|
|
10265
|
-
|
|
10266
|
-
|
|
10293
|
+
}, _DiagramCanvas_setFieldText = function _DiagramCanvas_setFieldText(field, textSelection, text) {
|
|
10294
|
+
const lines = text.split('\n');
|
|
10295
|
+
textSelection.html('');
|
|
10296
|
+
for (let i = 0; i < lines.length; ++i) {
|
|
10297
|
+
textSelection.append('tspan').attr('x', field.horizontalAlign === exports.HorizontalAlign.Center ? field.width / 2 : field.horizontalAlign === exports.HorizontalAlign.Right ? field.width : 0).attr('y', field.verticalAlign === exports.VerticalAlign.Center ? (i + 0.5 - lines.length / 2) * (field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) + field.height / 2 : field.verticalAlign === exports.VerticalAlign.Bottom ? field.height - (lines.length - i - 1) * (field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) : i * (field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize)).text(lines[i]);
|
|
10267
10298
|
}
|
|
10268
|
-
|
|
10269
|
-
|
|
10270
|
-
|
|
10271
|
-
|
|
10272
|
-
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
this.
|
|
10299
|
+
}, _DiagramCanvas_startMovingNode = function _DiagramCanvas_startMovingNode(event, d) {
|
|
10300
|
+
if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && !d.removed) {
|
|
10301
|
+
setCursorStyle(exports.CursorStyle.Grabbing);
|
|
10302
|
+
__classPrivateFieldSet(this, _DiagramCanvas_draggingFrom, [event.x, event.y], "f");
|
|
10303
|
+
if (d.selected && this.userSelection.count(e => e instanceof DiagramNode) > 1) {
|
|
10304
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new MoveAction(this, this.userSelection.filter(e => e instanceof DiagramNode).map(n => n.id), d.coords), "f");
|
|
10305
|
+
} else {
|
|
10306
|
+
const ancestorOfNode = d.getLastAncestor();
|
|
10307
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, exports.DiagramActions.MoveNode, d.id, d.getGeometry(), d.getGeometry(), ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id, ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id), ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id)), "f");
|
|
10277
10308
|
}
|
|
10309
|
+
} else {
|
|
10310
|
+
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
10278
10311
|
}
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
const
|
|
10282
|
-
(
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
if (rectanglesIntersect([node.coords, [node.coords[0] + node.width, node.coords[1] + node.height]], [this.draggingFrom, pointerCoords])) {
|
|
10287
|
-
this.userSelection.add(node);
|
|
10288
|
-
}
|
|
10312
|
+
}, _DiagramCanvas_continueMovingNode = function _DiagramCanvas_continueMovingNode(event, d) {
|
|
10313
|
+
if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof MoveAction || __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction) && !d.removed) {
|
|
10314
|
+
const newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
10315
|
+
if (d.selected) {
|
|
10316
|
+
this.userSelection.move([newNodeCoords[0] - d.coords[0], newNodeCoords[1] - d.coords[1]]);
|
|
10317
|
+
} else {
|
|
10318
|
+
d.move(newNodeCoords);
|
|
10289
10319
|
}
|
|
10290
|
-
this.
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
}
|
|
10294
|
-
}
|
|
10295
|
-
|
|
10320
|
+
this.userHighlight.clear();
|
|
10321
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, true, "f");
|
|
10322
|
+
this.diagramEvent$.next(new DiagramDraggingNodeEvent(d));
|
|
10323
|
+
}
|
|
10324
|
+
}, _DiagramCanvas_finishMovingNode = function _DiagramCanvas_finishMovingNode(event, d) {
|
|
10325
|
+
var _b, _c, _d, _e;
|
|
10326
|
+
if (this.canUserPerformAction(exports.DiagramActions.MoveNode) && !d.removed) {
|
|
10327
|
+
// prevent drag behavior if mouse hasn't moved
|
|
10328
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[0] !== event.x || __classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[1] !== event.y) {
|
|
10329
|
+
let newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
10330
|
+
if ((_b = this.gridConfig) === null || _b === void 0 ? void 0 : _b.snap) {
|
|
10331
|
+
newNodeCoords = this.getClosestGridPoint([newNodeCoords[0] - d.type.snapToGridOffset[0], newNodeCoords[1] - d.type.snapToGridOffset[1]]);
|
|
10332
|
+
newNodeCoords[0] += d.type.snapToGridOffset[0];
|
|
10333
|
+
newNodeCoords[1] += d.type.snapToGridOffset[1];
|
|
10334
|
+
}
|
|
10335
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof MoveAction) {
|
|
10336
|
+
const movingFrom = __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").delta;
|
|
10337
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").delta = [newNodeCoords[0] - movingFrom[0], newNodeCoords[1] - movingFrom[1]];
|
|
10338
|
+
// reset position of node prior to moving it again
|
|
10339
|
+
if (d.selected) {
|
|
10340
|
+
this.userSelection.move([movingFrom[0] - d.coords[0], movingFrom[1] - d.coords[1]]);
|
|
10341
|
+
} else {
|
|
10342
|
+
d.move(movingFrom);
|
|
10343
|
+
}
|
|
10344
|
+
} else if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction) {
|
|
10345
|
+
d.move(newNodeCoords);
|
|
10346
|
+
// if moving a single node, we can change the node's parent,
|
|
10347
|
+
// so we check whether we dropped this node on a potential parent
|
|
10348
|
+
const nodesAtLocation = this.model.nodes.getAtCoordinates(event.x, event.y).filter(n => n.id !== d.id && !n.isDescendantOf(d));
|
|
10349
|
+
// filter by which nodes can have this node as a child
|
|
10350
|
+
const nodesAtLocationWhichCanHaveNodeAsAChild = nodesAtLocation.filter(n => n.type.childrenTypes.includes(d.type.id));
|
|
10351
|
+
// filter by which nodes don't have descendants in this collection
|
|
10352
|
+
const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
|
|
10353
|
+
const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
|
|
10354
|
+
if (droppedOn !== d.parent && (d.type.canBeParentless || droppedOn !== undefined)) {
|
|
10355
|
+
const ancestorOfDroppedOn = droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.getLastAncestor();
|
|
10356
|
+
const fromChildGeometry = __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").from;
|
|
10357
|
+
const setParentAction = new SetParentAction(this, d.id, (_c = d.parent) === null || _c === void 0 ? void 0 : _c.id, droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.id, fromChildGeometry, d.getGeometry(), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.id, ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id), ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id));
|
|
10358
|
+
(_d = d.parent) === null || _d === void 0 ? void 0 : _d.removeChild(d);
|
|
10359
|
+
if (droppedOn !== undefined) {
|
|
10360
|
+
droppedOn.addChild(d);
|
|
10361
|
+
}
|
|
10362
|
+
setParentAction.toChildGeometry = d.getGeometry(d.id);
|
|
10363
|
+
setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id);
|
|
10364
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, setParentAction, "f");
|
|
10365
|
+
} else {
|
|
10366
|
+
const ancestorOfNode = d === null || d === void 0 ? void 0 : d.getLastAncestor();
|
|
10367
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").ancestorId = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id;
|
|
10368
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
|
|
10369
|
+
(_e = d.parent) === null || _e === void 0 ? void 0 : _e.fitToChild(d);
|
|
10370
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry(d.id);
|
|
10371
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
|
|
10372
|
+
}
|
|
10373
|
+
}
|
|
10374
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") !== undefined) {
|
|
10375
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
10376
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
10377
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
10378
|
+
}
|
|
10379
|
+
}
|
|
10380
|
+
}
|
|
10381
|
+
setCursorStyle();
|
|
10382
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
10383
|
+
}, _DiagramCanvas_startMultipleSelection = function _DiagramCanvas_startMultipleSelection(event) {
|
|
10384
|
+
__classPrivateFieldSet(this, _DiagramCanvas_draggingFrom, this.getPointerLocationRelativeToCanvas(event), "f");
|
|
10385
|
+
// we put the multiple selection rectangle in the diagram svg element
|
|
10386
|
+
// so it's not affected by the zoom level in the diagram elements
|
|
10387
|
+
__classPrivateFieldSet(this, _DiagramCanvas_multipleSelectionContainer, this.selectSVGElement().append('rect').attr('stroke', '#0E74B6').attr('fill', 'rgba(14, 116, 182, 0.06)'), "f");
|
|
10388
|
+
}, _DiagramCanvas_continueMultipleSelection = function _DiagramCanvas_continueMultipleSelection(event) {
|
|
10389
|
+
var _b, _c, _d, _e;
|
|
10390
|
+
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
10391
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[0] !== pointerCoords[0] || __classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[1] !== pointerCoords[1]) {
|
|
10392
|
+
setCursorStyle(exports.CursorStyle.Crosshair);
|
|
10393
|
+
// since the multiple selection rectangle is not affected by zoom,
|
|
10394
|
+
// we compensate its coordinates based in the zoom transform to draw it
|
|
10395
|
+
(_e = (_d = (_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_multipleSelectionContainer, "f")) === null || _b === void 0 ? void 0 : _b.attr('x', Math.min(__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[0], pointerCoords[0]) * __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x)) === null || _c === void 0 ? void 0 : _c.attr('y', Math.min(__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[1], pointerCoords[1]) * __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y)) === null || _d === void 0 ? void 0 : _d.attr('width', Math.abs(__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[0] - pointerCoords[0]) * __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k)) === null || _e === void 0 ? void 0 : _e.attr('height', Math.abs(__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[1] - pointerCoords[1]) * __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k);
|
|
10396
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, true, "f");
|
|
10397
|
+
}
|
|
10398
|
+
}, _DiagramCanvas_finishMultipleSelection = function _DiagramCanvas_finishMultipleSelection(event) {
|
|
10399
|
+
var _b;
|
|
10400
|
+
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
10401
|
+
(_b = __classPrivateFieldGet(this, _DiagramCanvas_multipleSelectionContainer, "f")) === null || _b === void 0 ? void 0 : _b.remove();
|
|
10402
|
+
__classPrivateFieldSet(this, _DiagramCanvas_multipleSelectionContainer, undefined, "f");
|
|
10403
|
+
this.userSelection.clear();
|
|
10404
|
+
for (const node of this.model.nodes) {
|
|
10405
|
+
if (rectanglesIntersect([node.coords, [node.coords[0] + node.width, node.coords[1] + node.height]], [__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f"), pointerCoords])) {
|
|
10406
|
+
this.userSelection.add(node);
|
|
10407
|
+
}
|
|
10408
|
+
}
|
|
10409
|
+
this.multipleSelectionOn = false;
|
|
10410
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(this.userSelection.all(), true));
|
|
10411
|
+
setCursorStyle();
|
|
10412
|
+
};
|
|
10413
|
+
_DiagramCanvas_canvasCount = {
|
|
10414
|
+
value: 0
|
|
10415
|
+
};
|
|
10296
10416
|
|
|
10417
|
+
var _CollabClient_instances, _CollabClient_webSocket, _CollabClient_sendQueue, _CollabClient_sessions, _CollabClient_pendingSessions, _CollabClient_onOpen, _CollabClient_onMessage, _CollabClient_onClose, _CollabClient_onError, _CollabClient_send, _CollabClient_receive, _CollabClient_startSyncing;
|
|
10297
10418
|
const VERSION = '0.0.1';
|
|
10298
10419
|
/**
|
|
10299
10420
|
* The client that communicates with the daga-server over WebSockets.
|
|
@@ -10303,24 +10424,26 @@ const VERSION = '0.0.1';
|
|
|
10303
10424
|
*/
|
|
10304
10425
|
class CollabClient {
|
|
10305
10426
|
constructor(dagaServer, userId) {
|
|
10306
|
-
this
|
|
10427
|
+
_CollabClient_instances.add(this);
|
|
10428
|
+
_CollabClient_webSocket.set(this, void 0);
|
|
10429
|
+
_CollabClient_sendQueue.set(this, []);
|
|
10307
10430
|
/**
|
|
10308
10431
|
* Joined sessions by locator.
|
|
10309
10432
|
*/
|
|
10310
|
-
this
|
|
10433
|
+
_CollabClient_sessions.set(this, new Map());
|
|
10311
10434
|
/**
|
|
10312
10435
|
* Created but unacked sessions by refId.
|
|
10313
10436
|
*/
|
|
10314
|
-
this
|
|
10437
|
+
_CollabClient_pendingSessions.set(this, new Map());
|
|
10315
10438
|
this.dagaServer = dagaServer;
|
|
10316
10439
|
this.userId = userId;
|
|
10317
10440
|
this.clientId = uuid.v4();
|
|
10318
|
-
this
|
|
10319
|
-
this.
|
|
10320
|
-
this.
|
|
10321
|
-
this.
|
|
10322
|
-
this.
|
|
10323
|
-
this.
|
|
10441
|
+
__classPrivateFieldSet(this, _CollabClient_webSocket, new WebSocket(this.dagaServer, 'esgrima'), "f");
|
|
10442
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('open', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onOpen).bind(this));
|
|
10443
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('message', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onMessage).bind(this));
|
|
10444
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('close', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onClose).bind(this));
|
|
10445
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('error', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onError).bind(this));
|
|
10446
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
|
|
10324
10447
|
type: 'HELO',
|
|
10325
10448
|
clientId: this.clientId,
|
|
10326
10449
|
userId: this.userId,
|
|
@@ -10328,86 +10451,6 @@ class CollabClient {
|
|
|
10328
10451
|
ts: now()
|
|
10329
10452
|
});
|
|
10330
10453
|
}
|
|
10331
|
-
onOpen() {
|
|
10332
|
-
// Send queued messages.
|
|
10333
|
-
for (const serialized of this.sendQueue) {
|
|
10334
|
-
this.ws.send(serialized);
|
|
10335
|
-
}
|
|
10336
|
-
this.sendQueue = [];
|
|
10337
|
-
}
|
|
10338
|
-
onMessage(e) {
|
|
10339
|
-
const serialized = e.data;
|
|
10340
|
-
const message = JSON.parse(serialized);
|
|
10341
|
-
this.receive(message);
|
|
10342
|
-
}
|
|
10343
|
-
onClose(e) {
|
|
10344
|
-
console.error('WebSocket closed', e);
|
|
10345
|
-
}
|
|
10346
|
-
onError(e) {
|
|
10347
|
-
console.error('WebSocket error', e);
|
|
10348
|
-
}
|
|
10349
|
-
/**
|
|
10350
|
-
* Internal send method. Use instead of calling ws.send directly.
|
|
10351
|
-
*/
|
|
10352
|
-
send(message) {
|
|
10353
|
-
const serialized = JSON.stringify(message);
|
|
10354
|
-
if (this.ws.readyState === WebSocket.OPEN) {
|
|
10355
|
-
this.ws.send(serialized);
|
|
10356
|
-
} else {
|
|
10357
|
-
// Queue until after we connect.
|
|
10358
|
-
this.sendQueue.push(serialized);
|
|
10359
|
-
}
|
|
10360
|
-
}
|
|
10361
|
-
/**
|
|
10362
|
-
* Internal receive method. Use instead of handling ws receive events directly.
|
|
10363
|
-
*/
|
|
10364
|
-
receive(message) {
|
|
10365
|
-
var _a, _b;
|
|
10366
|
-
switch (message.type) {
|
|
10367
|
-
case 'EACK':
|
|
10368
|
-
{
|
|
10369
|
-
const session = this.sessions.get(message.locator);
|
|
10370
|
-
if (session === undefined) {
|
|
10371
|
-
throw new Error(`EACK for unknown locator: "${message.locator}"`);
|
|
10372
|
-
}
|
|
10373
|
-
const initialModel = message.initialModel;
|
|
10374
|
-
new DagaImporter().import(session.canvas.model, initialModel);
|
|
10375
|
-
this.startSyncing(session);
|
|
10376
|
-
(_a = session.joinRoomResolve) === null || _a === void 0 ? void 0 : _a.call(session);
|
|
10377
|
-
session.joinRoomResolve = undefined;
|
|
10378
|
-
break;
|
|
10379
|
-
}
|
|
10380
|
-
case 'ADD':
|
|
10381
|
-
{
|
|
10382
|
-
const session = this.sessions.get(message.locator);
|
|
10383
|
-
if (session === undefined) {
|
|
10384
|
-
throw new Error(`ADD for unknown locator: "${message.locator}"`);
|
|
10385
|
-
}
|
|
10386
|
-
const action = message.payload;
|
|
10387
|
-
session.canvas.collabEngine.receive(action);
|
|
10388
|
-
break;
|
|
10389
|
-
}
|
|
10390
|
-
case 'CACK':
|
|
10391
|
-
{
|
|
10392
|
-
const session = this.pendingSessions.get(message.refId);
|
|
10393
|
-
if (session === undefined) {
|
|
10394
|
-
throw new Error(`CACK for unknown refId: "${message.refId}"`);
|
|
10395
|
-
}
|
|
10396
|
-
session.locator = message.locator;
|
|
10397
|
-
this.pendingSessions.delete(message.refId);
|
|
10398
|
-
this.sessions.set(session.locator, session);
|
|
10399
|
-
(_b = session.createRoomResolve) === null || _b === void 0 ? void 0 : _b.call(session, session.locator);
|
|
10400
|
-
session.createRoomResolve = undefined;
|
|
10401
|
-
// Deliver queued AddMessages now that we have a locator.
|
|
10402
|
-
for (const message of session.addQueue) {
|
|
10403
|
-
this.send(Object.assign(Object.assign({}, message), {
|
|
10404
|
-
locator: session.locator
|
|
10405
|
-
}));
|
|
10406
|
-
}
|
|
10407
|
-
session.addQueue = [];
|
|
10408
|
-
}
|
|
10409
|
-
}
|
|
10410
|
-
}
|
|
10411
10454
|
/**
|
|
10412
10455
|
* Creates and joins a room. The given canvas becomes collaborative, starting
|
|
10413
10456
|
* with its current model.
|
|
@@ -10422,7 +10465,7 @@ class CollabClient {
|
|
|
10422
10465
|
canvas.collabEngine.isInRoom = true;
|
|
10423
10466
|
const refId = uuid.v4();
|
|
10424
10467
|
const initialModel = new DagaExporter().export(canvas.model, true);
|
|
10425
|
-
this.
|
|
10468
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
|
|
10426
10469
|
type: 'CREA',
|
|
10427
10470
|
clientId: this.clientId,
|
|
10428
10471
|
userId: this.userId,
|
|
@@ -10435,10 +10478,10 @@ class CollabClient {
|
|
|
10435
10478
|
locator: null,
|
|
10436
10479
|
addQueue: []
|
|
10437
10480
|
};
|
|
10438
|
-
this.
|
|
10481
|
+
__classPrivateFieldGet(this, _CollabClient_pendingSessions, "f").set(refId, session);
|
|
10439
10482
|
// We need to start queuing local AddMessages immediately, in case the user edits
|
|
10440
10483
|
// the diagram while the CREA message is in-flight.
|
|
10441
|
-
this.
|
|
10484
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_startSyncing).call(this, session);
|
|
10442
10485
|
return new Promise(resolve => {
|
|
10443
10486
|
session.createRoomResolve = resolve;
|
|
10444
10487
|
});
|
|
@@ -10457,7 +10500,7 @@ class CollabClient {
|
|
|
10457
10500
|
throw new Error('Canvas is already in a room');
|
|
10458
10501
|
}
|
|
10459
10502
|
canvas.collabEngine.isInRoom = true;
|
|
10460
|
-
this.
|
|
10503
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
|
|
10461
10504
|
type: 'ENRO',
|
|
10462
10505
|
clientId: this.clientId,
|
|
10463
10506
|
userId: this.userId,
|
|
@@ -10469,36 +10512,104 @@ class CollabClient {
|
|
|
10469
10512
|
locator,
|
|
10470
10513
|
addQueue: []
|
|
10471
10514
|
};
|
|
10472
|
-
this.
|
|
10515
|
+
__classPrivateFieldGet(this, _CollabClient_sessions, "f").set(locator, session);
|
|
10473
10516
|
return new Promise(resolve => {
|
|
10474
10517
|
session.joinRoomResolve = resolve;
|
|
10475
10518
|
});
|
|
10476
10519
|
}
|
|
10477
|
-
startSyncing(session) {
|
|
10478
|
-
// Sync AddMessages from us to the server.
|
|
10479
|
-
session.canvas.collabEngine.onSend = action => {
|
|
10480
|
-
if (session.locator === null) {
|
|
10481
|
-
// Queue until we receive the locator in the CACK message.
|
|
10482
|
-
session.addQueue.push({
|
|
10483
|
-
type: 'ADD',
|
|
10484
|
-
clientId: this.clientId,
|
|
10485
|
-
userId: this.userId,
|
|
10486
|
-
payload: action,
|
|
10487
|
-
ts: now()
|
|
10488
|
-
});
|
|
10489
|
-
} else {
|
|
10490
|
-
this.send({
|
|
10491
|
-
type: 'ADD',
|
|
10492
|
-
clientId: this.clientId,
|
|
10493
|
-
userId: this.userId,
|
|
10494
|
-
locator: session.locator,
|
|
10495
|
-
payload: action,
|
|
10496
|
-
ts: now()
|
|
10497
|
-
});
|
|
10498
|
-
}
|
|
10499
|
-
};
|
|
10500
|
-
}
|
|
10501
10520
|
}
|
|
10521
|
+
_CollabClient_webSocket = new WeakMap(), _CollabClient_sendQueue = new WeakMap(), _CollabClient_sessions = new WeakMap(), _CollabClient_pendingSessions = new WeakMap(), _CollabClient_instances = new WeakSet(), _CollabClient_onOpen = function _CollabClient_onOpen() {
|
|
10522
|
+
// Send queued messages.
|
|
10523
|
+
for (const serialized of __classPrivateFieldGet(this, _CollabClient_sendQueue, "f")) {
|
|
10524
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").send(serialized);
|
|
10525
|
+
}
|
|
10526
|
+
__classPrivateFieldSet(this, _CollabClient_sendQueue, [], "f");
|
|
10527
|
+
}, _CollabClient_onMessage = function _CollabClient_onMessage(e) {
|
|
10528
|
+
const serialized = e.data;
|
|
10529
|
+
const message = JSON.parse(serialized);
|
|
10530
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_receive).call(this, message);
|
|
10531
|
+
}, _CollabClient_onClose = function _CollabClient_onClose(e) {
|
|
10532
|
+
console.error('WebSocket closed', e);
|
|
10533
|
+
}, _CollabClient_onError = function _CollabClient_onError(e) {
|
|
10534
|
+
console.error('WebSocket error', e);
|
|
10535
|
+
}, _CollabClient_send = function _CollabClient_send(message) {
|
|
10536
|
+
const serialized = JSON.stringify(message);
|
|
10537
|
+
if (__classPrivateFieldGet(this, _CollabClient_webSocket, "f").readyState === WebSocket.OPEN) {
|
|
10538
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").send(serialized);
|
|
10539
|
+
} else {
|
|
10540
|
+
// Queue until after we connect.
|
|
10541
|
+
__classPrivateFieldGet(this, _CollabClient_sendQueue, "f").push(serialized);
|
|
10542
|
+
}
|
|
10543
|
+
}, _CollabClient_receive = function _CollabClient_receive(message) {
|
|
10544
|
+
var _a, _b;
|
|
10545
|
+
switch (message.type) {
|
|
10546
|
+
case 'EACK':
|
|
10547
|
+
{
|
|
10548
|
+
const session = __classPrivateFieldGet(this, _CollabClient_sessions, "f").get(message.locator);
|
|
10549
|
+
if (session === undefined) {
|
|
10550
|
+
throw new Error(`EACK for unknown locator: "${message.locator}"`);
|
|
10551
|
+
}
|
|
10552
|
+
const initialModel = message.initialModel;
|
|
10553
|
+
new DagaImporter().import(session.canvas.model, initialModel);
|
|
10554
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_startSyncing).call(this, session);
|
|
10555
|
+
(_a = session.joinRoomResolve) === null || _a === void 0 ? void 0 : _a.call(session);
|
|
10556
|
+
session.joinRoomResolve = undefined;
|
|
10557
|
+
break;
|
|
10558
|
+
}
|
|
10559
|
+
case 'ADD':
|
|
10560
|
+
{
|
|
10561
|
+
const session = __classPrivateFieldGet(this, _CollabClient_sessions, "f").get(message.locator);
|
|
10562
|
+
if (session === undefined) {
|
|
10563
|
+
throw new Error(`ADD for unknown locator: "${message.locator}"`);
|
|
10564
|
+
}
|
|
10565
|
+
const action = message.payload;
|
|
10566
|
+
session.canvas.collabEngine.receive(action);
|
|
10567
|
+
break;
|
|
10568
|
+
}
|
|
10569
|
+
case 'CACK':
|
|
10570
|
+
{
|
|
10571
|
+
const session = __classPrivateFieldGet(this, _CollabClient_pendingSessions, "f").get(message.refId);
|
|
10572
|
+
if (session === undefined) {
|
|
10573
|
+
throw new Error(`CACK for unknown refId: "${message.refId}"`);
|
|
10574
|
+
}
|
|
10575
|
+
session.locator = message.locator;
|
|
10576
|
+
__classPrivateFieldGet(this, _CollabClient_pendingSessions, "f").delete(message.refId);
|
|
10577
|
+
__classPrivateFieldGet(this, _CollabClient_sessions, "f").set(session.locator, session);
|
|
10578
|
+
(_b = session.createRoomResolve) === null || _b === void 0 ? void 0 : _b.call(session, session.locator);
|
|
10579
|
+
session.createRoomResolve = undefined;
|
|
10580
|
+
// Deliver queued AddMessages now that we have a locator.
|
|
10581
|
+
for (const message of session.addQueue) {
|
|
10582
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, Object.assign(Object.assign({}, message), {
|
|
10583
|
+
locator: session.locator
|
|
10584
|
+
}));
|
|
10585
|
+
}
|
|
10586
|
+
session.addQueue = [];
|
|
10587
|
+
}
|
|
10588
|
+
}
|
|
10589
|
+
}, _CollabClient_startSyncing = function _CollabClient_startSyncing(session) {
|
|
10590
|
+
// Sync AddMessages from us to the server.
|
|
10591
|
+
session.canvas.collabEngine.onSend = action => {
|
|
10592
|
+
if (session.locator === null) {
|
|
10593
|
+
// Queue until we receive the locator in the CACK message.
|
|
10594
|
+
session.addQueue.push({
|
|
10595
|
+
type: 'ADD',
|
|
10596
|
+
clientId: this.clientId,
|
|
10597
|
+
userId: this.userId,
|
|
10598
|
+
payload: action,
|
|
10599
|
+
ts: now()
|
|
10600
|
+
});
|
|
10601
|
+
} else {
|
|
10602
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
|
|
10603
|
+
type: 'ADD',
|
|
10604
|
+
clientId: this.clientId,
|
|
10605
|
+
userId: this.userId,
|
|
10606
|
+
locator: session.locator,
|
|
10607
|
+
payload: action,
|
|
10608
|
+
ts: now()
|
|
10609
|
+
});
|
|
10610
|
+
}
|
|
10611
|
+
};
|
|
10612
|
+
};
|
|
10502
10613
|
/**
|
|
10503
10614
|
* Returns the current timestamp for a message's ts field.
|
|
10504
10615
|
*/
|
|
@@ -10506,66 +10617,67 @@ function now() {
|
|
|
10506
10617
|
return new Date().toISOString();
|
|
10507
10618
|
}
|
|
10508
10619
|
|
|
10620
|
+
var _Grid_grid, _Grid_offsetX, _Grid_offsetY;
|
|
10509
10621
|
/**
|
|
10510
10622
|
* A two dimensional array of elements of the given class that can extend infinitely in any direction, both positive and negative.
|
|
10511
10623
|
* @private
|
|
10512
10624
|
*/
|
|
10513
10625
|
class Grid {
|
|
10514
10626
|
constructor() {
|
|
10515
|
-
this
|
|
10516
|
-
this
|
|
10517
|
-
this
|
|
10627
|
+
_Grid_grid.set(this, [[undefined]]);
|
|
10628
|
+
_Grid_offsetX.set(this, 0);
|
|
10629
|
+
_Grid_offsetY.set(this, 0);
|
|
10518
10630
|
}
|
|
10519
10631
|
/**
|
|
10520
10632
|
* Get the minimum x coordinate among the elements in the grid.
|
|
10521
10633
|
*/
|
|
10522
10634
|
minX() {
|
|
10523
|
-
return -this
|
|
10635
|
+
return -__classPrivateFieldGet(this, _Grid_offsetX, "f");
|
|
10524
10636
|
}
|
|
10525
10637
|
/**
|
|
10526
10638
|
* Get the maximum x coordinate among the elements in the grid.
|
|
10527
10639
|
*/
|
|
10528
10640
|
maxX() {
|
|
10529
|
-
return this.width() - 1 - this
|
|
10641
|
+
return this.width() - 1 - __classPrivateFieldGet(this, _Grid_offsetX, "f");
|
|
10530
10642
|
}
|
|
10531
10643
|
/**
|
|
10532
10644
|
* Get the minimum y coordinate among the elements in the grid.
|
|
10533
10645
|
*/
|
|
10534
10646
|
minY() {
|
|
10535
|
-
return -this
|
|
10647
|
+
return -__classPrivateFieldGet(this, _Grid_offsetY, "f");
|
|
10536
10648
|
}
|
|
10537
10649
|
/**
|
|
10538
10650
|
* Get the maximum y coordinate among the elements in the grid.
|
|
10539
10651
|
*/
|
|
10540
10652
|
maxY() {
|
|
10541
|
-
return this.height() - 1 - this
|
|
10653
|
+
return this.height() - 1 - __classPrivateFieldGet(this, _Grid_offsetY, "f");
|
|
10542
10654
|
}
|
|
10543
10655
|
/**
|
|
10544
10656
|
* Get the total extension of the grid along the x axis.
|
|
10545
10657
|
*/
|
|
10546
10658
|
width() {
|
|
10547
|
-
return this
|
|
10659
|
+
return __classPrivateFieldGet(this, _Grid_grid, "f")[0].length;
|
|
10548
10660
|
}
|
|
10549
10661
|
/**
|
|
10550
10662
|
* Get the total extension of the grid along the y axis.
|
|
10551
10663
|
*/
|
|
10552
10664
|
height() {
|
|
10553
|
-
return this.
|
|
10665
|
+
return __classPrivateFieldGet(this, _Grid_grid, "f").length;
|
|
10554
10666
|
}
|
|
10555
10667
|
/**
|
|
10556
10668
|
* Add a new column at the start of the x axis.
|
|
10557
10669
|
*/
|
|
10558
10670
|
addColumnLeft() {
|
|
10559
|
-
for (const row of this
|
|
10671
|
+
for (const row of __classPrivateFieldGet(this, _Grid_grid, "f")) {
|
|
10560
10672
|
row.splice(0, 0, undefined);
|
|
10561
10673
|
}
|
|
10562
|
-
this
|
|
10674
|
+
__classPrivateFieldSet(this, _Grid_offsetX, __classPrivateFieldGet(this, _Grid_offsetX, "f") + 1, "f");
|
|
10563
10675
|
}
|
|
10564
10676
|
/**
|
|
10565
10677
|
* Add a new column at the end of the x axis.
|
|
10566
10678
|
*/
|
|
10567
10679
|
addColumnRight() {
|
|
10568
|
-
for (const row of this
|
|
10680
|
+
for (const row of __classPrivateFieldGet(this, _Grid_grid, "f")) {
|
|
10569
10681
|
row.push(undefined);
|
|
10570
10682
|
}
|
|
10571
10683
|
}
|
|
@@ -10574,28 +10686,28 @@ class Grid {
|
|
|
10574
10686
|
*/
|
|
10575
10687
|
addRowTop() {
|
|
10576
10688
|
const newRow = [];
|
|
10577
|
-
for (let i = 0; i < this
|
|
10689
|
+
for (let i = 0; i < __classPrivateFieldGet(this, _Grid_grid, "f")[0].length; ++i) {
|
|
10578
10690
|
newRow.push(undefined);
|
|
10579
10691
|
}
|
|
10580
|
-
this.
|
|
10581
|
-
this
|
|
10692
|
+
__classPrivateFieldGet(this, _Grid_grid, "f").splice(0, 0, newRow);
|
|
10693
|
+
__classPrivateFieldSet(this, _Grid_offsetY, __classPrivateFieldGet(this, _Grid_offsetY, "f") + 1, "f");
|
|
10582
10694
|
}
|
|
10583
10695
|
/**
|
|
10584
10696
|
* Add a new row at the end of the y axis.
|
|
10585
10697
|
*/
|
|
10586
10698
|
addRowBottom() {
|
|
10587
10699
|
const newRow = [];
|
|
10588
|
-
for (let i = 0; i < this
|
|
10700
|
+
for (let i = 0; i < __classPrivateFieldGet(this, _Grid_grid, "f")[0].length; ++i) {
|
|
10589
10701
|
newRow.push(undefined);
|
|
10590
10702
|
}
|
|
10591
|
-
this.
|
|
10703
|
+
__classPrivateFieldGet(this, _Grid_grid, "f").push(newRow);
|
|
10592
10704
|
}
|
|
10593
10705
|
/**
|
|
10594
10706
|
* Get the element at the given coordinates or undefined if there is no element at the given coordinates.
|
|
10595
10707
|
*/
|
|
10596
10708
|
get(coords) {
|
|
10597
|
-
if (this
|
|
10598
|
-
return this
|
|
10709
|
+
if (__classPrivateFieldGet(this, _Grid_grid, "f")[coords[1] + __classPrivateFieldGet(this, _Grid_offsetY, "f")]) {
|
|
10710
|
+
return __classPrivateFieldGet(this, _Grid_grid, "f")[coords[1] + __classPrivateFieldGet(this, _Grid_offsetY, "f")][coords[0] + __classPrivateFieldGet(this, _Grid_offsetX, "f")];
|
|
10599
10711
|
}
|
|
10600
10712
|
return undefined;
|
|
10601
10713
|
}
|
|
@@ -10603,19 +10715,19 @@ class Grid {
|
|
|
10603
10715
|
* Set the element at the given coordinates to the given element.
|
|
10604
10716
|
*/
|
|
10605
10717
|
set(coords, value) {
|
|
10606
|
-
while (coords[0] < -this
|
|
10718
|
+
while (coords[0] < -__classPrivateFieldGet(this, _Grid_offsetX, "f")) {
|
|
10607
10719
|
this.addColumnLeft();
|
|
10608
10720
|
}
|
|
10609
|
-
while (coords[0] >= this.width() - this
|
|
10721
|
+
while (coords[0] >= this.width() - __classPrivateFieldGet(this, _Grid_offsetX, "f")) {
|
|
10610
10722
|
this.addColumnRight();
|
|
10611
10723
|
}
|
|
10612
|
-
while (coords[1] < -this
|
|
10724
|
+
while (coords[1] < -__classPrivateFieldGet(this, _Grid_offsetY, "f")) {
|
|
10613
10725
|
this.addRowTop();
|
|
10614
10726
|
}
|
|
10615
|
-
while (coords[1] >= this.height() - this
|
|
10727
|
+
while (coords[1] >= this.height() - __classPrivateFieldGet(this, _Grid_offsetY, "f")) {
|
|
10616
10728
|
this.addRowBottom();
|
|
10617
10729
|
}
|
|
10618
|
-
this
|
|
10730
|
+
__classPrivateFieldGet(this, _Grid_grid, "f")[coords[1] + __classPrivateFieldGet(this, _Grid_offsetY, "f")][coords[0] + __classPrivateFieldGet(this, _Grid_offsetX, "f")] = value;
|
|
10619
10731
|
}
|
|
10620
10732
|
/**
|
|
10621
10733
|
* Get the closest coordinates to the given coordinates that are not set to an element.
|
|
@@ -10645,6 +10757,7 @@ class Grid {
|
|
|
10645
10757
|
}
|
|
10646
10758
|
}
|
|
10647
10759
|
}
|
|
10760
|
+
_Grid_grid = new WeakMap(), _Grid_offsetX = new WeakMap(), _Grid_offsetY = new WeakMap();
|
|
10648
10761
|
|
|
10649
10762
|
/**
|
|
10650
10763
|
* A layout which places adjacent nodes close by, placing nodes in order according to depth first search.
|