@metadev/daga 5.1.2 → 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 +453 -446
- package/README.md +78 -78
- package/index.cjs.js +1211 -1155
- package/index.esm.js +1211 -1155
- package/package.json +1 -1
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +1 -46
- 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/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 +3 -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/util/grid.d.ts +1 -3
package/index.esm.js
CHANGED
|
@@ -101,6 +101,53 @@ var VerticalAlign;
|
|
|
101
101
|
VerticalAlign["Bottom"] = "bottom";
|
|
102
102
|
})(VerticalAlign || (VerticalAlign = {}));
|
|
103
103
|
|
|
104
|
+
/******************************************************************************
|
|
105
|
+
Copyright (c) Microsoft Corporation.
|
|
106
|
+
|
|
107
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
108
|
+
purpose with or without fee is hereby granted.
|
|
109
|
+
|
|
110
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
111
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
112
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
113
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
114
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
115
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
116
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
117
|
+
***************************************************************************** */
|
|
118
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
function __rest(s, e) {
|
|
122
|
+
var t = {};
|
|
123
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
124
|
+
t[p] = s[p];
|
|
125
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
126
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
127
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
128
|
+
t[p[i]] = s[p[i]];
|
|
129
|
+
}
|
|
130
|
+
return t;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
134
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
135
|
+
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");
|
|
136
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
140
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
141
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
142
|
+
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");
|
|
143
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
147
|
+
var e = new Error(message);
|
|
148
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
149
|
+
};
|
|
150
|
+
|
|
104
151
|
/**
|
|
105
152
|
* Round the coordinates of the given point to the nearest whole number.
|
|
106
153
|
* @public
|
|
@@ -1193,40 +1240,6 @@ const clone = o => {
|
|
|
1193
1240
|
return res;
|
|
1194
1241
|
};
|
|
1195
1242
|
|
|
1196
|
-
/******************************************************************************
|
|
1197
|
-
Copyright (c) Microsoft Corporation.
|
|
1198
|
-
|
|
1199
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
1200
|
-
purpose with or without fee is hereby granted.
|
|
1201
|
-
|
|
1202
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1203
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1204
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1205
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1206
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1207
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1208
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
1209
|
-
***************************************************************************** */
|
|
1210
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
function __rest(s, e) {
|
|
1214
|
-
var t = {};
|
|
1215
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1216
|
-
t[p] = s[p];
|
|
1217
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1218
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1219
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1220
|
-
t[p[i]] = s[p[i]];
|
|
1221
|
-
}
|
|
1222
|
-
return t;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
1226
|
-
var e = new Error(message);
|
|
1227
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1228
|
-
};
|
|
1229
|
-
|
|
1230
1243
|
/**
|
|
1231
1244
|
* Converts a configuration for a look into an easier to consult object of fully qualified looks for each case.
|
|
1232
1245
|
*
|
|
@@ -1484,6 +1497,7 @@ const diffProperties = (a, b, valueSet) => {
|
|
|
1484
1497
|
*/
|
|
1485
1498
|
const isObject = x => x !== undefined && x !== null && x.constructor === Object;
|
|
1486
1499
|
|
|
1500
|
+
var _ValueSet_instances, _a$1, _ValueSet_values, _ValueSet_valueSets, _ValueSet_ownTimestamps, _ValueSet_constructSubValueSet;
|
|
1487
1501
|
/**
|
|
1488
1502
|
* A set of values corresponding to a set of properties.
|
|
1489
1503
|
* @public
|
|
@@ -1491,17 +1505,18 @@ const isObject = x => x !== undefined && x !== null && x.constructor === Object;
|
|
|
1491
1505
|
*/
|
|
1492
1506
|
class ValueSet {
|
|
1493
1507
|
constructor(propertySet, rootElement) {
|
|
1508
|
+
_ValueSet_instances.add(this);
|
|
1494
1509
|
this.displayedProperties = [];
|
|
1495
1510
|
this.hiddenProperties = [];
|
|
1496
|
-
this
|
|
1497
|
-
this
|
|
1511
|
+
_ValueSet_values.set(this, {});
|
|
1512
|
+
_ValueSet_valueSets.set(this, {});
|
|
1498
1513
|
/**
|
|
1499
1514
|
* Collaborative timestamps for all keys in this.values that have ever been set,
|
|
1500
1515
|
* even if since they've since been set to the default value.
|
|
1501
1516
|
*
|
|
1502
1517
|
* Object values (in this.valueSets) store their own timestamps separately.
|
|
1503
1518
|
*/
|
|
1504
|
-
this
|
|
1519
|
+
_ValueSet_ownTimestamps.set(this, {});
|
|
1505
1520
|
this.propertySet = propertySet;
|
|
1506
1521
|
this.rootElement = rootElement;
|
|
1507
1522
|
this.resetValues();
|
|
@@ -1576,16 +1591,16 @@ class ValueSet {
|
|
|
1576
1591
|
*/
|
|
1577
1592
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1578
1593
|
getValue(key) {
|
|
1579
|
-
var
|
|
1580
|
-
const rootAttribute = (
|
|
1594
|
+
var _b;
|
|
1595
|
+
const rootAttribute = (_b = this.propertySet.getProperty(key)) === null || _b === void 0 ? void 0 : _b.rootAttribute;
|
|
1581
1596
|
if (rootAttribute !== undefined && rootAttribute !== null) {
|
|
1582
|
-
this
|
|
1597
|
+
__classPrivateFieldGet(this, _ValueSet_values, "f")[key] = this.getRootElementValue(rootAttribute);
|
|
1583
1598
|
}
|
|
1584
1599
|
const property = this.propertySet.getProperty(key);
|
|
1585
1600
|
if (property.type === Type.Object) {
|
|
1586
|
-
return this
|
|
1601
|
+
return __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getValues();
|
|
1587
1602
|
} else {
|
|
1588
|
-
return this
|
|
1603
|
+
return __classPrivateFieldGet(this, _ValueSet_values, "f")[key];
|
|
1589
1604
|
}
|
|
1590
1605
|
}
|
|
1591
1606
|
/**
|
|
@@ -1598,7 +1613,7 @@ class ValueSet {
|
|
|
1598
1613
|
for (const key in this.propertySet.propertyMap) {
|
|
1599
1614
|
const property = this.propertySet.getProperty(key);
|
|
1600
1615
|
if (property.type === Type.Object) {
|
|
1601
|
-
result[key] = this
|
|
1616
|
+
result[key] = __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getValues();
|
|
1602
1617
|
} else {
|
|
1603
1618
|
result[key] = this.getValue(key);
|
|
1604
1619
|
}
|
|
@@ -1615,7 +1630,7 @@ class ValueSet {
|
|
|
1615
1630
|
for (const key in keys) {
|
|
1616
1631
|
const property = this.propertySet.getProperty(key);
|
|
1617
1632
|
if (property.type === Type.Object) {
|
|
1618
|
-
result[key] = this
|
|
1633
|
+
result[key] = __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getValuesForKeys(keys[key]);
|
|
1619
1634
|
} else {
|
|
1620
1635
|
result[key] = this.getValue(key);
|
|
1621
1636
|
}
|
|
@@ -1632,9 +1647,9 @@ class ValueSet {
|
|
|
1632
1647
|
for (const key in this.propertySet.propertyMap) {
|
|
1633
1648
|
const property = this.propertySet.getProperty(key);
|
|
1634
1649
|
if (property.type === Type.Object) {
|
|
1635
|
-
result[key] = this
|
|
1650
|
+
result[key] = __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].getTimestamps();
|
|
1636
1651
|
} else {
|
|
1637
|
-
const timestamp = this
|
|
1652
|
+
const timestamp = __classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key];
|
|
1638
1653
|
if (timestamp) result[key] = timestamp;
|
|
1639
1654
|
}
|
|
1640
1655
|
}
|
|
@@ -1687,9 +1702,9 @@ class ValueSet {
|
|
|
1687
1702
|
const property = this.propertySet.getProperty(key);
|
|
1688
1703
|
if (property) {
|
|
1689
1704
|
if (property.type === Type.Object) {
|
|
1690
|
-
this
|
|
1705
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].setValues(value);
|
|
1691
1706
|
} else {
|
|
1692
|
-
this
|
|
1707
|
+
__classPrivateFieldGet(this, _ValueSet_values, "f")[key] = value;
|
|
1693
1708
|
if (!equals(value, property.defaultValue)) {
|
|
1694
1709
|
this.displayProperty(property);
|
|
1695
1710
|
}
|
|
@@ -1710,7 +1725,7 @@ class ValueSet {
|
|
|
1710
1725
|
for (const key in values) {
|
|
1711
1726
|
const property = this.propertySet.getProperty(key);
|
|
1712
1727
|
if (property.type === Type.Object) {
|
|
1713
|
-
this
|
|
1728
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].setValues(values[key]);
|
|
1714
1729
|
} else {
|
|
1715
1730
|
this.setValue(key, values[key]);
|
|
1716
1731
|
}
|
|
@@ -1722,13 +1737,13 @@ class ValueSet {
|
|
|
1722
1737
|
* @param values An object containing all the CollabTimestamps in the set.
|
|
1723
1738
|
*/
|
|
1724
1739
|
setTimestamps(timestamps) {
|
|
1725
|
-
this
|
|
1740
|
+
__classPrivateFieldSet(this, _ValueSet_ownTimestamps, {}, "f");
|
|
1726
1741
|
for (const key in timestamps) {
|
|
1727
1742
|
const property = this.propertySet.getProperty(key);
|
|
1728
1743
|
if (property.type === Type.Object) {
|
|
1729
|
-
this
|
|
1744
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].setTimestamps(timestamps[key]);
|
|
1730
1745
|
} else {
|
|
1731
|
-
this
|
|
1746
|
+
__classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key] = timestamps[key];
|
|
1732
1747
|
}
|
|
1733
1748
|
}
|
|
1734
1749
|
}
|
|
@@ -1741,7 +1756,7 @@ class ValueSet {
|
|
|
1741
1756
|
for (const key in values) {
|
|
1742
1757
|
const property = this.propertySet.getProperty(key);
|
|
1743
1758
|
if (property.type === Type.Object) {
|
|
1744
|
-
this
|
|
1759
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].overwriteValues(values[key]);
|
|
1745
1760
|
} else {
|
|
1746
1761
|
this.setValue(key, values[key]);
|
|
1747
1762
|
}
|
|
@@ -1756,11 +1771,11 @@ class ValueSet {
|
|
|
1756
1771
|
for (const key in values) {
|
|
1757
1772
|
const property = this.propertySet.getProperty(key);
|
|
1758
1773
|
if (property.type === Type.Object) {
|
|
1759
|
-
this
|
|
1774
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key].overwriteValuesLww(values[key], timestamp);
|
|
1760
1775
|
} else {
|
|
1761
|
-
if (timestampWins(timestamp, this
|
|
1776
|
+
if (timestampWins(timestamp, __classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key])) {
|
|
1762
1777
|
this.setValue(key, values[key]);
|
|
1763
|
-
this
|
|
1778
|
+
__classPrivateFieldGet(this, _ValueSet_ownTimestamps, "f")[key] = timestamp;
|
|
1764
1779
|
}
|
|
1765
1780
|
}
|
|
1766
1781
|
}
|
|
@@ -1773,18 +1788,18 @@ class ValueSet {
|
|
|
1773
1788
|
resetValues() {
|
|
1774
1789
|
this.displayedProperties = [];
|
|
1775
1790
|
this.hiddenProperties = [];
|
|
1776
|
-
this
|
|
1791
|
+
__classPrivateFieldSet(this, _ValueSet_ownTimestamps, {}, "f");
|
|
1777
1792
|
for (const key in this.propertySet.propertyMap) {
|
|
1778
1793
|
const property = this.propertySet.getProperty(key);
|
|
1779
1794
|
const rootAttribute = property.rootAttribute;
|
|
1780
1795
|
if (property.type === Type.Object) {
|
|
1781
|
-
this
|
|
1796
|
+
__classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key] = __classPrivateFieldGet(this, _ValueSet_instances, "m", _ValueSet_constructSubValueSet).call(this, key);
|
|
1782
1797
|
} else {
|
|
1783
|
-
this
|
|
1798
|
+
__classPrivateFieldGet(this, _ValueSet_values, "f")[key] = clone(property.defaultValue);
|
|
1784
1799
|
}
|
|
1785
1800
|
if (rootAttribute !== undefined && rootAttribute !== null) {
|
|
1786
1801
|
if (property.defaultValue !== undefined && !equals(this.getRootElementValue(rootAttribute), property.defaultValue)) {
|
|
1787
|
-
this.setRootElementValue(rootAttribute, this
|
|
1802
|
+
this.setRootElementValue(rootAttribute, __classPrivateFieldGet(this, _ValueSet_values, "f")[key]);
|
|
1788
1803
|
}
|
|
1789
1804
|
}
|
|
1790
1805
|
if (property.basic !== false) {
|
|
@@ -1794,19 +1809,6 @@ class ValueSet {
|
|
|
1794
1809
|
}
|
|
1795
1810
|
}
|
|
1796
1811
|
}
|
|
1797
|
-
/**
|
|
1798
|
-
* Constructs a ValueSet with its corresponding PropertySet representing the values of the object.
|
|
1799
|
-
* @private
|
|
1800
|
-
* @param key Key that the ValueSet is under.
|
|
1801
|
-
* @returns The constructed ValueSet.
|
|
1802
|
-
*/
|
|
1803
|
-
constructSubValueSet(key) {
|
|
1804
|
-
const property = this.propertySet.getProperty(key);
|
|
1805
|
-
const propertySet = new PropertySet(property.properties);
|
|
1806
|
-
const valueSet = new ValueSet(propertySet, this.rootElement);
|
|
1807
|
-
valueSet.overwriteValues(clone(property.defaultValue));
|
|
1808
|
-
return valueSet;
|
|
1809
|
-
}
|
|
1810
1812
|
/**
|
|
1811
1813
|
* Gets the ValueSet under the given key when there are nested ValueSets.
|
|
1812
1814
|
* @private
|
|
@@ -1814,7 +1816,7 @@ class ValueSet {
|
|
|
1814
1816
|
* @returns A ValueSet.
|
|
1815
1817
|
*/
|
|
1816
1818
|
getSubValueSet(key) {
|
|
1817
|
-
return this
|
|
1819
|
+
return __classPrivateFieldGet(this, _ValueSet_valueSets, "f")[key];
|
|
1818
1820
|
}
|
|
1819
1821
|
/**
|
|
1820
1822
|
* Moves the given property to the list of displayed properties.
|
|
@@ -1839,6 +1841,13 @@ class ValueSet {
|
|
|
1839
1841
|
}
|
|
1840
1842
|
}
|
|
1841
1843
|
}
|
|
1844
|
+
_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) {
|
|
1845
|
+
const property = this.propertySet.getProperty(key);
|
|
1846
|
+
const propertySet = new PropertySet(property.properties);
|
|
1847
|
+
const valueSet = new _a$1(propertySet, this.rootElement);
|
|
1848
|
+
valueSet.overwriteValues(clone(property.defaultValue));
|
|
1849
|
+
return valueSet;
|
|
1850
|
+
};
|
|
1842
1851
|
|
|
1843
1852
|
/**
|
|
1844
1853
|
* Represents a collection of diagram entities of a type that exists as part of a diagram model.
|
|
@@ -1976,6 +1985,7 @@ class DiagramEntitySet {
|
|
|
1976
1985
|
}
|
|
1977
1986
|
}
|
|
1978
1987
|
|
|
1988
|
+
var _DiagramElement_id;
|
|
1979
1989
|
/**
|
|
1980
1990
|
* Default priority value for diagram elements.
|
|
1981
1991
|
* @private
|
|
@@ -1993,7 +2003,7 @@ class DiagramElement {
|
|
|
1993
2003
|
* @public
|
|
1994
2004
|
*/
|
|
1995
2005
|
get id() {
|
|
1996
|
-
return this
|
|
2006
|
+
return __classPrivateFieldGet(this, _DiagramElement_id, "f");
|
|
1997
2007
|
}
|
|
1998
2008
|
/**
|
|
1999
2009
|
* Whether this diagram element is currently in the user highlight.
|
|
@@ -2011,6 +2021,7 @@ class DiagramElement {
|
|
|
2011
2021
|
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;
|
|
2012
2022
|
}
|
|
2013
2023
|
constructor(model, id) {
|
|
2024
|
+
_DiagramElement_id.set(this, void 0);
|
|
2014
2025
|
/**
|
|
2015
2026
|
* Whether this diagram element has itself been explicitly removed.
|
|
2016
2027
|
*
|
|
@@ -2029,7 +2040,7 @@ class DiagramElement {
|
|
|
2029
2040
|
*/
|
|
2030
2041
|
this.selfRemovedTimestamp = null;
|
|
2031
2042
|
this.model = model;
|
|
2032
|
-
this
|
|
2043
|
+
__classPrivateFieldSet(this, _DiagramElement_id, id, "f");
|
|
2033
2044
|
}
|
|
2034
2045
|
/**
|
|
2035
2046
|
* Obtain the selection of this element.
|
|
@@ -2040,6 +2051,7 @@ class DiagramElement {
|
|
|
2040
2051
|
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)}']`);
|
|
2041
2052
|
}
|
|
2042
2053
|
}
|
|
2054
|
+
_DiagramElement_id = new WeakMap();
|
|
2043
2055
|
class DiagramElementSet extends DiagramEntitySet {
|
|
2044
2056
|
all(includeRemoved = false) {
|
|
2045
2057
|
if (includeRemoved) {
|
|
@@ -2117,6 +2129,7 @@ class DiagramElementSet extends DiagramEntitySet {
|
|
|
2117
2129
|
}
|
|
2118
2130
|
}
|
|
2119
2131
|
|
|
2132
|
+
var _DiagramConnection_type, _DiagramConnectionSet_model;
|
|
2120
2133
|
/**
|
|
2121
2134
|
* Default values of the parameters of a diagram connection.
|
|
2122
2135
|
* @private
|
|
@@ -2201,12 +2214,12 @@ class DiagramConnectionType {
|
|
|
2201
2214
|
*/
|
|
2202
2215
|
class DiagramConnection extends DiagramElement {
|
|
2203
2216
|
get type() {
|
|
2204
|
-
return this
|
|
2217
|
+
return __classPrivateFieldGet(this, _DiagramConnection_type, "f");
|
|
2205
2218
|
}
|
|
2206
2219
|
set type(type) {
|
|
2207
2220
|
var _a, _b;
|
|
2208
|
-
if (type !== this
|
|
2209
|
-
this
|
|
2221
|
+
if (type !== __classPrivateFieldGet(this, _DiagramConnection_type, "f")) {
|
|
2222
|
+
__classPrivateFieldSet(this, _DiagramConnection_type, type, "f");
|
|
2210
2223
|
if (this.valueSet) {
|
|
2211
2224
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
2212
2225
|
}
|
|
@@ -2402,6 +2415,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
2402
2415
|
throw new Error(`DiagramConnection cannot have an empty or null id`);
|
|
2403
2416
|
}
|
|
2404
2417
|
super(model, id);
|
|
2418
|
+
_DiagramConnection_type.set(this, void 0);
|
|
2405
2419
|
/**
|
|
2406
2420
|
* Coordinates of the start point of this connection.
|
|
2407
2421
|
* @public
|
|
@@ -2432,7 +2446,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
2432
2446
|
* @public
|
|
2433
2447
|
*/
|
|
2434
2448
|
this.points = [];
|
|
2435
|
-
this
|
|
2449
|
+
__classPrivateFieldSet(this, _DiagramConnection_type, type, "f");
|
|
2436
2450
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
2437
2451
|
this.originalData = {};
|
|
2438
2452
|
this.setStart(start);
|
|
@@ -2609,6 +2623,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
2609
2623
|
}
|
|
2610
2624
|
}
|
|
2611
2625
|
}
|
|
2626
|
+
_DiagramConnection_type = new WeakMap();
|
|
2612
2627
|
class DiagramConnectionSet extends DiagramElementSet {
|
|
2613
2628
|
/**
|
|
2614
2629
|
* Instance a set of connections for the given model. This method is used internally.
|
|
@@ -2616,12 +2631,13 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
2616
2631
|
*/
|
|
2617
2632
|
constructor(model) {
|
|
2618
2633
|
super();
|
|
2634
|
+
_DiagramConnectionSet_model.set(this, void 0);
|
|
2619
2635
|
/**
|
|
2620
2636
|
* Set of the possible types of connection that the connections of this set can have.
|
|
2621
2637
|
* @public
|
|
2622
2638
|
*/
|
|
2623
2639
|
this.types = new DiagramEntitySet();
|
|
2624
|
-
this
|
|
2640
|
+
__classPrivateFieldSet(this, _DiagramConnectionSet_model, model, "f");
|
|
2625
2641
|
}
|
|
2626
2642
|
/**
|
|
2627
2643
|
* Instance a new connection and add it to this set.
|
|
@@ -2644,7 +2660,7 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
2644
2660
|
}
|
|
2645
2661
|
connectionType = foundConnectionType;
|
|
2646
2662
|
}
|
|
2647
|
-
const connection = new DiagramConnection(this
|
|
2663
|
+
const connection = new DiagramConnection(__classPrivateFieldGet(this, _DiagramConnectionSet_model, "f"), connectionType, start, end, id);
|
|
2648
2664
|
super.add(connection);
|
|
2649
2665
|
connection.updateInView();
|
|
2650
2666
|
connection.valueSet.resetValues();
|
|
@@ -2666,6 +2682,7 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
2666
2682
|
}
|
|
2667
2683
|
}
|
|
2668
2684
|
}
|
|
2685
|
+
_DiagramConnectionSet_model = new WeakMap();
|
|
2669
2686
|
|
|
2670
2687
|
/**
|
|
2671
2688
|
* The different modes for when a node or section can be resized.
|
|
@@ -2689,6 +2706,7 @@ var ResizableMode;
|
|
|
2689
2706
|
ResizableMode[ResizableMode["Never"] = 2] = "Never";
|
|
2690
2707
|
})(ResizableMode || (ResizableMode = {}));
|
|
2691
2708
|
|
|
2709
|
+
var _DiagramField_text, _DiagramFieldSet_model;
|
|
2692
2710
|
/**
|
|
2693
2711
|
* Default values of the parameters of a diagram field.
|
|
2694
2712
|
* @private
|
|
@@ -2725,14 +2743,14 @@ class DiagramField extends DiagramElement {
|
|
|
2725
2743
|
* @public
|
|
2726
2744
|
*/
|
|
2727
2745
|
get text() {
|
|
2728
|
-
return this
|
|
2746
|
+
return __classPrivateFieldGet(this, _DiagramField_text, "f");
|
|
2729
2747
|
}
|
|
2730
2748
|
set text(value) {
|
|
2731
2749
|
var _a;
|
|
2732
2750
|
if (value === null || value === undefined || (value === null || value === void 0 ? void 0 : value.trim()) === '') {
|
|
2733
2751
|
value = this.defaultText;
|
|
2734
2752
|
}
|
|
2735
|
-
this
|
|
2753
|
+
__classPrivateFieldSet(this, _DiagramField_text, value, "f");
|
|
2736
2754
|
this.updateInView();
|
|
2737
2755
|
if (this.fit) {
|
|
2738
2756
|
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.fitFieldRootInView(this.id, this.shrink);
|
|
@@ -2763,6 +2781,7 @@ class DiagramField extends DiagramElement {
|
|
|
2763
2781
|
throw new Error('DiagramField for rootElement already exists');
|
|
2764
2782
|
}
|
|
2765
2783
|
super(model, id);
|
|
2784
|
+
_DiagramField_text.set(this, void 0);
|
|
2766
2785
|
/**
|
|
2767
2786
|
* Collaborative timestamp for text.
|
|
2768
2787
|
* @public
|
|
@@ -2801,7 +2820,7 @@ class DiagramField extends DiagramElement {
|
|
|
2801
2820
|
this.highlightedLook = looks.highlightedLook;
|
|
2802
2821
|
this.selectedAndHighlightedLook = looks.selectedAndHighlightedLook;
|
|
2803
2822
|
this.defaultText = text;
|
|
2804
|
-
this
|
|
2823
|
+
__classPrivateFieldSet(this, _DiagramField_text, text, "f");
|
|
2805
2824
|
this.editable = editable;
|
|
2806
2825
|
this.fit = fit;
|
|
2807
2826
|
this.shrink = shrink;
|
|
@@ -2831,6 +2850,7 @@ class DiagramField extends DiagramElement {
|
|
|
2831
2850
|
return ((_a = this.rootElement) === null || _a === void 0 ? void 0 : _a.getPriority()) || DEFAULT_PRIORITY;
|
|
2832
2851
|
}
|
|
2833
2852
|
}
|
|
2853
|
+
_DiagramField_text = new WeakMap();
|
|
2834
2854
|
class DiagramFieldSet extends DiagramElementSet {
|
|
2835
2855
|
/**
|
|
2836
2856
|
* Instance a set of fields for the given model. This method is used internally.
|
|
@@ -2838,14 +2858,15 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2838
2858
|
*/
|
|
2839
2859
|
constructor(model) {
|
|
2840
2860
|
super();
|
|
2841
|
-
this
|
|
2861
|
+
_DiagramFieldSet_model.set(this, void 0);
|
|
2862
|
+
__classPrivateFieldSet(this, _DiagramFieldSet_model, model, "f");
|
|
2842
2863
|
}
|
|
2843
2864
|
/**
|
|
2844
2865
|
* 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.
|
|
2845
2866
|
* @private
|
|
2846
2867
|
*/
|
|
2847
2868
|
new(rootElement, coords, width, height, horizontalAlign, verticalAlign, orientation, multiline, look, text, editable, fit, shrink) {
|
|
2848
|
-
const field = new DiagramField(this
|
|
2869
|
+
const field = new DiagramField(__classPrivateFieldGet(this, _DiagramFieldSet_model, "f"), rootElement, coords, width, height, horizontalAlign, verticalAlign, orientation, multiline, look, text, editable, fit, shrink);
|
|
2849
2870
|
super.add(field);
|
|
2850
2871
|
field.updateInView();
|
|
2851
2872
|
// add this field to its root element
|
|
@@ -2871,6 +2892,7 @@ class DiagramFieldSet extends DiagramElementSet {
|
|
|
2871
2892
|
}
|
|
2872
2893
|
}
|
|
2873
2894
|
}
|
|
2895
|
+
_DiagramFieldSet_model = new WeakMap();
|
|
2874
2896
|
const getBottomMargin = config => {
|
|
2875
2897
|
if ((config === null || config === void 0 ? void 0 : config.margin) === null || (config === null || config === void 0 ? void 0 : config.margin) === undefined) {
|
|
2876
2898
|
return DIAGRAM_FIELD_DEFAULTS.margin;
|
|
@@ -3079,6 +3101,7 @@ class DiagramResizer {
|
|
|
3079
3101
|
}
|
|
3080
3102
|
const DIAGRAM_DEFAULT_RESIZER = new DiagramResizer(DIAGRAM_RESIZER_DEFAULTS);
|
|
3081
3103
|
|
|
3104
|
+
var _DiagramSectionSet_model;
|
|
3082
3105
|
/**
|
|
3083
3106
|
* Default value of the default width of a diagram section.
|
|
3084
3107
|
* @private
|
|
@@ -3566,7 +3589,8 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3566
3589
|
*/
|
|
3567
3590
|
constructor(model) {
|
|
3568
3591
|
super();
|
|
3569
|
-
this
|
|
3592
|
+
_DiagramSectionSet_model.set(this, void 0);
|
|
3593
|
+
__classPrivateFieldSet(this, _DiagramSectionSet_model, model, "f");
|
|
3570
3594
|
}
|
|
3571
3595
|
/**
|
|
3572
3596
|
* 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.
|
|
@@ -3574,7 +3598,7 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3574
3598
|
*/
|
|
3575
3599
|
new(node, indexXInNode, indexYInNode, coords, width, height, id) {
|
|
3576
3600
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3577
|
-
const section = new DiagramSection(this
|
|
3601
|
+
const section = new DiagramSection(__classPrivateFieldGet(this, _DiagramSectionSet_model, "f"), node, indexXInNode, indexYInNode, coords, width, height, id);
|
|
3578
3602
|
super.add(section);
|
|
3579
3603
|
section.updateInView();
|
|
3580
3604
|
// add this section to its node
|
|
@@ -3585,7 +3609,7 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3585
3609
|
if (sectionPorts && sectionPorts.length > 0) {
|
|
3586
3610
|
for (let i = 0; i < sectionPorts.length; ++i) {
|
|
3587
3611
|
const portConfig = sectionPorts[i];
|
|
3588
|
-
const port = this.
|
|
3612
|
+
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');
|
|
3589
3613
|
if ((_e = port.type) === null || _e === void 0 ? void 0 : _e.label) {
|
|
3590
3614
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === void 0 ? void 0 : _f.label);
|
|
3591
3615
|
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
@@ -3604,7 +3628,7 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3604
3628
|
default:
|
|
3605
3629
|
labelCoords = port.coords;
|
|
3606
3630
|
}
|
|
3607
|
-
this.
|
|
3631
|
+
__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);
|
|
3608
3632
|
}
|
|
3609
3633
|
}
|
|
3610
3634
|
}
|
|
@@ -3613,7 +3637,7 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3613
3637
|
if (sectionLabel) {
|
|
3614
3638
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), sectionLabel);
|
|
3615
3639
|
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
3616
|
-
this.
|
|
3640
|
+
__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);
|
|
3617
3641
|
}
|
|
3618
3642
|
return section;
|
|
3619
3643
|
}
|
|
@@ -3622,11 +3646,11 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3622
3646
|
if (section) {
|
|
3623
3647
|
// remove all ports
|
|
3624
3648
|
while (section.ports.length > 0) {
|
|
3625
|
-
this.
|
|
3649
|
+
__classPrivateFieldGet(this, _DiagramSectionSet_model, "f").ports.remove(section.ports[0].id);
|
|
3626
3650
|
}
|
|
3627
3651
|
// remove label
|
|
3628
3652
|
if (section.label) {
|
|
3629
|
-
this.
|
|
3653
|
+
__classPrivateFieldGet(this, _DiagramSectionSet_model, "f").fields.remove(section.label.id);
|
|
3630
3654
|
}
|
|
3631
3655
|
// remove from root element
|
|
3632
3656
|
if (section.node) {
|
|
@@ -3639,7 +3663,9 @@ class DiagramSectionSet extends DiagramElementSet {
|
|
|
3639
3663
|
}
|
|
3640
3664
|
}
|
|
3641
3665
|
}
|
|
3666
|
+
_DiagramSectionSet_model = new WeakMap();
|
|
3642
3667
|
|
|
3668
|
+
var _DiagramNode_type, _DiagramNodeSet_model;
|
|
3643
3669
|
/**
|
|
3644
3670
|
* Default values of the look of a diagram node.
|
|
3645
3671
|
* @private
|
|
@@ -3752,12 +3778,12 @@ class DiagramNodeType {
|
|
|
3752
3778
|
*/
|
|
3753
3779
|
class DiagramNode extends DiagramElement {
|
|
3754
3780
|
get type() {
|
|
3755
|
-
return this
|
|
3781
|
+
return __classPrivateFieldGet(this, _DiagramNode_type, "f");
|
|
3756
3782
|
}
|
|
3757
3783
|
set type(type) {
|
|
3758
3784
|
var _a, _b;
|
|
3759
|
-
if (type !== this
|
|
3760
|
-
this
|
|
3785
|
+
if (type !== __classPrivateFieldGet(this, _DiagramNode_type, "f")) {
|
|
3786
|
+
__classPrivateFieldSet(this, _DiagramNode_type, type, "f");
|
|
3761
3787
|
if (this.valueSet) {
|
|
3762
3788
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
3763
3789
|
}
|
|
@@ -3850,6 +3876,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3850
3876
|
throw new Error(`DiagramNode cannot have an empty or null id`);
|
|
3851
3877
|
}
|
|
3852
3878
|
super(model, id);
|
|
3879
|
+
_DiagramNode_type.set(this, void 0);
|
|
3853
3880
|
/**
|
|
3854
3881
|
* Nodes contained within this node.
|
|
3855
3882
|
* @public
|
|
@@ -3875,7 +3902,7 @@ class DiagramNode extends DiagramElement {
|
|
|
3875
3902
|
* @public
|
|
3876
3903
|
*/
|
|
3877
3904
|
this.geometryTimestamp = null;
|
|
3878
|
-
this
|
|
3905
|
+
__classPrivateFieldSet(this, _DiagramNode_type, type, "f");
|
|
3879
3906
|
this.valueSet = new ValueSet(type.propertySet, this);
|
|
3880
3907
|
this.originalData = {};
|
|
3881
3908
|
this.coords = coords;
|
|
@@ -4540,6 +4567,7 @@ class DiagramNode extends DiagramElement {
|
|
|
4540
4567
|
this.stretch(Side.Bottom, margin + rowHeight);
|
|
4541
4568
|
}
|
|
4542
4569
|
}
|
|
4570
|
+
_DiagramNode_type = new WeakMap();
|
|
4543
4571
|
class DiagramNodeSet extends DiagramElementSet {
|
|
4544
4572
|
/**
|
|
4545
4573
|
* Instance a set of nodes for the given model. This method is used internally.
|
|
@@ -4547,12 +4575,13 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4547
4575
|
*/
|
|
4548
4576
|
constructor(model) {
|
|
4549
4577
|
super();
|
|
4578
|
+
_DiagramNodeSet_model.set(this, void 0);
|
|
4550
4579
|
/**
|
|
4551
4580
|
* Set of the possible types of node that the nodes of this set can have.
|
|
4552
4581
|
* @public
|
|
4553
4582
|
*/
|
|
4554
4583
|
this.types = new DiagramEntitySet();
|
|
4555
|
-
this
|
|
4584
|
+
__classPrivateFieldSet(this, _DiagramNodeSet_model, model, "f");
|
|
4556
4585
|
}
|
|
4557
4586
|
/**
|
|
4558
4587
|
* Instance a new node and add it to this set.
|
|
@@ -4574,7 +4603,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4574
4603
|
}
|
|
4575
4604
|
nodeType = foundNodeType;
|
|
4576
4605
|
}
|
|
4577
|
-
const node = new DiagramNode(this
|
|
4606
|
+
const node = new DiagramNode(__classPrivateFieldGet(this, _DiagramNodeSet_model, "f"), nodeType, coords, id);
|
|
4578
4607
|
super.add(node);
|
|
4579
4608
|
node.updateInView();
|
|
4580
4609
|
// add node sections
|
|
@@ -4584,7 +4613,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4584
4613
|
for (let j = 0; j < nodeType.sectionGrid.sections.length; ++j) {
|
|
4585
4614
|
let widthAccumulator = node.coords[0] + (nodeType.sectionGrid.margin || 0);
|
|
4586
4615
|
for (let i = 0; i < nodeType.sectionGrid.sections[j].length; ++i) {
|
|
4587
|
-
this.
|
|
4616
|
+
__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}`);
|
|
4588
4617
|
widthAccumulator += (((_c = nodeType.sectionGrid.defaultWidths) === null || _c === void 0 ? void 0 : _c[i]) || DIAGRAM_SECTION_DEFAULT_WIDTH) + (nodeType.sectionGrid.margin || 0);
|
|
4589
4618
|
}
|
|
4590
4619
|
heightAccumulator += (((_d = nodeType.sectionGrid.defaultHeights) === null || _d === void 0 ? void 0 : _d[j]) || DIAGRAM_SECTION_DEFAULT_HEIGHT) + (nodeType.sectionGrid.margin || 0);
|
|
@@ -4594,8 +4623,8 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4594
4623
|
if (nodeType.ports.length > 0) {
|
|
4595
4624
|
for (let i = 0; i < nodeType.ports.length; ++i) {
|
|
4596
4625
|
const portConfig = nodeType.ports[i];
|
|
4597
|
-
const portType = portConfig.type !== undefined ? this.
|
|
4598
|
-
const port = this.
|
|
4626
|
+
const portType = portConfig.type !== undefined ? __classPrivateFieldGet(this, _DiagramNodeSet_model, "f").ports.types.get(portConfig.type) : undefined;
|
|
4627
|
+
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');
|
|
4599
4628
|
if ((_e = port.type) === null || _e === void 0 ? void 0 : _e.label) {
|
|
4600
4629
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_f = port.type) === null || _f === void 0 ? void 0 : _f.label);
|
|
4601
4630
|
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
@@ -4614,7 +4643,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4614
4643
|
default:
|
|
4615
4644
|
labelCoords = port.coords;
|
|
4616
4645
|
}
|
|
4617
|
-
this.
|
|
4646
|
+
__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);
|
|
4618
4647
|
}
|
|
4619
4648
|
}
|
|
4620
4649
|
}
|
|
@@ -4622,13 +4651,13 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4622
4651
|
if (nodeType.label) {
|
|
4623
4652
|
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), nodeType.label);
|
|
4624
4653
|
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
4625
|
-
this.
|
|
4654
|
+
__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);
|
|
4626
4655
|
}
|
|
4627
4656
|
// add node decorators
|
|
4628
4657
|
if (nodeType.decorators.length > 0) {
|
|
4629
4658
|
for (let i = 0; i < nodeType.decorators.length; ++i) {
|
|
4630
4659
|
const decoratorConfig = nodeType.decorators[i];
|
|
4631
|
-
this.
|
|
4660
|
+
__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');
|
|
4632
4661
|
}
|
|
4633
4662
|
}
|
|
4634
4663
|
node.valueSet.resetValues();
|
|
@@ -4644,23 +4673,23 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4644
4673
|
}
|
|
4645
4674
|
// remove all children
|
|
4646
4675
|
while (node.children.length > 0) {
|
|
4647
|
-
this.
|
|
4676
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").nodes.remove(node.children[0].id);
|
|
4648
4677
|
}
|
|
4649
4678
|
// remove all sections
|
|
4650
4679
|
while (node.sections.length > 0) {
|
|
4651
|
-
this.
|
|
4680
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").sections.remove(node.sections[0].id);
|
|
4652
4681
|
}
|
|
4653
4682
|
// remove all ports
|
|
4654
4683
|
while (node.ports.length > 0) {
|
|
4655
|
-
this.
|
|
4684
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").ports.remove(node.ports[0].id);
|
|
4656
4685
|
}
|
|
4657
4686
|
// remove all decorators
|
|
4658
4687
|
while (node.decorators.length > 0) {
|
|
4659
|
-
this.
|
|
4688
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").decorators.remove(node.decorators[0].id);
|
|
4660
4689
|
}
|
|
4661
4690
|
// remove label
|
|
4662
4691
|
if (node.label) {
|
|
4663
|
-
this.
|
|
4692
|
+
__classPrivateFieldGet(this, _DiagramNodeSet_model, "f").fields.remove(node.label.id);
|
|
4664
4693
|
}
|
|
4665
4694
|
// remove from set of nodes
|
|
4666
4695
|
super.remove(id);
|
|
@@ -4685,6 +4714,7 @@ class DiagramNodeSet extends DiagramElementSet {
|
|
|
4685
4714
|
return nodesAtLocation;
|
|
4686
4715
|
}
|
|
4687
4716
|
}
|
|
4717
|
+
_DiagramNodeSet_model = new WeakMap();
|
|
4688
4718
|
/**
|
|
4689
4719
|
* Removes any nodes from the given list which are a descendant of another node in the list.
|
|
4690
4720
|
* @param nodes A list of nodes.
|
|
@@ -4792,6 +4822,7 @@ const getTopPadding = config => {
|
|
|
4792
4822
|
}
|
|
4793
4823
|
};
|
|
4794
4824
|
|
|
4825
|
+
var _DiagramDecoratorSet_model;
|
|
4795
4826
|
/**
|
|
4796
4827
|
* A foreign object which is inserted with arbitrary SVG code into a diagram.
|
|
4797
4828
|
* Similar to a diagram object, but it's part of a node or section and it moves and stretches as its geometry changes.
|
|
@@ -4850,7 +4881,8 @@ class DiagramDecoratorSet extends DiagramElementSet {
|
|
|
4850
4881
|
*/
|
|
4851
4882
|
constructor(model) {
|
|
4852
4883
|
super();
|
|
4853
|
-
this
|
|
4884
|
+
_DiagramDecoratorSet_model.set(this, void 0);
|
|
4885
|
+
__classPrivateFieldSet(this, _DiagramDecoratorSet_model, model, "f");
|
|
4854
4886
|
}
|
|
4855
4887
|
/**
|
|
4856
4888
|
* Instance a new decorator and add it to this set.
|
|
@@ -4864,7 +4896,7 @@ class DiagramDecoratorSet extends DiagramElementSet {
|
|
|
4864
4896
|
* @returns The instanced decorator.
|
|
4865
4897
|
*/
|
|
4866
4898
|
new(rootElement, coords, width, height, priority, svg, id, anchorPointX = 'floating', anchorPointY = 'floating') {
|
|
4867
|
-
const decorator = new DiagramDecorator(this
|
|
4899
|
+
const decorator = new DiagramDecorator(__classPrivateFieldGet(this, _DiagramDecoratorSet_model, "f"), rootElement, coords, width, height, priority, svg, id, anchorPointX, anchorPointY);
|
|
4868
4900
|
super.add(decorator);
|
|
4869
4901
|
decorator.updateInView();
|
|
4870
4902
|
// add this port to its root element
|
|
@@ -4887,7 +4919,9 @@ class DiagramDecoratorSet extends DiagramElementSet {
|
|
|
4887
4919
|
}
|
|
4888
4920
|
}
|
|
4889
4921
|
}
|
|
4922
|
+
_DiagramDecoratorSet_model = new WeakMap();
|
|
4890
4923
|
|
|
4924
|
+
var _DiagramObjectSet_model;
|
|
4891
4925
|
/**
|
|
4892
4926
|
* A foreign object which is inserted with arbitrary SVG code into a diagram.
|
|
4893
4927
|
* Diagram objects are not serialized with other diagram elements.
|
|
@@ -4939,7 +4973,8 @@ class DiagramObjectSet extends DiagramElementSet {
|
|
|
4939
4973
|
*/
|
|
4940
4974
|
constructor(model) {
|
|
4941
4975
|
super();
|
|
4942
|
-
this
|
|
4976
|
+
_DiagramObjectSet_model.set(this, void 0);
|
|
4977
|
+
__classPrivateFieldSet(this, _DiagramObjectSet_model, model, "f");
|
|
4943
4978
|
}
|
|
4944
4979
|
/**
|
|
4945
4980
|
* Instance a new object and add it to this set.
|
|
@@ -4953,7 +4988,7 @@ class DiagramObjectSet extends DiagramElementSet {
|
|
|
4953
4988
|
* @returns The instanced object.
|
|
4954
4989
|
*/
|
|
4955
4990
|
new(coords, width, height, priority, svg, id) {
|
|
4956
|
-
const object = new DiagramObject(this
|
|
4991
|
+
const object = new DiagramObject(__classPrivateFieldGet(this, _DiagramObjectSet_model, "f"), coords, width, height, priority, svg, id);
|
|
4957
4992
|
super.add(object);
|
|
4958
4993
|
object.updateInView();
|
|
4959
4994
|
return object;
|
|
@@ -4968,7 +5003,9 @@ class DiagramObjectSet extends DiagramElementSet {
|
|
|
4968
5003
|
}
|
|
4969
5004
|
}
|
|
4970
5005
|
}
|
|
5006
|
+
_DiagramObjectSet_model = new WeakMap();
|
|
4971
5007
|
|
|
5008
|
+
var _DiagramPort_type, _DiagramPortSet_model;
|
|
4972
5009
|
/**
|
|
4973
5010
|
* Default values of the look of a diagram port.
|
|
4974
5011
|
* @private
|
|
@@ -5031,11 +5068,11 @@ class DiagramPortType {
|
|
|
5031
5068
|
*/
|
|
5032
5069
|
class DiagramPort extends DiagramElement {
|
|
5033
5070
|
get type() {
|
|
5034
|
-
return this
|
|
5071
|
+
return __classPrivateFieldGet(this, _DiagramPort_type, "f");
|
|
5035
5072
|
}
|
|
5036
5073
|
set type(type) {
|
|
5037
|
-
if (type !== this
|
|
5038
|
-
this
|
|
5074
|
+
if (type !== __classPrivateFieldGet(this, _DiagramPort_type, "f")) {
|
|
5075
|
+
__classPrivateFieldSet(this, _DiagramPort_type, type, "f");
|
|
5039
5076
|
this.updateInView();
|
|
5040
5077
|
}
|
|
5041
5078
|
}
|
|
@@ -5160,6 +5197,7 @@ class DiagramPort extends DiagramElement {
|
|
|
5160
5197
|
throw new Error(`DiagramPort cannot have an empty or null id`);
|
|
5161
5198
|
}
|
|
5162
5199
|
super(model, id);
|
|
5200
|
+
_DiagramPort_type.set(this, void 0);
|
|
5163
5201
|
/**
|
|
5164
5202
|
* Connections that start at this port.
|
|
5165
5203
|
* @public
|
|
@@ -5170,7 +5208,7 @@ class DiagramPort extends DiagramElement {
|
|
|
5170
5208
|
* @public
|
|
5171
5209
|
*/
|
|
5172
5210
|
this.incomingConnections = [];
|
|
5173
|
-
this
|
|
5211
|
+
__classPrivateFieldSet(this, _DiagramPort_type, type, "f");
|
|
5174
5212
|
this.rootElement = rootElement;
|
|
5175
5213
|
this.coords = coords;
|
|
5176
5214
|
this.connectionPoint = connectionPoint || coords;
|
|
@@ -5258,6 +5296,7 @@ class DiagramPort extends DiagramElement {
|
|
|
5258
5296
|
return distanceBetweenPoints(this.coords, coords);
|
|
5259
5297
|
}
|
|
5260
5298
|
}
|
|
5299
|
+
_DiagramPort_type = new WeakMap();
|
|
5261
5300
|
class DiagramPortSet extends DiagramElementSet {
|
|
5262
5301
|
/**
|
|
5263
5302
|
* Instance a set of ports for the given model. This method is used internally.
|
|
@@ -5265,19 +5304,20 @@ class DiagramPortSet extends DiagramElementSet {
|
|
|
5265
5304
|
*/
|
|
5266
5305
|
constructor(model) {
|
|
5267
5306
|
super();
|
|
5307
|
+
_DiagramPortSet_model.set(this, void 0);
|
|
5268
5308
|
/**
|
|
5269
5309
|
* Set of the possible types of port that the ports of this set can have.
|
|
5270
5310
|
* @public
|
|
5271
5311
|
*/
|
|
5272
5312
|
this.types = new DiagramEntitySet();
|
|
5273
|
-
this
|
|
5313
|
+
__classPrivateFieldSet(this, _DiagramPortSet_model, model, "f");
|
|
5274
5314
|
}
|
|
5275
5315
|
/**
|
|
5276
5316
|
* 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.
|
|
5277
5317
|
* @private
|
|
5278
5318
|
*/
|
|
5279
5319
|
new(type, rootElement, coords, connectionPoint, direction, id, anchorPointX = 'floating', anchorPointY = 'floating') {
|
|
5280
|
-
const port = new DiagramPort(this
|
|
5320
|
+
const port = new DiagramPort(__classPrivateFieldGet(this, _DiagramPortSet_model, "f"), type, rootElement, coords, connectionPoint, direction, id, anchorPointX, anchorPointY);
|
|
5281
5321
|
super.add(port);
|
|
5282
5322
|
port.updateInView();
|
|
5283
5323
|
// add this port to its root element
|
|
@@ -5291,14 +5331,14 @@ class DiagramPortSet extends DiagramElementSet {
|
|
|
5291
5331
|
if (port) {
|
|
5292
5332
|
// remove all connections
|
|
5293
5333
|
while (port.outgoingConnections.length > 0) {
|
|
5294
|
-
this.
|
|
5334
|
+
__classPrivateFieldGet(this, _DiagramPortSet_model, "f").connections.remove(port.outgoingConnections[0].id);
|
|
5295
5335
|
}
|
|
5296
5336
|
while (port.incomingConnections.length > 0) {
|
|
5297
|
-
this.
|
|
5337
|
+
__classPrivateFieldGet(this, _DiagramPortSet_model, "f").connections.remove(port.incomingConnections[0].id);
|
|
5298
5338
|
}
|
|
5299
5339
|
// remove label
|
|
5300
5340
|
if (port.label) {
|
|
5301
|
-
this.
|
|
5341
|
+
__classPrivateFieldGet(this, _DiagramPortSet_model, "f").fields.remove(port.label.id);
|
|
5302
5342
|
}
|
|
5303
5343
|
// remove from root element
|
|
5304
5344
|
if (port.rootElement instanceof DiagramNode || port.rootElement instanceof DiagramSection) {
|
|
@@ -5311,6 +5351,7 @@ class DiagramPortSet extends DiagramElementSet {
|
|
|
5311
5351
|
}
|
|
5312
5352
|
}
|
|
5313
5353
|
}
|
|
5354
|
+
_DiagramPortSet_model = new WeakMap();
|
|
5314
5355
|
|
|
5315
5356
|
/**
|
|
5316
5357
|
* Importer which imports a diagram from its daga model representation.
|
|
@@ -5547,6 +5588,7 @@ class DagaImporter {
|
|
|
5547
5588
|
}
|
|
5548
5589
|
}
|
|
5549
5590
|
|
|
5591
|
+
var _SetSelfRemovedCollabAction_instances, _SetSelfRemovedCollabAction_doOne;
|
|
5550
5592
|
/**
|
|
5551
5593
|
* Collaborative action which consists of adding a node.
|
|
5552
5594
|
* @private
|
|
@@ -5900,6 +5942,7 @@ class UpdateValuesCollabAction {
|
|
|
5900
5942
|
*/
|
|
5901
5943
|
class SetSelfRemovedCollabAction {
|
|
5902
5944
|
constructor(canvas, nodeIds, sectionIds, portIds, connectionIds, fieldIds, selfRemoved, timestamp) {
|
|
5945
|
+
_SetSelfRemovedCollabAction_instances.add(this);
|
|
5903
5946
|
this.canvas = canvas;
|
|
5904
5947
|
this.nodeIds = nodeIds;
|
|
5905
5948
|
this.sectionIds = sectionIds;
|
|
@@ -5909,27 +5952,21 @@ class SetSelfRemovedCollabAction {
|
|
|
5909
5952
|
this.selfRemoved = selfRemoved;
|
|
5910
5953
|
this.timestamp = timestamp;
|
|
5911
5954
|
}
|
|
5912
|
-
doOne(elt) {
|
|
5913
|
-
if (elt && timestampWins(this.timestamp, elt.selfRemovedTimestamp)) {
|
|
5914
|
-
elt.selfRemoved = this.selfRemoved;
|
|
5915
|
-
elt.selfRemovedTimestamp = this.timestamp;
|
|
5916
|
-
}
|
|
5917
|
-
}
|
|
5918
5955
|
do() {
|
|
5919
5956
|
for (const nodeId of this.nodeIds) {
|
|
5920
|
-
this.
|
|
5957
|
+
__classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.nodes.get(nodeId, true));
|
|
5921
5958
|
}
|
|
5922
5959
|
for (const sectionId of this.sectionIds) {
|
|
5923
|
-
this.
|
|
5960
|
+
__classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.sections.get(sectionId, true));
|
|
5924
5961
|
}
|
|
5925
5962
|
for (const portId of this.portIds) {
|
|
5926
|
-
this.
|
|
5963
|
+
__classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.ports.get(portId, true));
|
|
5927
5964
|
}
|
|
5928
5965
|
for (const connectionId of this.connectionIds) {
|
|
5929
|
-
this.
|
|
5966
|
+
__classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.connections.get(connectionId, true));
|
|
5930
5967
|
}
|
|
5931
5968
|
for (const fieldId of this.fieldIds) {
|
|
5932
|
-
this.
|
|
5969
|
+
__classPrivateFieldGet(this, _SetSelfRemovedCollabAction_instances, "m", _SetSelfRemovedCollabAction_doOne).call(this, this.canvas.model.fields.get(fieldId, true));
|
|
5933
5970
|
}
|
|
5934
5971
|
// update view
|
|
5935
5972
|
this.canvas.updateNodesInView(...this.nodeIds);
|
|
@@ -5956,6 +5993,12 @@ class SetSelfRemovedCollabAction {
|
|
|
5956
5993
|
return new SetSelfRemovedCollabAction(canvas, serialized.nodeIds, serialized.sectionIds, serialized.portIds, serialized.connectionIds, serialized.fieldIds, serialized.removed, serialized.timestamp);
|
|
5957
5994
|
}
|
|
5958
5995
|
}
|
|
5996
|
+
_SetSelfRemovedCollabAction_instances = new WeakSet(), _SetSelfRemovedCollabAction_doOne = function _SetSelfRemovedCollabAction_doOne(elt) {
|
|
5997
|
+
if (elt && timestampWins(this.timestamp, elt.selfRemovedTimestamp)) {
|
|
5998
|
+
elt.selfRemoved = this.selfRemoved;
|
|
5999
|
+
elt.selfRemovedTimestamp = this.timestamp;
|
|
6000
|
+
}
|
|
6001
|
+
};
|
|
5959
6002
|
/**
|
|
5960
6003
|
* Collaborative action which consists of pasting elements from an external source into a diagram.
|
|
5961
6004
|
*
|
|
@@ -6127,13 +6170,19 @@ class CollabEngine {
|
|
|
6127
6170
|
}
|
|
6128
6171
|
}
|
|
6129
6172
|
|
|
6173
|
+
var _ActionStack_canvas;
|
|
6130
6174
|
/**
|
|
6131
6175
|
* A stack of recent actions taken by the user.
|
|
6132
6176
|
* @private
|
|
6133
6177
|
*/
|
|
6134
6178
|
class ActionStack {
|
|
6135
6179
|
constructor(canvas, maximum) {
|
|
6136
|
-
|
|
6180
|
+
/**
|
|
6181
|
+
* Canvas that this action stack belongs to.
|
|
6182
|
+
* @private
|
|
6183
|
+
*/
|
|
6184
|
+
_ActionStack_canvas.set(this, void 0);
|
|
6185
|
+
__classPrivateFieldSet(this, _ActionStack_canvas, canvas, "f");
|
|
6137
6186
|
this.maximum = maximum;
|
|
6138
6187
|
this.history = [];
|
|
6139
6188
|
this.index = 0;
|
|
@@ -6153,7 +6202,7 @@ class ActionStack {
|
|
|
6153
6202
|
this.history.push(action);
|
|
6154
6203
|
++this.index;
|
|
6155
6204
|
}
|
|
6156
|
-
this.
|
|
6205
|
+
__classPrivateFieldGet(this, _ActionStack_canvas, "f").diagramChange$.next({
|
|
6157
6206
|
action,
|
|
6158
6207
|
method: DiagramActionMethod.Do
|
|
6159
6208
|
});
|
|
@@ -6172,7 +6221,7 @@ class ActionStack {
|
|
|
6172
6221
|
hasEffect = action.undo();
|
|
6173
6222
|
} while (!hasEffect && this.index > 0);
|
|
6174
6223
|
}
|
|
6175
|
-
this.
|
|
6224
|
+
__classPrivateFieldGet(this, _ActionStack_canvas, "f").diagramChange$.next({
|
|
6176
6225
|
action,
|
|
6177
6226
|
method: DiagramActionMethod.Undo
|
|
6178
6227
|
});
|
|
@@ -6191,12 +6240,13 @@ class ActionStack {
|
|
|
6191
6240
|
++this.index;
|
|
6192
6241
|
} while (!hasEffect && this.index < this.history.length);
|
|
6193
6242
|
}
|
|
6194
|
-
this.
|
|
6243
|
+
__classPrivateFieldGet(this, _ActionStack_canvas, "f").diagramChange$.next({
|
|
6195
6244
|
action,
|
|
6196
6245
|
method: DiagramActionMethod.Redo
|
|
6197
6246
|
});
|
|
6198
6247
|
}
|
|
6199
6248
|
}
|
|
6249
|
+
_ActionStack_canvas = new WeakMap();
|
|
6200
6250
|
/**
|
|
6201
6251
|
* The different methods of an action.
|
|
6202
6252
|
* @private
|
|
@@ -7194,6 +7244,7 @@ const getGridSpacingY = gridConfig => {
|
|
|
7194
7244
|
return value;
|
|
7195
7245
|
};
|
|
7196
7246
|
|
|
7247
|
+
var _DiagramContextMenu_canvas, _DiagramContextMenu_config, _DiagramContextMenu_contextMenuContainer;
|
|
7197
7248
|
const CONTEXT_MENU_MENU_RADIUS = 96;
|
|
7198
7249
|
const CONTEXT_MENU_BUTTON_RADIUS = 32;
|
|
7199
7250
|
const CONTEXT_MENU_TOTAL_RADIUS = CONTEXT_MENU_MENU_RADIUS + CONTEXT_MENU_BUTTON_RADIUS;
|
|
@@ -7214,8 +7265,11 @@ class DiagramContextMenu {
|
|
|
7214
7265
|
* @param canvas A canvas.
|
|
7215
7266
|
*/
|
|
7216
7267
|
constructor(canvas, config) {
|
|
7217
|
-
this
|
|
7218
|
-
this
|
|
7268
|
+
_DiagramContextMenu_canvas.set(this, void 0);
|
|
7269
|
+
_DiagramContextMenu_config.set(this, void 0);
|
|
7270
|
+
_DiagramContextMenu_contextMenuContainer.set(this, void 0);
|
|
7271
|
+
__classPrivateFieldSet(this, _DiagramContextMenu_canvas, canvas, "f");
|
|
7272
|
+
__classPrivateFieldSet(this, _DiagramContextMenu_config, config || CONTEXT_MENU_DEFAULTS, "f");
|
|
7219
7273
|
}
|
|
7220
7274
|
/**
|
|
7221
7275
|
* Opens the context menu at the location determined by the given mouse event.
|
|
@@ -7224,11 +7278,11 @@ class DiagramContextMenu {
|
|
|
7224
7278
|
*/
|
|
7225
7279
|
open(event) {
|
|
7226
7280
|
this.close();
|
|
7227
|
-
const coordsRelativeToRoot = this.
|
|
7228
|
-
const coordsRelativeToCanvas = this.
|
|
7281
|
+
const coordsRelativeToRoot = __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").getPointerLocationRelativeToRoot(event);
|
|
7282
|
+
const coordsRelativeToCanvas = __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").getPointerLocationRelativeToCanvas(event);
|
|
7229
7283
|
// append to the root (svg) element so the context menu is not affected by zoom transforms on the canvas view
|
|
7230
|
-
const contextMenuContainer = this.
|
|
7231
|
-
if (this.
|
|
7284
|
+
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(Events.ContextMenu, newEvent => {
|
|
7285
|
+
if (__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(DiagramActions.ContextMenu)) {
|
|
7232
7286
|
event.preventDefault();
|
|
7233
7287
|
this.open(newEvent);
|
|
7234
7288
|
}
|
|
@@ -7236,9 +7290,9 @@ class DiagramContextMenu {
|
|
|
7236
7290
|
event.preventDefault();
|
|
7237
7291
|
this.close();
|
|
7238
7292
|
});
|
|
7239
|
-
this
|
|
7293
|
+
__classPrivateFieldSet(this, _DiagramContextMenu_contextMenuContainer, contextMenuContainer, "f");
|
|
7240
7294
|
const buttons = [];
|
|
7241
|
-
if (!(this.
|
|
7295
|
+
if (!(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").userSelection.length === 0) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(DiagramActions.Clipboard) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(DiagramActions.Remove)) {
|
|
7242
7296
|
buttons.push({
|
|
7243
7297
|
name: 'CUT',
|
|
7244
7298
|
imageClass: 'daga-cut',
|
|
@@ -7248,7 +7302,7 @@ class DiagramContextMenu {
|
|
|
7248
7302
|
}
|
|
7249
7303
|
});
|
|
7250
7304
|
}
|
|
7251
|
-
if (!(this.
|
|
7305
|
+
if (!(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").userSelection.length === 0) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(DiagramActions.Clipboard)) {
|
|
7252
7306
|
buttons.push({
|
|
7253
7307
|
name: 'COPY',
|
|
7254
7308
|
imageClass: 'daga-copy',
|
|
@@ -7258,7 +7312,7 @@ class DiagramContextMenu {
|
|
|
7258
7312
|
}
|
|
7259
7313
|
});
|
|
7260
7314
|
}
|
|
7261
|
-
if (this.
|
|
7315
|
+
if (__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(DiagramActions.Paste)) {
|
|
7262
7316
|
buttons.push({
|
|
7263
7317
|
name: 'PASTE',
|
|
7264
7318
|
imageClass: 'daga-paste',
|
|
@@ -7268,7 +7322,7 @@ class DiagramContextMenu {
|
|
|
7268
7322
|
}
|
|
7269
7323
|
});
|
|
7270
7324
|
}
|
|
7271
|
-
if (!(this.
|
|
7325
|
+
if (!(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").userSelection.length === 0) && __classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f").canUserPerformAction(DiagramActions.Remove)) {
|
|
7272
7326
|
buttons.push({
|
|
7273
7327
|
name: 'DELETE',
|
|
7274
7328
|
imageClass: 'daga-delete',
|
|
@@ -7278,8 +7332,8 @@ class DiagramContextMenu {
|
|
|
7278
7332
|
}
|
|
7279
7333
|
});
|
|
7280
7334
|
}
|
|
7281
|
-
for (const customButton of this.
|
|
7282
|
-
if (customButton.condition !== undefined ? customButton.condition(this
|
|
7335
|
+
for (const customButton of __classPrivateFieldGet(this, _DiagramContextMenu_config, "f").customButtons || CONTEXT_MENU_DEFAULTS.customButtons) {
|
|
7336
|
+
if (customButton.condition !== undefined ? customButton.condition(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f")) : true) {
|
|
7283
7337
|
buttons.push(customButton);
|
|
7284
7338
|
}
|
|
7285
7339
|
}
|
|
@@ -7298,12 +7352,12 @@ class DiagramContextMenu {
|
|
|
7298
7352
|
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(Events.Click, event => {
|
|
7299
7353
|
if (buttonOnPress) {
|
|
7300
7354
|
event.preventDefault();
|
|
7301
|
-
buttonOnPress(this
|
|
7355
|
+
buttonOnPress(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f"));
|
|
7302
7356
|
}
|
|
7303
7357
|
}).on(Events.KeyDown, event => {
|
|
7304
7358
|
if (buttonOnPress && event.key === Keys.Enter) {
|
|
7305
7359
|
event.preventDefault();
|
|
7306
|
-
buttonOnPress(this
|
|
7360
|
+
buttonOnPress(__classPrivateFieldGet(this, _DiagramContextMenu_canvas, "f"));
|
|
7307
7361
|
}
|
|
7308
7362
|
});
|
|
7309
7363
|
if (button.imageClass !== undefined) {
|
|
@@ -7326,11 +7380,13 @@ class DiagramContextMenu {
|
|
|
7326
7380
|
*/
|
|
7327
7381
|
close() {
|
|
7328
7382
|
var _a;
|
|
7329
|
-
(_a = this
|
|
7330
|
-
this
|
|
7383
|
+
(_a = __classPrivateFieldGet(this, _DiagramContextMenu_contextMenuContainer, "f")) === null || _a === void 0 ? void 0 : _a.remove();
|
|
7384
|
+
__classPrivateFieldSet(this, _DiagramContextMenu_contextMenuContainer, undefined, "f");
|
|
7331
7385
|
}
|
|
7332
7386
|
}
|
|
7387
|
+
_DiagramContextMenu_canvas = new WeakMap(), _DiagramContextMenu_config = new WeakMap(), _DiagramContextMenu_contextMenuContainer = new WeakMap();
|
|
7333
7388
|
|
|
7389
|
+
var _DiagramUserHighlight_canvas, _DiagramUserHighlight_focus, _DiagramUserHighlight_highlightSections;
|
|
7334
7390
|
/**
|
|
7335
7391
|
* Stores the functionality regarding the user highlight of a diagram canvas.
|
|
7336
7392
|
* @public
|
|
@@ -7344,9 +7400,14 @@ class DiagramUserHighlight extends DiagramElementSet {
|
|
|
7344
7400
|
*/
|
|
7345
7401
|
constructor(canvas, highlightSections = true) {
|
|
7346
7402
|
super();
|
|
7347
|
-
this
|
|
7348
|
-
this
|
|
7349
|
-
|
|
7403
|
+
_DiagramUserHighlight_canvas.set(this, void 0);
|
|
7404
|
+
_DiagramUserHighlight_focus.set(this, undefined);
|
|
7405
|
+
/**
|
|
7406
|
+
* Whether sections can be highlighted individually or the whole node must be highlighted when highlighting a section.
|
|
7407
|
+
*/
|
|
7408
|
+
_DiagramUserHighlight_highlightSections.set(this, void 0);
|
|
7409
|
+
__classPrivateFieldSet(this, _DiagramUserHighlight_canvas, canvas, "f");
|
|
7410
|
+
__classPrivateFieldSet(this, _DiagramUserHighlight_highlightSections, highlightSections, "f");
|
|
7350
7411
|
}
|
|
7351
7412
|
/**
|
|
7352
7413
|
* 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.
|
|
@@ -7354,7 +7415,7 @@ class DiagramUserHighlight extends DiagramElementSet {
|
|
|
7354
7415
|
* @returns A diagram element.
|
|
7355
7416
|
*/
|
|
7356
7417
|
getFocus() {
|
|
7357
|
-
return this
|
|
7418
|
+
return __classPrivateFieldGet(this, _DiagramUserHighlight_focus, "f");
|
|
7358
7419
|
}
|
|
7359
7420
|
/**
|
|
7360
7421
|
* Unhighlights all highlighted elements and highlights the given element as the main element of the user highlight.
|
|
@@ -7362,7 +7423,7 @@ class DiagramUserHighlight extends DiagramElementSet {
|
|
|
7362
7423
|
*/
|
|
7363
7424
|
focusOn(element) {
|
|
7364
7425
|
this.clear();
|
|
7365
|
-
this
|
|
7426
|
+
__classPrivateFieldSet(this, _DiagramUserHighlight_focus, element, "f");
|
|
7366
7427
|
if ((element instanceof DiagramField || element instanceof DiagramDecorator) && element.rootElement) {
|
|
7367
7428
|
this.focusOn(element.rootElement);
|
|
7368
7429
|
} else {
|
|
@@ -7372,51 +7433,51 @@ class DiagramUserHighlight extends DiagramElementSet {
|
|
|
7372
7433
|
add(element) {
|
|
7373
7434
|
super.add(element);
|
|
7374
7435
|
if (element instanceof DiagramNode) {
|
|
7375
|
-
if (!this
|
|
7436
|
+
if (!__classPrivateFieldGet(this, _DiagramUserHighlight_highlightSections, "f")) {
|
|
7376
7437
|
for (const section of element.sections) {
|
|
7377
7438
|
super.add(section);
|
|
7378
7439
|
for (const port of section.ports) {
|
|
7379
7440
|
super.add(port);
|
|
7380
|
-
this.
|
|
7441
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(port.id);
|
|
7381
7442
|
}
|
|
7382
7443
|
if (section.label) {
|
|
7383
7444
|
super.add(section.label);
|
|
7384
|
-
this.
|
|
7445
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(section.label.id);
|
|
7385
7446
|
}
|
|
7386
|
-
this.
|
|
7447
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateSectionsInView(section.id);
|
|
7387
7448
|
}
|
|
7388
7449
|
}
|
|
7389
7450
|
for (const port of element.ports) {
|
|
7390
7451
|
super.add(port);
|
|
7391
|
-
this.
|
|
7452
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(port.id);
|
|
7392
7453
|
}
|
|
7393
7454
|
if (element.label) {
|
|
7394
7455
|
super.add(element.label);
|
|
7395
|
-
this.
|
|
7456
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(element.label.id);
|
|
7396
7457
|
}
|
|
7397
|
-
this.
|
|
7458
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateNodesInView(element.id);
|
|
7398
7459
|
} else if (element instanceof DiagramSection) {
|
|
7399
|
-
if (!this
|
|
7460
|
+
if (!__classPrivateFieldGet(this, _DiagramUserHighlight_highlightSections, "f") && element.node) {
|
|
7400
7461
|
this.add(element.node);
|
|
7401
7462
|
} else {
|
|
7402
7463
|
for (const port of element.ports) {
|
|
7403
7464
|
super.add(port);
|
|
7404
|
-
this.
|
|
7465
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(port.id);
|
|
7405
7466
|
}
|
|
7406
7467
|
if (element.label) {
|
|
7407
7468
|
super.add(element.label);
|
|
7408
|
-
this.
|
|
7469
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(element.label.id);
|
|
7409
7470
|
}
|
|
7410
|
-
this.
|
|
7471
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateSectionsInView(element.id);
|
|
7411
7472
|
}
|
|
7412
7473
|
} else if (element instanceof DiagramPort) {
|
|
7413
7474
|
if (element.label) {
|
|
7414
7475
|
super.add(element.label);
|
|
7415
|
-
this.
|
|
7476
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateFieldsInView(element.label.id);
|
|
7416
7477
|
}
|
|
7417
|
-
this.
|
|
7478
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updatePortsInView(element.id);
|
|
7418
7479
|
} else if (element instanceof DiagramConnection) {
|
|
7419
|
-
this.
|
|
7480
|
+
__classPrivateFieldGet(this, _DiagramUserHighlight_canvas, "f").updateConnectionsInView(element.id);
|
|
7420
7481
|
}
|
|
7421
7482
|
}
|
|
7422
7483
|
clear() {
|
|
@@ -7425,9 +7486,10 @@ class DiagramUserHighlight extends DiagramElementSet {
|
|
|
7425
7486
|
this.remove(entity.id);
|
|
7426
7487
|
entity.updateInView();
|
|
7427
7488
|
}
|
|
7428
|
-
this
|
|
7489
|
+
__classPrivateFieldSet(this, _DiagramUserHighlight_focus, undefined, "f");
|
|
7429
7490
|
}
|
|
7430
7491
|
}
|
|
7492
|
+
_DiagramUserHighlight_canvas = new WeakMap(), _DiagramUserHighlight_focus = new WeakMap(), _DiagramUserHighlight_highlightSections = new WeakMap();
|
|
7431
7493
|
|
|
7432
7494
|
const DAGA_FILE_VERSION = 1;
|
|
7433
7495
|
|
|
@@ -7639,6 +7701,7 @@ class DagaExporter {
|
|
|
7639
7701
|
}
|
|
7640
7702
|
}
|
|
7641
7703
|
|
|
7704
|
+
var _DiagramUserSelection_instances, _DiagramUserSelection_canvas, _DiagramUserSelection_diagramPropertiesText, _DiagramUserSelection_propertyEditorSelection, _DiagramUserSelection_propertyEditorValues, _DiagramUserSelection_makeUpdateValuesAction;
|
|
7642
7705
|
/**
|
|
7643
7706
|
* Text to display by default as the title of the property editor when editing the properties of a diagram's value set.
|
|
7644
7707
|
* @private
|
|
@@ -7659,12 +7722,17 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7659
7722
|
*/
|
|
7660
7723
|
constructor(canvas, diagramPropertiesText) {
|
|
7661
7724
|
super();
|
|
7662
|
-
this
|
|
7725
|
+
_DiagramUserSelection_instances.add(this);
|
|
7726
|
+
_DiagramUserSelection_canvas.set(this, void 0);
|
|
7727
|
+
_DiagramUserSelection_diagramPropertiesText.set(this, void 0);
|
|
7728
|
+
_DiagramUserSelection_propertyEditorSelection.set(this, void 0);
|
|
7729
|
+
_DiagramUserSelection_propertyEditorValues.set(this, void 0);
|
|
7730
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_canvas, canvas, "f");
|
|
7663
7731
|
// TODO: would be a good idea to be able to configure how often this fires, or whether at all
|
|
7664
|
-
this.
|
|
7665
|
-
this.
|
|
7732
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").propertyEditorChanges$.pipe(debounceTime(2000)).subscribe(() => {
|
|
7733
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_instances, "m", _DiagramUserSelection_makeUpdateValuesAction).call(this);
|
|
7666
7734
|
});
|
|
7667
|
-
this
|
|
7735
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_diagramPropertiesText, diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT, "f");
|
|
7668
7736
|
}
|
|
7669
7737
|
add(element) {
|
|
7670
7738
|
if (this.contains(element.id)) {
|
|
@@ -7673,9 +7741,9 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7673
7741
|
}
|
|
7674
7742
|
if (this.length === 0) {
|
|
7675
7743
|
// if there is nothing else selected, open our selection in the property editor
|
|
7676
|
-
if (this
|
|
7744
|
+
if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === undefined && (element instanceof DiagramNode || element instanceof DiagramConnection)) {
|
|
7677
7745
|
this.openInPropertyEditor(element);
|
|
7678
|
-
} else if (this
|
|
7746
|
+
} else if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === undefined && element instanceof DiagramSection) {
|
|
7679
7747
|
this.openInPropertyEditor(element.node);
|
|
7680
7748
|
} else {
|
|
7681
7749
|
this.openInPropertyEditor(undefined);
|
|
@@ -7697,7 +7765,7 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7697
7765
|
remove(id) {
|
|
7698
7766
|
const element = this.get(id);
|
|
7699
7767
|
if (element) {
|
|
7700
|
-
if (this
|
|
7768
|
+
if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === element) {
|
|
7701
7769
|
this.openInPropertyEditor(undefined);
|
|
7702
7770
|
}
|
|
7703
7771
|
super.remove(id);
|
|
@@ -7768,9 +7836,9 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7768
7836
|
fieldIdsToBeDeleted.push(userSelectionElement.id);
|
|
7769
7837
|
}
|
|
7770
7838
|
}
|
|
7771
|
-
const removeAction = new RemoveAction(this
|
|
7839
|
+
const removeAction = new RemoveAction(__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f"), nodeIdsToBeDeleted, sectionIdsToBeDeleted, portIdsToBeDeleted, connectionIdsToBeDeleted, fieldIdsToBeDeleted);
|
|
7772
7840
|
removeAction.do();
|
|
7773
|
-
this.
|
|
7841
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").actionStack.add(removeAction);
|
|
7774
7842
|
}
|
|
7775
7843
|
}
|
|
7776
7844
|
/**
|
|
@@ -7813,8 +7881,8 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7813
7881
|
if (userSelection.type !== 'daga-user-selection') {
|
|
7814
7882
|
return;
|
|
7815
7883
|
}
|
|
7816
|
-
const action = new PasteAction(this
|
|
7817
|
-
this.
|
|
7884
|
+
const action = new PasteAction(__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f"), userSelection.nodes, userSelection.connections, coords);
|
|
7885
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").actionStack.add(action);
|
|
7818
7886
|
action.do();
|
|
7819
7887
|
} catch (_a) {
|
|
7820
7888
|
return;
|
|
@@ -7832,17 +7900,17 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7832
7900
|
openInPropertyEditor(selection, makeUpdateValuesAction = true) {
|
|
7833
7901
|
var _a;
|
|
7834
7902
|
if (makeUpdateValuesAction) {
|
|
7835
|
-
this.
|
|
7903
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_instances, "m", _DiagramUserSelection_makeUpdateValuesAction).call(this);
|
|
7836
7904
|
}
|
|
7837
|
-
const propertyEditor = (_a = this.
|
|
7905
|
+
const propertyEditor = (_a = __classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").parentComponent) === null || _a === void 0 ? void 0 : _a.propertyEditor;
|
|
7838
7906
|
if (propertyEditor === undefined) {
|
|
7839
7907
|
return;
|
|
7840
7908
|
}
|
|
7841
7909
|
const selectedValueSet = selection === null || selection === void 0 ? void 0 : selection.valueSet;
|
|
7842
7910
|
if (selectedValueSet) {
|
|
7843
|
-
this
|
|
7911
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorSelection, selection, "f");
|
|
7844
7912
|
if (makeUpdateValuesAction) {
|
|
7845
|
-
this
|
|
7913
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorValues, clone(selectedValueSet.getValues()), "f");
|
|
7846
7914
|
}
|
|
7847
7915
|
if (propertyEditor) {
|
|
7848
7916
|
if (selection instanceof DiagramNode || selection instanceof DiagramConnection) {
|
|
@@ -7859,42 +7927,43 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7859
7927
|
propertyEditor.valueSet = undefined;
|
|
7860
7928
|
propertyEditor.valueSet = selectedValueSet;
|
|
7861
7929
|
} else {
|
|
7862
|
-
propertyEditor.title = this
|
|
7930
|
+
propertyEditor.title = __classPrivateFieldGet(this, _DiagramUserSelection_diagramPropertiesText, "f");
|
|
7863
7931
|
// force the update of the valueSet
|
|
7864
7932
|
propertyEditor.valueSet = undefined;
|
|
7865
7933
|
propertyEditor.valueSet = selectedValueSet;
|
|
7866
7934
|
}
|
|
7867
7935
|
}
|
|
7868
7936
|
} else {
|
|
7869
|
-
this
|
|
7870
|
-
this
|
|
7937
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorSelection, undefined, "f");
|
|
7938
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorValues, undefined, "f");
|
|
7871
7939
|
if (propertyEditor) {
|
|
7872
7940
|
propertyEditor.title = '';
|
|
7873
7941
|
propertyEditor.valueSet = undefined;
|
|
7874
7942
|
}
|
|
7875
7943
|
}
|
|
7876
7944
|
}
|
|
7877
|
-
makeUpdateValuesAction() {
|
|
7878
|
-
var _a, _b, _c;
|
|
7879
|
-
if (this.propertyEditorSelection === undefined || this.propertyEditorValues === undefined) {
|
|
7880
|
-
return;
|
|
7881
|
-
}
|
|
7882
|
-
const previousSelectionId = this.propertyEditorSelection instanceof DiagramModel ? undefined : this.propertyEditorSelection.id;
|
|
7883
|
-
// check if there have been changes in the previously selected ValueSet,
|
|
7884
|
-
// and create an UpdateValuesAction if there have
|
|
7885
|
-
if (equals(this.propertyEditorValues, (_a = this.propertyEditorSelection) === null || _a === void 0 ? void 0 : _a.valueSet.getValues())) {
|
|
7886
|
-
return;
|
|
7887
|
-
}
|
|
7888
|
-
const from = this.propertyEditorValues;
|
|
7889
|
-
const to = clone((_b = this.propertyEditorSelection) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
|
|
7890
|
-
const [fromDiff, toDiff] = diffProperties(from, to, (_c = this.propertyEditorSelection) === null || _c === void 0 ? void 0 : _c.valueSet);
|
|
7891
|
-
const currentAction = new UpdateValuesAction(this.canvas, previousSelectionId, fromDiff, toDiff);
|
|
7892
|
-
currentAction.do();
|
|
7893
|
-
this.canvas.actionStack.add(currentAction);
|
|
7894
|
-
this.propertyEditorValues = to;
|
|
7895
|
-
}
|
|
7896
7945
|
}
|
|
7946
|
+
_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() {
|
|
7947
|
+
var _a, _b, _c;
|
|
7948
|
+
if (__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") === undefined || __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorValues, "f") === undefined) {
|
|
7949
|
+
return;
|
|
7950
|
+
}
|
|
7951
|
+
const previousSelectionId = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f") instanceof DiagramModel ? undefined : __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f").id;
|
|
7952
|
+
// check if there have been changes in the previously selected ValueSet,
|
|
7953
|
+
// and create an UpdateValuesAction if there have
|
|
7954
|
+
if (equals(__classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorValues, "f"), (_a = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f")) === null || _a === void 0 ? void 0 : _a.valueSet.getValues())) {
|
|
7955
|
+
return;
|
|
7956
|
+
}
|
|
7957
|
+
const from = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorValues, "f");
|
|
7958
|
+
const to = clone((_b = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f")) === null || _b === void 0 ? void 0 : _b.valueSet.getValues());
|
|
7959
|
+
const [fromDiff, toDiff] = diffProperties(from, to, (_c = __classPrivateFieldGet(this, _DiagramUserSelection_propertyEditorSelection, "f")) === null || _c === void 0 ? void 0 : _c.valueSet);
|
|
7960
|
+
const currentAction = new UpdateValuesAction(__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f"), previousSelectionId, fromDiff, toDiff);
|
|
7961
|
+
currentAction.do();
|
|
7962
|
+
__classPrivateFieldGet(this, _DiagramUserSelection_canvas, "f").actionStack.add(currentAction);
|
|
7963
|
+
__classPrivateFieldSet(this, _DiagramUserSelection_propertyEditorValues, to, "f");
|
|
7964
|
+
};
|
|
7897
7965
|
|
|
7966
|
+
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;
|
|
7898
7967
|
/**
|
|
7899
7968
|
* Thickness of the invisible path around a connection used to make it easier to click on, in diagram units.
|
|
7900
7969
|
* @private
|
|
@@ -7909,13 +7978,13 @@ const ACTION_STACK_SIZE = 25;
|
|
|
7909
7978
|
const UNFINISHED_CONNECTION_ID = 'diagram-connection-unfinished';
|
|
7910
7979
|
class DiagramCanvas {
|
|
7911
7980
|
get connectionType() {
|
|
7912
|
-
return this
|
|
7981
|
+
return __classPrivateFieldGet(this, _DiagramCanvas_connectionType, "f");
|
|
7913
7982
|
}
|
|
7914
7983
|
set connectionType(value) {
|
|
7915
|
-
var
|
|
7916
|
-
this
|
|
7984
|
+
var _b, _c;
|
|
7985
|
+
__classPrivateFieldSet(this, _DiagramCanvas_connectionType, value, "f");
|
|
7917
7986
|
// refresh the palette every time connectionType is set so that the palette keeps track of updates to the connectionType
|
|
7918
|
-
(
|
|
7987
|
+
(_c = (_b = this.parentComponent) === null || _b === void 0 ? void 0 : _b.palette) === null || _c === void 0 ? void 0 : _c.refreshPalette();
|
|
7919
7988
|
}
|
|
7920
7989
|
/**
|
|
7921
7990
|
* Constructs a canvas object.
|
|
@@ -7924,45 +7993,62 @@ class DiagramCanvas {
|
|
|
7924
7993
|
* @param config The configuration object used to set the parameters of this canvas.
|
|
7925
7994
|
*/
|
|
7926
7995
|
constructor(parentComponent, config) {
|
|
7927
|
-
var
|
|
7928
|
-
|
|
7929
|
-
this
|
|
7930
|
-
this
|
|
7996
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
7997
|
+
var _z, _0;
|
|
7998
|
+
_DiagramCanvas_instances.add(this);
|
|
7999
|
+
_DiagramCanvas_diagramRoot.set(this, void 0);
|
|
8000
|
+
_DiagramCanvas_connectionType.set(this, void 0);
|
|
8001
|
+
_DiagramCanvas_gridPatternId.set(this, `daga-grid-pattern-id-${__classPrivateFieldSet(_z = _a, _a, (_0 = __classPrivateFieldGet(_z, _a, "f", _DiagramCanvas_canvasCount), ++_0), "f", _DiagramCanvas_canvasCount)}`);
|
|
8002
|
+
_DiagramCanvas_ancillaryGridPatternIds.set(this, []);
|
|
8003
|
+
_DiagramCanvas_zoomBehavior.set(this, void 0);
|
|
8004
|
+
_DiagramCanvas_zoomTransform.set(this, d3.zoomIdentity);
|
|
8005
|
+
_DiagramCanvas_priorityThreshold.set(this, void 0);
|
|
8006
|
+
_DiagramCanvas_priorityThresholds.set(this, void 0);
|
|
8007
|
+
_DiagramCanvas_unfinishedConnection.set(this, void 0);
|
|
8008
|
+
/**
|
|
8009
|
+
* Invisible path followed by an unfinished connection. Used for making unfinished connections stop before the cursor rather than stopping right at the cursor.
|
|
8010
|
+
*/
|
|
8011
|
+
_DiagramCanvas_unfinishedConnectionTracer.set(this, void 0);
|
|
8012
|
+
_DiagramCanvas_unfinishedConnectionPort.set(this, void 0);
|
|
8013
|
+
_DiagramCanvas_inputFieldContainer.set(this, void 0);
|
|
8014
|
+
_DiagramCanvas_multipleSelectionContainer.set(this, void 0);
|
|
7931
8015
|
// used to distinguish drags from clicks when dragging elements and during multiple selection
|
|
7932
|
-
this
|
|
8016
|
+
_DiagramCanvas_draggingFrom.set(this, [0, 0]);
|
|
7933
8017
|
// used to distinguish drags from clicks during multiple selection
|
|
7934
|
-
this
|
|
8018
|
+
_DiagramCanvas_dragging.set(this, false);
|
|
7935
8019
|
// used to track whether a click is secondary or primary
|
|
7936
|
-
this
|
|
8020
|
+
_DiagramCanvas_secondaryButton.set(this, false);
|
|
8021
|
+
// current action that started but hasn't finished yet
|
|
8022
|
+
_DiagramCanvas_currentAction.set(this, void 0);
|
|
7937
8023
|
this.validatorChange$ = new Subject();
|
|
7938
8024
|
this.diagramChange$ = new Subject();
|
|
7939
8025
|
this.diagramEvent$ = new Subject();
|
|
7940
8026
|
this.propertyEditorChanges$ = new Subject();
|
|
7941
8027
|
this.parentComponent = parentComponent;
|
|
7942
8028
|
this.model = new DiagramModel(this, undefined, config.name || 'unnamed', '', config.type || '', config.properties || []);
|
|
7943
|
-
this.userSelection = new DiagramUserSelection(this, (
|
|
7944
|
-
this.userHighlight = new DiagramUserHighlight(this, ((
|
|
7945
|
-
this.contextMenu = new DiagramContextMenu(this, (
|
|
8029
|
+
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);
|
|
8030
|
+
this.userHighlight = new DiagramUserHighlight(this, ((_d = config.canvas) === null || _d === void 0 ? void 0 : _d.highlightSections) !== false);
|
|
8031
|
+
this.contextMenu = new DiagramContextMenu(this, (_e = config.canvas) === null || _e === void 0 ? void 0 : _e.contextMenu);
|
|
7946
8032
|
// TODO
|
|
7947
|
-
this.backgroundConfig = (
|
|
7948
|
-
this.gridConfig = applyGridDefaults((
|
|
8033
|
+
this.backgroundConfig = (_g = (_f = config.canvas) === null || _f === void 0 ? void 0 : _f.background) !== null && _g !== void 0 ? _g : BACKGROUND_DEFAULTS;
|
|
8034
|
+
this.gridConfig = applyGridDefaults((_h = config.canvas) === null || _h === void 0 ? void 0 : _h.grid);
|
|
7949
8035
|
this.ancillaryGridsConfig = [];
|
|
7950
|
-
for (let i = 0; i < (((
|
|
7951
|
-
this.ancillaryGridsConfig.push(applyGridDefaults((
|
|
7952
|
-
this.
|
|
7953
|
-
}
|
|
7954
|
-
this.zoomFactor = ((
|
|
7955
|
-
this.panRate = ((
|
|
7956
|
-
this.inferConnectionType = ((
|
|
7957
|
-
this.autoTightenConnections = ((
|
|
7958
|
-
this.tightenConnectionsAcrossPortTypes = ((
|
|
7959
|
-
this.allowConnectionLoops = ((
|
|
7960
|
-
this.allowSharingPorts = ((
|
|
7961
|
-
this.allowSharingBothPorts = ((
|
|
7962
|
-
this.portHighlightRadius = ((
|
|
8036
|
+
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) {
|
|
8037
|
+
this.ancillaryGridsConfig.push(applyGridDefaults((_m = (_l = config.canvas) === null || _l === void 0 ? void 0 : _l.ancillaryGrids) === null || _m === void 0 ? void 0 : _m[i]));
|
|
8038
|
+
__classPrivateFieldGet(this, _DiagramCanvas_ancillaryGridPatternIds, "f").push(`${__classPrivateFieldGet(this, _DiagramCanvas_gridPatternId, "f")}-ancillary-${i}`);
|
|
8039
|
+
}
|
|
8040
|
+
this.zoomFactor = ((_o = config.canvas) === null || _o === void 0 ? void 0 : _o.zoomFactor) || 2;
|
|
8041
|
+
this.panRate = ((_p = config.canvas) === null || _p === void 0 ? void 0 : _p.panRate) || 100;
|
|
8042
|
+
this.inferConnectionType = ((_q = config.connectionSettings) === null || _q === void 0 ? void 0 : _q.inferConnectionType) || false;
|
|
8043
|
+
this.autoTightenConnections = ((_r = config.connectionSettings) === null || _r === void 0 ? void 0 : _r.autoTighten) !== false;
|
|
8044
|
+
this.tightenConnectionsAcrossPortTypes = ((_s = config.connectionSettings) === null || _s === void 0 ? void 0 : _s.tightenAcrossPortTypes) || false;
|
|
8045
|
+
this.allowConnectionLoops = ((_t = config.connectionSettings) === null || _t === void 0 ? void 0 : _t.allowLoops) || false;
|
|
8046
|
+
this.allowSharingPorts = ((_u = config.connectionSettings) === null || _u === void 0 ? void 0 : _u.sharePorts) !== false;
|
|
8047
|
+
this.allowSharingBothPorts = ((_v = config.connectionSettings) === null || _v === void 0 ? void 0 : _v.shareBothPorts) || false;
|
|
8048
|
+
this.portHighlightRadius = ((_w = config.connectionSettings) === null || _w === void 0 ? void 0 : _w.portHighlightRadius) || 100;
|
|
7963
8049
|
this.multipleSelectionOn = false;
|
|
7964
|
-
this
|
|
7965
|
-
this
|
|
8050
|
+
__classPrivateFieldSet(this, _DiagramCanvas_priorityThresholds, ((_x = config.canvas) === null || _x === void 0 ? void 0 : _x.priorityThresholds) || [], "f");
|
|
8051
|
+
__classPrivateFieldSet(this, _DiagramCanvas_priorityThreshold, __classPrivateFieldGet(this, _DiagramCanvas_priorityThresholds, "f") ? __classPrivateFieldGet(this, _DiagramCanvas_priorityThresholds, "f")[0] : undefined, "f");
|
|
7966
8052
|
this.layoutFormat = config.layoutFormat;
|
|
7967
8053
|
this.userActions = config.userActions || {};
|
|
7968
8054
|
this.validators = [];
|
|
@@ -7988,7 +8074,7 @@ class DiagramCanvas {
|
|
|
7988
8074
|
const connectionType = new DiagramConnectionType(Object.assign(Object.assign({}, config.connectionTypeDefaults), connectionTypeConfig));
|
|
7989
8075
|
this.model.connections.types.add(connectionType);
|
|
7990
8076
|
}
|
|
7991
|
-
this
|
|
8077
|
+
__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");
|
|
7992
8078
|
}
|
|
7993
8079
|
}
|
|
7994
8080
|
addValidator(validator) {
|
|
@@ -8000,38 +8086,38 @@ class DiagramCanvas {
|
|
|
8000
8086
|
this.validatorChange$.next();
|
|
8001
8087
|
}
|
|
8002
8088
|
getPriorityThresholdOptions() {
|
|
8003
|
-
return this
|
|
8089
|
+
return __classPrivateFieldGet(this, _DiagramCanvas_priorityThresholds, "f");
|
|
8004
8090
|
}
|
|
8005
8091
|
getPriorityThreshold() {
|
|
8006
|
-
return this
|
|
8092
|
+
return __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f");
|
|
8007
8093
|
}
|
|
8008
8094
|
setPriorityThreshold(priority) {
|
|
8009
|
-
var
|
|
8010
|
-
this
|
|
8095
|
+
var _b, _c;
|
|
8096
|
+
__classPrivateFieldSet(this, _DiagramCanvas_priorityThreshold, priority, "f");
|
|
8011
8097
|
this.updateModelInView();
|
|
8012
8098
|
for (const node of this.model.nodes) {
|
|
8013
8099
|
this.fitNodeInView(node.id);
|
|
8014
8100
|
}
|
|
8015
|
-
(
|
|
8101
|
+
(_c = (_b = this.parentComponent) === null || _b === void 0 ? void 0 : _b.palette) === null || _c === void 0 ? void 0 : _c.refreshPalette();
|
|
8016
8102
|
}
|
|
8017
8103
|
// View methods
|
|
8018
8104
|
initView(appendTo) {
|
|
8019
8105
|
const appendToSelection = d3.select(appendTo);
|
|
8020
8106
|
// remove all children
|
|
8021
8107
|
appendToSelection.html('');
|
|
8022
|
-
this
|
|
8108
|
+
__classPrivateFieldSet(this, _DiagramCanvas_diagramRoot, appendToSelection.append('div').node(), "f");
|
|
8023
8109
|
this.selectRoot().attr('tabindex', 0) // make element focusable
|
|
8024
8110
|
.style('width', '100%').style('height', '100%').append('svg').style('width', '100%').style('height', '100%');
|
|
8025
8111
|
this.selectRoot().on(Events.Click, () => {
|
|
8026
|
-
var
|
|
8112
|
+
var _b;
|
|
8027
8113
|
// focus on the diagram when clicking so that we can focus on the diagram
|
|
8028
8114
|
// keyboard events only work if we're focusing on the diagram
|
|
8029
|
-
(
|
|
8115
|
+
(_b = this.selectRoot().node()) === null || _b === void 0 ? void 0 : _b.focus();
|
|
8030
8116
|
}).on(Events.ContextMenu, event => {
|
|
8031
|
-
if (this
|
|
8117
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
8032
8118
|
event.preventDefault();
|
|
8033
8119
|
event.stopPropagation();
|
|
8034
|
-
this
|
|
8120
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
8035
8121
|
return;
|
|
8036
8122
|
}
|
|
8037
8123
|
const diagramEvent = new DiagramSecondaryClickEvent(event, null);
|
|
@@ -8140,33 +8226,33 @@ class DiagramCanvas {
|
|
|
8140
8226
|
if (this.canUserPerformAction(DiagramActions.Zoom)) {
|
|
8141
8227
|
event.preventDefault();
|
|
8142
8228
|
// move left, faster if we're zoomed out and slower if we're zoomed in
|
|
8143
|
-
this.translateBy(this.panRate / this.
|
|
8229
|
+
this.translateBy(this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, 0);
|
|
8144
8230
|
}
|
|
8145
8231
|
}
|
|
8146
8232
|
if (event.key === Keys.ArrowRight) {
|
|
8147
8233
|
if (this.canUserPerformAction(DiagramActions.Zoom)) {
|
|
8148
8234
|
event.preventDefault();
|
|
8149
8235
|
// move right, faster if we're zoomed out and slower if we're zoomed in
|
|
8150
|
-
this.translateBy(-this.panRate / this.
|
|
8236
|
+
this.translateBy(-this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, 0);
|
|
8151
8237
|
}
|
|
8152
8238
|
}
|
|
8153
8239
|
if (event.key === Keys.ArrowDown) {
|
|
8154
8240
|
if (this.canUserPerformAction(DiagramActions.Zoom)) {
|
|
8155
8241
|
event.preventDefault();
|
|
8156
8242
|
// move down, faster if we're zoomed out and slower if we're zoomed in
|
|
8157
|
-
this.translateBy(0, -this.panRate / this.
|
|
8243
|
+
this.translateBy(0, -this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k);
|
|
8158
8244
|
}
|
|
8159
8245
|
}
|
|
8160
8246
|
if (event.key === Keys.ArrowUp) {
|
|
8161
8247
|
if (this.canUserPerformAction(DiagramActions.Zoom)) {
|
|
8162
8248
|
event.preventDefault();
|
|
8163
8249
|
// move up, faster if we're zoomed out and slower if we're zoomed in
|
|
8164
|
-
this.translateBy(0, this.panRate / this.
|
|
8250
|
+
this.translateBy(0, this.panRate / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k);
|
|
8165
8251
|
}
|
|
8166
8252
|
}
|
|
8167
8253
|
});
|
|
8168
8254
|
const canvasView = this.selectSVGElement().append('g').attr('class', 'daga-canvas-view').attr('width', `100%`).attr('height', `100%`);
|
|
8169
|
-
canvasView.call(this
|
|
8255
|
+
canvasView.call(__classPrivateFieldSet(this, _DiagramCanvas_zoomBehavior, d3.zoom().filter(event => {
|
|
8170
8256
|
// Disable double-click zoom by filtering out dblclick events
|
|
8171
8257
|
return event.type !== Events.DoubleClick;
|
|
8172
8258
|
}).on(ZoomEvents.Zoom, event => {
|
|
@@ -8187,29 +8273,29 @@ class DiagramCanvas {
|
|
|
8187
8273
|
setCursorStyle(CursorStyle.AllScroll);
|
|
8188
8274
|
}
|
|
8189
8275
|
}
|
|
8190
|
-
this
|
|
8276
|
+
__classPrivateFieldSet(this, _DiagramCanvas_zoomTransform, event.transform, "f");
|
|
8191
8277
|
const transformAttribute = event.transform.toString();
|
|
8192
8278
|
this.selectCanvasElements().attr('transform', transformAttribute);
|
|
8193
|
-
for (const gridPatternId of [this
|
|
8279
|
+
for (const gridPatternId of [__classPrivateFieldGet(this, _DiagramCanvas_gridPatternId, "f"), ...__classPrivateFieldGet(this, _DiagramCanvas_ancillaryGridPatternIds, "f")]) {
|
|
8194
8280
|
this.selectCanvasView().select(`#${gridPatternId}`).attr('patternTransform', transformAttribute);
|
|
8195
8281
|
}
|
|
8196
8282
|
this.contextMenu.close();
|
|
8197
|
-
this.diagramEvent$.next(new DiagramZoomEvent([this.
|
|
8283
|
+
this.diagramEvent$.next(new DiagramZoomEvent([__classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").x, __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").y], __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k));
|
|
8198
8284
|
}).on(ZoomEvents.End, () => {
|
|
8199
8285
|
setCursorStyle();
|
|
8200
|
-
}));
|
|
8286
|
+
}), "f"));
|
|
8201
8287
|
const canvasDefs = canvasView.append('defs');
|
|
8202
8288
|
const canvasBackground = [];
|
|
8203
8289
|
canvasBackground.push(initializeBackground(canvasView, this.backgroundConfig).attr('class', 'daga-background'));
|
|
8204
8290
|
for (let i = 0; i < this.ancillaryGridsConfig.length; ++i) {
|
|
8205
|
-
canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, this
|
|
8291
|
+
canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, __classPrivateFieldGet(this, _DiagramCanvas_ancillaryGridPatternIds, "f")[i], this.ancillaryGridsConfig[i]));
|
|
8206
8292
|
}
|
|
8207
|
-
canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, this
|
|
8293
|
+
canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, __classPrivateFieldGet(this, _DiagramCanvas_gridPatternId, "f"), this.gridConfig));
|
|
8208
8294
|
for (const canvasBackgroundElement of canvasBackground) {
|
|
8209
8295
|
canvasBackgroundElement.on(Events.MouseMove, event => {
|
|
8210
|
-
if (this
|
|
8296
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") !== undefined) {
|
|
8211
8297
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8212
|
-
this.
|
|
8298
|
+
__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endCoords = pointerCoords;
|
|
8213
8299
|
}
|
|
8214
8300
|
});
|
|
8215
8301
|
canvasBackgroundElement.on(Events.MouseOver, () => {
|
|
@@ -8234,55 +8320,55 @@ class DiagramCanvas {
|
|
|
8234
8320
|
canvasBackgroundElement.call(d3.drag().filter(event => {
|
|
8235
8321
|
return this.multipleSelectionOn || isSecondaryButton(event);
|
|
8236
8322
|
}).on(DragEvents.Start, event => {
|
|
8237
|
-
this.
|
|
8323
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
8238
8324
|
}).on(DragEvents.Drag, event => {
|
|
8239
|
-
this.
|
|
8325
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
8240
8326
|
}).on(DragEvents.End, event => {
|
|
8241
|
-
this.
|
|
8327
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
8242
8328
|
}));
|
|
8243
8329
|
}
|
|
8244
8330
|
canvasView.append('g').attr('class', 'daga-canvas-elements');
|
|
8245
8331
|
}
|
|
8246
8332
|
getZoomLevel() {
|
|
8247
|
-
return this.
|
|
8333
|
+
return __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k;
|
|
8248
8334
|
}
|
|
8249
8335
|
zoomBy(factor) {
|
|
8250
8336
|
if (!isNaN(factor)) {
|
|
8251
|
-
this.
|
|
8337
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleBy(this.selectCanvasView(), factor);
|
|
8252
8338
|
}
|
|
8253
8339
|
}
|
|
8254
8340
|
zoomTo(level) {
|
|
8255
8341
|
if (!isNaN(level)) {
|
|
8256
|
-
this.
|
|
8342
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleTo(this.selectCanvasView(), level);
|
|
8257
8343
|
}
|
|
8258
8344
|
}
|
|
8259
8345
|
getViewCoordinates() {
|
|
8260
|
-
var
|
|
8261
|
-
const canvasViewBoundingBox = (
|
|
8346
|
+
var _b, _c, _d;
|
|
8347
|
+
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();
|
|
8262
8348
|
/*
|
|
8263
8349
|
transform the coordinates of the zoomTransform to the coordinates
|
|
8264
8350
|
needed to point the zoomTransfrom to the center of the screen to
|
|
8265
8351
|
ensure that canvas.translateTo(getViewCoordinates()) has no effect
|
|
8266
8352
|
*/
|
|
8267
|
-
return [((canvasViewBoundingBox.width + canvasViewBoundingBox.x) / 2 - this.
|
|
8353
|
+
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];
|
|
8268
8354
|
}
|
|
8269
8355
|
translateBy(x, y) {
|
|
8270
8356
|
if (!isNaN(x) && !isNaN(y)) {
|
|
8271
|
-
this.
|
|
8357
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateBy(this.selectCanvasView(), x, y);
|
|
8272
8358
|
}
|
|
8273
8359
|
}
|
|
8274
8360
|
translateTo(x, y) {
|
|
8275
8361
|
if (!isNaN(x) && !isNaN(y)) {
|
|
8276
|
-
this.
|
|
8362
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateTo(this.selectCanvasView(), x, y);
|
|
8277
8363
|
}
|
|
8278
8364
|
}
|
|
8279
8365
|
zoomAndPanTo(x, y, z, duration) {
|
|
8280
8366
|
if (!duration || duration <= 0) {
|
|
8281
|
-
this.
|
|
8282
|
-
this.
|
|
8367
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleTo(this.selectCanvasView(), z);
|
|
8368
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateTo(this.selectCanvasView(), x, y);
|
|
8283
8369
|
return;
|
|
8284
8370
|
}
|
|
8285
|
-
this.
|
|
8371
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").interpolate(d3.interpolate);
|
|
8286
8372
|
const [startingX, startingY] = this.getViewCoordinates();
|
|
8287
8373
|
const startingZoom = this.getZoomLevel();
|
|
8288
8374
|
const targetX = x,
|
|
@@ -8296,8 +8382,8 @@ class DiagramCanvas {
|
|
|
8296
8382
|
const currentX = value * (targetX - startingX) + startingX;
|
|
8297
8383
|
const currentY = value * (targetY - startingY) + startingY;
|
|
8298
8384
|
const currentZoom = value * (targetZoom - startingZoom) + startingZoom;
|
|
8299
|
-
this.
|
|
8300
|
-
this.
|
|
8385
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").scaleTo(this.selectCanvasView(), currentZoom);
|
|
8386
|
+
__classPrivateFieldGet(this, _DiagramCanvas_zoomBehavior, "f").translateTo(this.selectCanvasView(), currentX, currentY);
|
|
8301
8387
|
}
|
|
8302
8388
|
} catch (e) {
|
|
8303
8389
|
console.warn('Animation has been interrupted.', e);
|
|
@@ -8307,10 +8393,10 @@ class DiagramCanvas {
|
|
|
8307
8393
|
});
|
|
8308
8394
|
}
|
|
8309
8395
|
center(nodeIds, maxZoomLevel, duration) {
|
|
8310
|
-
var
|
|
8396
|
+
var _b;
|
|
8311
8397
|
// if there are no nodes, we have nothing to do here
|
|
8312
8398
|
if (this.model.nodes.length > 0) {
|
|
8313
|
-
const canvasViewBoundingBox = (
|
|
8399
|
+
const canvasViewBoundingBox = (_b = this.selectCanvasView().select('.daga-background').node()) === null || _b === void 0 ? void 0 : _b.getBBox();
|
|
8314
8400
|
if (!canvasViewBoundingBox.width || !canvasViewBoundingBox.height) {
|
|
8315
8401
|
// prevent errors if the width or height is invalid
|
|
8316
8402
|
return;
|
|
@@ -8352,10 +8438,10 @@ class DiagramCanvas {
|
|
|
8352
8438
|
return [pointX, pointY];
|
|
8353
8439
|
}
|
|
8354
8440
|
getCoordinatesOnScreen() {
|
|
8355
|
-
var
|
|
8356
|
-
const rootBoundingClientRect = (
|
|
8441
|
+
var _b;
|
|
8442
|
+
const rootBoundingClientRect = (_b = this.selectSVGElement().node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
8357
8443
|
const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.height) || 0];
|
|
8358
|
-
return [[-this.
|
|
8444
|
+
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]];
|
|
8359
8445
|
}
|
|
8360
8446
|
getPointerLocationRelativeToCanvas(event) {
|
|
8361
8447
|
return d3.pointer(getEventHoldingCoordinates(event), this.selectCanvasElements().node());
|
|
@@ -8380,7 +8466,7 @@ class DiagramCanvas {
|
|
|
8380
8466
|
this.updateDecoratorsInView();
|
|
8381
8467
|
}
|
|
8382
8468
|
updateNodesInView(...ids) {
|
|
8383
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-node').data(this.model.nodes.filter(e => this
|
|
8469
|
+
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);
|
|
8384
8470
|
const exitSelection = updateSelection.exit();
|
|
8385
8471
|
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}`);
|
|
8386
8472
|
if (ids && ids.length > 0) {
|
|
@@ -8389,7 +8475,7 @@ class DiagramCanvas {
|
|
|
8389
8475
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
8390
8476
|
exitSelection.remove();
|
|
8391
8477
|
enterSelection.on(Events.MouseOver, (_event, d) => {
|
|
8392
|
-
if (!this
|
|
8478
|
+
if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
8393
8479
|
this.userHighlight.focusOn(d);
|
|
8394
8480
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
8395
8481
|
}
|
|
@@ -8402,10 +8488,10 @@ class DiagramCanvas {
|
|
|
8402
8488
|
this.userSelection.toggle(d);
|
|
8403
8489
|
this.diagramEvent$.next(new DiagramSelectionEvent([d], d.selected));
|
|
8404
8490
|
}).on(Events.ContextMenu, (event, d) => {
|
|
8405
|
-
if (this
|
|
8491
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
8406
8492
|
event.preventDefault();
|
|
8407
8493
|
event.stopPropagation();
|
|
8408
|
-
this
|
|
8494
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
8409
8495
|
return;
|
|
8410
8496
|
}
|
|
8411
8497
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -8422,27 +8508,27 @@ class DiagramCanvas {
|
|
|
8422
8508
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
8423
8509
|
this.diagramEvent$.next(diagramEvent);
|
|
8424
8510
|
}).call(d3.drag().filter(event => {
|
|
8425
|
-
this
|
|
8511
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
8426
8512
|
return true;
|
|
8427
8513
|
}).on(DragEvents.Start, (event, d) => {
|
|
8428
|
-
if (this.multipleSelectionOn || this
|
|
8429
|
-
this.
|
|
8514
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8515
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
8430
8516
|
} else {
|
|
8431
|
-
this.
|
|
8517
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, d);
|
|
8432
8518
|
}
|
|
8433
8519
|
}).on(DragEvents.Drag, (event, d) => {
|
|
8434
|
-
if (this.multipleSelectionOn || this
|
|
8435
|
-
this.
|
|
8520
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8521
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
8436
8522
|
} else {
|
|
8437
|
-
this.
|
|
8523
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, d);
|
|
8438
8524
|
}
|
|
8439
8525
|
}).on(DragEvents.End, (event, d) => {
|
|
8440
|
-
if (this.multipleSelectionOn || this
|
|
8441
|
-
this.
|
|
8526
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8527
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
8442
8528
|
} else {
|
|
8443
|
-
this.
|
|
8529
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, d);
|
|
8444
8530
|
}
|
|
8445
|
-
this
|
|
8531
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
|
|
8446
8532
|
}));
|
|
8447
8533
|
initializeLook(enterSelection);
|
|
8448
8534
|
enterSelection.filter('.resizable-x').append('rect').attr('class', 'left-resizer').on(Events.MouseOver, (_event, d) => {
|
|
@@ -8456,7 +8542,7 @@ class DiagramCanvas {
|
|
|
8456
8542
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8457
8543
|
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
8458
8544
|
setCursorStyle(CursorStyle.EWResize);
|
|
8459
|
-
this
|
|
8545
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8460
8546
|
} else {
|
|
8461
8547
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8462
8548
|
}
|
|
@@ -8466,7 +8552,7 @@ class DiagramCanvas {
|
|
|
8466
8552
|
d.stretch(Side.Left, d.coords[0] - pointerCoords[0]);
|
|
8467
8553
|
}
|
|
8468
8554
|
}).on(DragEvents.End, (event, d) => {
|
|
8469
|
-
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this
|
|
8555
|
+
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchNode) {
|
|
8470
8556
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8471
8557
|
if (this.gridConfig.snap) {
|
|
8472
8558
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8474,10 +8560,10 @@ class DiagramCanvas {
|
|
|
8474
8560
|
pointerCoords[1] += d.type.snapToGridOffset[1];
|
|
8475
8561
|
}
|
|
8476
8562
|
d.stretch(Side.Left, d.coords[0] - pointerCoords[0]);
|
|
8477
|
-
this.
|
|
8478
|
-
this.
|
|
8479
|
-
this.actionStack.add(this
|
|
8480
|
-
this
|
|
8563
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8564
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8565
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8566
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8481
8567
|
}
|
|
8482
8568
|
setCursorStyle();
|
|
8483
8569
|
}));
|
|
@@ -8492,7 +8578,7 @@ class DiagramCanvas {
|
|
|
8492
8578
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8493
8579
|
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
8494
8580
|
setCursorStyle(CursorStyle.EWResize);
|
|
8495
|
-
this
|
|
8581
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8496
8582
|
} else {
|
|
8497
8583
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8498
8584
|
}
|
|
@@ -8502,7 +8588,7 @@ class DiagramCanvas {
|
|
|
8502
8588
|
d.stretch(Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
8503
8589
|
}
|
|
8504
8590
|
}).on(DragEvents.End, (event, d) => {
|
|
8505
|
-
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this
|
|
8591
|
+
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchNode) {
|
|
8506
8592
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8507
8593
|
if (this.gridConfig.snap) {
|
|
8508
8594
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
|
|
@@ -8510,10 +8596,10 @@ class DiagramCanvas {
|
|
|
8510
8596
|
pointerCoords[1] += d.type.snapToGridOffset[3];
|
|
8511
8597
|
}
|
|
8512
8598
|
d.stretch(Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
8513
|
-
this.
|
|
8514
|
-
this.
|
|
8515
|
-
this.actionStack.add(this
|
|
8516
|
-
this
|
|
8599
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8600
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8601
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8602
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8517
8603
|
}
|
|
8518
8604
|
setCursorStyle();
|
|
8519
8605
|
}));
|
|
@@ -8528,7 +8614,7 @@ class DiagramCanvas {
|
|
|
8528
8614
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8529
8615
|
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
8530
8616
|
setCursorStyle(CursorStyle.NSResize);
|
|
8531
|
-
this
|
|
8617
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8532
8618
|
} else {
|
|
8533
8619
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8534
8620
|
}
|
|
@@ -8538,7 +8624,7 @@ class DiagramCanvas {
|
|
|
8538
8624
|
d.stretch(Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8539
8625
|
}
|
|
8540
8626
|
}).on(DragEvents.End, (event, d) => {
|
|
8541
|
-
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this
|
|
8627
|
+
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchNode) {
|
|
8542
8628
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8543
8629
|
if (this.gridConfig.snap) {
|
|
8544
8630
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8546,10 +8632,10 @@ class DiagramCanvas {
|
|
|
8546
8632
|
pointerCoords[1] += d.type.snapToGridOffset[1];
|
|
8547
8633
|
}
|
|
8548
8634
|
d.stretch(Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8549
|
-
this.
|
|
8550
|
-
this.
|
|
8551
|
-
this.actionStack.add(this
|
|
8552
|
-
this
|
|
8635
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8636
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8637
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8638
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8553
8639
|
}
|
|
8554
8640
|
setCursorStyle();
|
|
8555
8641
|
}));
|
|
@@ -8564,7 +8650,7 @@ class DiagramCanvas {
|
|
|
8564
8650
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8565
8651
|
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
8566
8652
|
setCursorStyle(CursorStyle.NSResize);
|
|
8567
|
-
this
|
|
8653
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8568
8654
|
} else {
|
|
8569
8655
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8570
8656
|
}
|
|
@@ -8574,7 +8660,7 @@ class DiagramCanvas {
|
|
|
8574
8660
|
d.stretch(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8575
8661
|
}
|
|
8576
8662
|
}).on(DragEvents.End, (event, d) => {
|
|
8577
|
-
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this
|
|
8663
|
+
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchNode) {
|
|
8578
8664
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8579
8665
|
if (this.gridConfig.snap) {
|
|
8580
8666
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
|
|
@@ -8582,10 +8668,10 @@ class DiagramCanvas {
|
|
|
8582
8668
|
pointerCoords[1] += d.type.snapToGridOffset[3];
|
|
8583
8669
|
}
|
|
8584
8670
|
d.stretch(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8585
|
-
this.
|
|
8586
|
-
this.
|
|
8587
|
-
this.actionStack.add(this
|
|
8588
|
-
this
|
|
8671
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8672
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8673
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8674
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8589
8675
|
}
|
|
8590
8676
|
setCursorStyle();
|
|
8591
8677
|
}));
|
|
@@ -8600,7 +8686,7 @@ class DiagramCanvas {
|
|
|
8600
8686
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8601
8687
|
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
|
|
8602
8688
|
setCursorStyle(CursorStyle.NWSEResize);
|
|
8603
|
-
this
|
|
8689
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8604
8690
|
} else {
|
|
8605
8691
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8606
8692
|
}
|
|
@@ -8611,7 +8697,7 @@ class DiagramCanvas {
|
|
|
8611
8697
|
d.stretch(Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8612
8698
|
}
|
|
8613
8699
|
}).on(DragEvents.End, (event, d) => {
|
|
8614
|
-
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this
|
|
8700
|
+
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchNode) {
|
|
8615
8701
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8616
8702
|
if (this.gridConfig.snap) {
|
|
8617
8703
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8620,10 +8706,10 @@ class DiagramCanvas {
|
|
|
8620
8706
|
}
|
|
8621
8707
|
d.stretch(Side.Left, d.coords[0] - pointerCoords[0]);
|
|
8622
8708
|
d.stretch(Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8623
|
-
this.
|
|
8624
|
-
this.
|
|
8625
|
-
this.actionStack.add(this
|
|
8626
|
-
this
|
|
8709
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8710
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8711
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8712
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8627
8713
|
}
|
|
8628
8714
|
setCursorStyle();
|
|
8629
8715
|
}));
|
|
@@ -8638,7 +8724,7 @@ class DiagramCanvas {
|
|
|
8638
8724
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8639
8725
|
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
|
|
8640
8726
|
setCursorStyle(CursorStyle.NESWResize);
|
|
8641
|
-
this
|
|
8727
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8642
8728
|
} else {
|
|
8643
8729
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8644
8730
|
}
|
|
@@ -8649,7 +8735,7 @@ class DiagramCanvas {
|
|
|
8649
8735
|
d.stretch(Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8650
8736
|
}
|
|
8651
8737
|
}).on(DragEvents.End, (event, d) => {
|
|
8652
|
-
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this
|
|
8738
|
+
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchNode) {
|
|
8653
8739
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8654
8740
|
if (this.gridConfig.snap) {
|
|
8655
8741
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8658,10 +8744,10 @@ class DiagramCanvas {
|
|
|
8658
8744
|
}
|
|
8659
8745
|
d.stretch(Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
8660
8746
|
d.stretch(Side.Top, d.coords[1] - pointerCoords[1]);
|
|
8661
|
-
this.
|
|
8662
|
-
this.
|
|
8663
|
-
this.actionStack.add(this
|
|
8664
|
-
this
|
|
8747
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8748
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8749
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8750
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8665
8751
|
}
|
|
8666
8752
|
setCursorStyle();
|
|
8667
8753
|
}));
|
|
@@ -8676,7 +8762,7 @@ class DiagramCanvas {
|
|
|
8676
8762
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8677
8763
|
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
|
|
8678
8764
|
setCursorStyle(CursorStyle.NESWResize);
|
|
8679
|
-
this
|
|
8765
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8680
8766
|
} else {
|
|
8681
8767
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8682
8768
|
}
|
|
@@ -8687,7 +8773,7 @@ class DiagramCanvas {
|
|
|
8687
8773
|
d.stretch(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8688
8774
|
}
|
|
8689
8775
|
}).on(DragEvents.End, (event, d) => {
|
|
8690
|
-
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this
|
|
8776
|
+
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchNode) {
|
|
8691
8777
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8692
8778
|
if (this.gridConfig.snap) {
|
|
8693
8779
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8696,10 +8782,10 @@ class DiagramCanvas {
|
|
|
8696
8782
|
}
|
|
8697
8783
|
d.stretch(Side.Left, d.coords[0] - pointerCoords[0]);
|
|
8698
8784
|
d.stretch(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8699
|
-
this.
|
|
8700
|
-
this.
|
|
8701
|
-
this.actionStack.add(this
|
|
8702
|
-
this
|
|
8785
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8786
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8787
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8788
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8703
8789
|
}
|
|
8704
8790
|
setCursorStyle();
|
|
8705
8791
|
}));
|
|
@@ -8714,7 +8800,7 @@ class DiagramCanvas {
|
|
|
8714
8800
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8715
8801
|
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
|
|
8716
8802
|
setCursorStyle(CursorStyle.NWSEResize);
|
|
8717
|
-
this
|
|
8803
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry()), "f");
|
|
8718
8804
|
} else {
|
|
8719
8805
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8720
8806
|
}
|
|
@@ -8725,7 +8811,7 @@ class DiagramCanvas {
|
|
|
8725
8811
|
d.stretch(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8726
8812
|
}
|
|
8727
8813
|
}).on(DragEvents.End, (event, d) => {
|
|
8728
|
-
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this
|
|
8814
|
+
if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchNode) {
|
|
8729
8815
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8730
8816
|
if (this.gridConfig.snap) {
|
|
8731
8817
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8734,10 +8820,10 @@ class DiagramCanvas {
|
|
|
8734
8820
|
}
|
|
8735
8821
|
d.stretch(Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
8736
8822
|
d.stretch(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8737
|
-
this.
|
|
8738
|
-
this.
|
|
8739
|
-
this.actionStack.add(this
|
|
8740
|
-
this
|
|
8823
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry();
|
|
8824
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8825
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8826
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8741
8827
|
}
|
|
8742
8828
|
setCursorStyle();
|
|
8743
8829
|
}));
|
|
@@ -8753,11 +8839,11 @@ class DiagramCanvas {
|
|
|
8753
8839
|
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);
|
|
8754
8840
|
}
|
|
8755
8841
|
updateSectionsInView(...ids) {
|
|
8756
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-section').data(this.model.sections.filter(e => this
|
|
8842
|
+
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);
|
|
8757
8843
|
const exitSelection = updateSelection.exit();
|
|
8758
8844
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
|
|
8759
|
-
var
|
|
8760
|
-
return `diagram-section${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''}${needsResizerXY(d) ? ' resizable-xy' : ''} ${(
|
|
8845
|
+
var _b;
|
|
8846
|
+
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}`;
|
|
8761
8847
|
});
|
|
8762
8848
|
if (ids && ids.length > 0) {
|
|
8763
8849
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
@@ -8765,7 +8851,7 @@ class DiagramCanvas {
|
|
|
8765
8851
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
8766
8852
|
exitSelection.remove();
|
|
8767
8853
|
enterSelection.on(Events.MouseOver, (_event, d) => {
|
|
8768
|
-
if (!this
|
|
8854
|
+
if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
8769
8855
|
this.userHighlight.focusOn(d);
|
|
8770
8856
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
8771
8857
|
}
|
|
@@ -8779,10 +8865,10 @@ class DiagramCanvas {
|
|
|
8779
8865
|
this.userSelection.toggle(elementToBeToggled);
|
|
8780
8866
|
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
8781
8867
|
}).on(Events.ContextMenu, (event, d) => {
|
|
8782
|
-
if (this
|
|
8868
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
8783
8869
|
event.preventDefault();
|
|
8784
8870
|
event.stopPropagation();
|
|
8785
|
-
this
|
|
8871
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
8786
8872
|
return;
|
|
8787
8873
|
}
|
|
8788
8874
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -8800,42 +8886,42 @@ class DiagramCanvas {
|
|
|
8800
8886
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
8801
8887
|
this.diagramEvent$.next(diagramEvent);
|
|
8802
8888
|
}).call(d3.drag().filter(event => {
|
|
8803
|
-
this
|
|
8889
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
8804
8890
|
return true;
|
|
8805
8891
|
}).on(DragEvents.Start, (event, d) => {
|
|
8806
|
-
if (this.multipleSelectionOn || this
|
|
8807
|
-
this.
|
|
8892
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8893
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
8808
8894
|
} else {
|
|
8809
8895
|
const node = d === null || d === void 0 ? void 0 : d.node;
|
|
8810
8896
|
if (node) {
|
|
8811
|
-
this.
|
|
8897
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, node);
|
|
8812
8898
|
} else {
|
|
8813
8899
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8814
8900
|
}
|
|
8815
8901
|
}
|
|
8816
8902
|
}).on(DragEvents.Drag, (event, d) => {
|
|
8817
|
-
if (this.multipleSelectionOn || this
|
|
8818
|
-
this.
|
|
8903
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8904
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
8819
8905
|
} else {
|
|
8820
8906
|
const node = d === null || d === void 0 ? void 0 : d.node;
|
|
8821
8907
|
if (node) {
|
|
8822
|
-
this.
|
|
8908
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, node);
|
|
8823
8909
|
} else {
|
|
8824
8910
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8825
8911
|
}
|
|
8826
8912
|
}
|
|
8827
8913
|
}).on(DragEvents.End, (event, d) => {
|
|
8828
|
-
if (this.multipleSelectionOn || this
|
|
8829
|
-
this.
|
|
8914
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
8915
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
8830
8916
|
} else {
|
|
8831
8917
|
const node = d === null || d === void 0 ? void 0 : d.node;
|
|
8832
8918
|
if (node) {
|
|
8833
|
-
this.
|
|
8919
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, node);
|
|
8834
8920
|
} else {
|
|
8835
8921
|
setCursorStyle();
|
|
8836
8922
|
}
|
|
8837
8923
|
}
|
|
8838
|
-
this
|
|
8924
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
|
|
8839
8925
|
}));
|
|
8840
8926
|
initializeLook(enterSelection);
|
|
8841
8927
|
enterSelection.filter('.resizable-x').append('rect').attr('class', 'left-resizer').on(Events.MouseOver, (_event, d) => {
|
|
@@ -8849,7 +8935,7 @@ class DiagramCanvas {
|
|
|
8849
8935
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8850
8936
|
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableX() && !d.removed && d.node) {
|
|
8851
8937
|
setCursorStyle(CursorStyle.EWResize);
|
|
8852
|
-
this
|
|
8938
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
8853
8939
|
} else {
|
|
8854
8940
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8855
8941
|
}
|
|
@@ -8859,16 +8945,16 @@ class DiagramCanvas {
|
|
|
8859
8945
|
d.node.stretchSections(Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
8860
8946
|
}
|
|
8861
8947
|
}).on(DragEvents.End, (event, d) => {
|
|
8862
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableX() && !d.removed && this
|
|
8948
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchSection && d.node) {
|
|
8863
8949
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8864
8950
|
if (this.gridConfig.snap) {
|
|
8865
8951
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
8866
8952
|
}
|
|
8867
8953
|
d.node.stretchSections(Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
8868
|
-
this.
|
|
8869
|
-
this.
|
|
8870
|
-
this.actionStack.add(this
|
|
8871
|
-
this
|
|
8954
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
8955
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8956
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8957
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8872
8958
|
}
|
|
8873
8959
|
setCursorStyle();
|
|
8874
8960
|
}));
|
|
@@ -8883,7 +8969,7 @@ class DiagramCanvas {
|
|
|
8883
8969
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8884
8970
|
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableX() && !d.removed && d.node) {
|
|
8885
8971
|
setCursorStyle(CursorStyle.EWResize);
|
|
8886
|
-
this
|
|
8972
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
8887
8973
|
} else {
|
|
8888
8974
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8889
8975
|
}
|
|
@@ -8893,16 +8979,16 @@ class DiagramCanvas {
|
|
|
8893
8979
|
d.node.stretchSections(Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
8894
8980
|
}
|
|
8895
8981
|
}).on(DragEvents.End, (event, d) => {
|
|
8896
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableX() && !d.removed && this
|
|
8982
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableX() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchSection && d.node) {
|
|
8897
8983
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8898
8984
|
if (this.gridConfig.snap) {
|
|
8899
8985
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
8900
8986
|
}
|
|
8901
8987
|
d.node.stretchSections(Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
8902
|
-
this.
|
|
8903
|
-
this.
|
|
8904
|
-
this.actionStack.add(this
|
|
8905
|
-
this
|
|
8988
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
8989
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
8990
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
8991
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8906
8992
|
}
|
|
8907
8993
|
setCursorStyle();
|
|
8908
8994
|
}));
|
|
@@ -8917,7 +9003,7 @@ class DiagramCanvas {
|
|
|
8917
9003
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8918
9004
|
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableY() && !d.removed && d.node) {
|
|
8919
9005
|
setCursorStyle(CursorStyle.NSResize);
|
|
8920
|
-
this
|
|
9006
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
8921
9007
|
} else {
|
|
8922
9008
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8923
9009
|
}
|
|
@@ -8927,16 +9013,16 @@ class DiagramCanvas {
|
|
|
8927
9013
|
d.node.stretchSections(Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
8928
9014
|
}
|
|
8929
9015
|
}).on(DragEvents.End, (event, d) => {
|
|
8930
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableY() && !d.removed && this
|
|
9016
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchSection && d.node) {
|
|
8931
9017
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8932
9018
|
if (this.gridConfig.snap) {
|
|
8933
9019
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
8934
9020
|
}
|
|
8935
9021
|
d.node.stretchSections(Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
8936
|
-
this.
|
|
8937
|
-
this.
|
|
8938
|
-
this.actionStack.add(this
|
|
8939
|
-
this
|
|
9022
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9023
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9024
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9025
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8940
9026
|
}
|
|
8941
9027
|
setCursorStyle();
|
|
8942
9028
|
}));
|
|
@@ -8951,7 +9037,7 @@ class DiagramCanvas {
|
|
|
8951
9037
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8952
9038
|
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableY() && !d.removed && d.node) {
|
|
8953
9039
|
setCursorStyle(CursorStyle.NSResize);
|
|
8954
|
-
this
|
|
9040
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
8955
9041
|
} else {
|
|
8956
9042
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8957
9043
|
}
|
|
@@ -8961,16 +9047,16 @@ class DiagramCanvas {
|
|
|
8961
9047
|
d.node.stretchSections(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
8962
9048
|
}
|
|
8963
9049
|
}).on(DragEvents.End, (event, d) => {
|
|
8964
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableY() && !d.removed && this
|
|
9050
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchSection && d.node) {
|
|
8965
9051
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8966
9052
|
if (this.gridConfig.snap) {
|
|
8967
9053
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
8968
9054
|
}
|
|
8969
9055
|
d.node.stretchSections(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
8970
|
-
this.
|
|
8971
|
-
this.
|
|
8972
|
-
this.actionStack.add(this
|
|
8973
|
-
this
|
|
9056
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9057
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9058
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9059
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
8974
9060
|
}
|
|
8975
9061
|
setCursorStyle();
|
|
8976
9062
|
}));
|
|
@@ -8985,7 +9071,7 @@ class DiagramCanvas {
|
|
|
8985
9071
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
8986
9072
|
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
|
|
8987
9073
|
setCursorStyle(CursorStyle.NWSEResize);
|
|
8988
|
-
this
|
|
9074
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
8989
9075
|
} else {
|
|
8990
9076
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
8991
9077
|
}
|
|
@@ -8996,17 +9082,17 @@ class DiagramCanvas {
|
|
|
8996
9082
|
d.node.stretchSections(Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
8997
9083
|
}
|
|
8998
9084
|
}).on(DragEvents.End, (event, d) => {
|
|
8999
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this
|
|
9085
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchSection && d.node) {
|
|
9000
9086
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
9001
9087
|
if (this.gridConfig.snap) {
|
|
9002
9088
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
9003
9089
|
}
|
|
9004
9090
|
d.node.stretchSections(Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
9005
9091
|
d.node.stretchSections(Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
9006
|
-
this.
|
|
9007
|
-
this.
|
|
9008
|
-
this.actionStack.add(this
|
|
9009
|
-
this
|
|
9092
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9093
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9094
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9095
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9010
9096
|
}
|
|
9011
9097
|
setCursorStyle();
|
|
9012
9098
|
}));
|
|
@@ -9021,7 +9107,7 @@ class DiagramCanvas {
|
|
|
9021
9107
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
9022
9108
|
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
|
|
9023
9109
|
setCursorStyle(CursorStyle.NESWResize);
|
|
9024
|
-
this
|
|
9110
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
9025
9111
|
} else {
|
|
9026
9112
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
9027
9113
|
}
|
|
@@ -9032,17 +9118,17 @@ class DiagramCanvas {
|
|
|
9032
9118
|
d.node.stretchSections(Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
9033
9119
|
}
|
|
9034
9120
|
}).on(DragEvents.End, (event, d) => {
|
|
9035
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this
|
|
9121
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchSection && d.node) {
|
|
9036
9122
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
9037
9123
|
if (this.gridConfig.snap) {
|
|
9038
9124
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
9039
9125
|
}
|
|
9040
9126
|
d.node.stretchSections(Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
9041
9127
|
d.node.stretchSections(Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
|
|
9042
|
-
this.
|
|
9043
|
-
this.
|
|
9044
|
-
this.actionStack.add(this
|
|
9045
|
-
this
|
|
9128
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9129
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9130
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9131
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9046
9132
|
}
|
|
9047
9133
|
setCursorStyle();
|
|
9048
9134
|
}));
|
|
@@ -9057,7 +9143,7 @@ class DiagramCanvas {
|
|
|
9057
9143
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
9058
9144
|
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
|
|
9059
9145
|
setCursorStyle(CursorStyle.NESWResize);
|
|
9060
|
-
this
|
|
9146
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
9061
9147
|
} else {
|
|
9062
9148
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
9063
9149
|
}
|
|
@@ -9068,17 +9154,17 @@ class DiagramCanvas {
|
|
|
9068
9154
|
d.node.stretchSections(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
9069
9155
|
}
|
|
9070
9156
|
}).on(DragEvents.End, (event, d) => {
|
|
9071
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this
|
|
9157
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchSection && d.node) {
|
|
9072
9158
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
9073
9159
|
if (this.gridConfig.snap) {
|
|
9074
9160
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
9075
9161
|
}
|
|
9076
9162
|
d.node.stretchSections(Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
|
|
9077
9163
|
d.node.stretchSections(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
9078
|
-
this.
|
|
9079
|
-
this.
|
|
9080
|
-
this.actionStack.add(this
|
|
9081
|
-
this
|
|
9164
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9165
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9166
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9167
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9082
9168
|
}
|
|
9083
9169
|
setCursorStyle();
|
|
9084
9170
|
}));
|
|
@@ -9093,7 +9179,7 @@ class DiagramCanvas {
|
|
|
9093
9179
|
}).call(d3.drag().on(DragEvents.Start, (_event, d) => {
|
|
9094
9180
|
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
|
|
9095
9181
|
setCursorStyle(CursorStyle.NWSEResize);
|
|
9096
|
-
this
|
|
9182
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry()), "f");
|
|
9097
9183
|
} else {
|
|
9098
9184
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
9099
9185
|
}
|
|
@@ -9104,17 +9190,17 @@ class DiagramCanvas {
|
|
|
9104
9190
|
d.node.stretchSections(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
9105
9191
|
}
|
|
9106
9192
|
}).on(DragEvents.End, (event, d) => {
|
|
9107
|
-
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this
|
|
9193
|
+
if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction && __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").intent === DiagramActions.StretchSection && d.node) {
|
|
9108
9194
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
9109
9195
|
if (this.gridConfig.snap) {
|
|
9110
9196
|
pointerCoords = this.getClosestGridPoint(pointerCoords);
|
|
9111
9197
|
}
|
|
9112
9198
|
d.node.stretchSections(Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
|
|
9113
9199
|
d.node.stretchSections(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
|
|
9114
|
-
this.
|
|
9115
|
-
this.
|
|
9116
|
-
this.actionStack.add(this
|
|
9117
|
-
this
|
|
9200
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.node.getGeometry();
|
|
9201
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9202
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9203
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9118
9204
|
}
|
|
9119
9205
|
setCursorStyle();
|
|
9120
9206
|
}));
|
|
@@ -9130,7 +9216,7 @@ class DiagramCanvas {
|
|
|
9130
9216
|
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);
|
|
9131
9217
|
}
|
|
9132
9218
|
updatePortsInView(...ids) {
|
|
9133
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-port').data(this.model.ports.filter(e => this
|
|
9219
|
+
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);
|
|
9134
9220
|
const exitSelection = updateSelection.exit();
|
|
9135
9221
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-port ${d.look.lookType}`);
|
|
9136
9222
|
if (ids && ids.length > 0) {
|
|
@@ -9139,28 +9225,28 @@ class DiagramCanvas {
|
|
|
9139
9225
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
9140
9226
|
exitSelection.remove();
|
|
9141
9227
|
enterSelection.on(Events.MouseOver, (_event, d) => {
|
|
9142
|
-
var
|
|
9143
|
-
if (!this
|
|
9228
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
9229
|
+
if (!__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") && !__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9144
9230
|
// if there is an unfinished connection, the port will be highlighted automatically if the pointer is close
|
|
9145
9231
|
this.userHighlight.focusOn(d);
|
|
9146
9232
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
9147
9233
|
}
|
|
9148
|
-
if (this
|
|
9234
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
|
|
9149
9235
|
const canConnectionFinishAtThisPort =
|
|
9150
9236
|
// can start at the starting port
|
|
9151
|
-
this.
|
|
9237
|
+
__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) &&
|
|
9152
9238
|
// can end at the ending port
|
|
9153
|
-
this.
|
|
9239
|
+
__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 ||
|
|
9154
9240
|
// can start at the ending port
|
|
9155
|
-
this.
|
|
9241
|
+
__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 &&
|
|
9156
9242
|
// can end at the starting port
|
|
9157
|
-
this.
|
|
9243
|
+
__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);
|
|
9158
9244
|
if (!canConnectionFinishAtThisPort) {
|
|
9159
9245
|
setCursorStyle(CursorStyle.NoDrop);
|
|
9160
9246
|
}
|
|
9161
9247
|
}
|
|
9162
9248
|
}).on(Events.MouseOut, () => {
|
|
9163
|
-
if (this
|
|
9249
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
|
|
9164
9250
|
setCursorStyle(CursorStyle.Grabbing);
|
|
9165
9251
|
}
|
|
9166
9252
|
}).on(Events.Click, (event, d) => {
|
|
@@ -9173,10 +9259,10 @@ class DiagramCanvas {
|
|
|
9173
9259
|
this.userSelection.toggle(elementToBeToggled);
|
|
9174
9260
|
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
9175
9261
|
}).on(Events.ContextMenu, (event, d) => {
|
|
9176
|
-
if (this
|
|
9262
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9177
9263
|
event.preventDefault();
|
|
9178
9264
|
event.stopPropagation();
|
|
9179
|
-
this
|
|
9265
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
9180
9266
|
return;
|
|
9181
9267
|
}
|
|
9182
9268
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -9194,33 +9280,33 @@ class DiagramCanvas {
|
|
|
9194
9280
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
9195
9281
|
this.diagramEvent$.next(diagramEvent);
|
|
9196
9282
|
}).call(d3.drag().filter(event => {
|
|
9197
|
-
this
|
|
9283
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
9198
9284
|
return true;
|
|
9199
9285
|
}).on(DragEvents.Start, (event, d) => {
|
|
9200
|
-
if (this.multipleSelectionOn || this
|
|
9201
|
-
this.
|
|
9286
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9287
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
9202
9288
|
} else {
|
|
9203
9289
|
if (this.canUserPerformAction(DiagramActions.AddConnection) && (this.allowSharingPorts || d.incomingConnections.filter(c => !c.removed).length === 0 && d.outgoingConnections.filter(c => !c.removed).length === 0) && !d.removed) {
|
|
9204
9290
|
setCursorStyle(CursorStyle.Grabbing);
|
|
9205
|
-
this.
|
|
9291
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startConnection).call(this, d);
|
|
9206
9292
|
// should be true after having called this.startConnection()
|
|
9207
|
-
if (this
|
|
9208
|
-
this
|
|
9293
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
|
|
9294
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionTracer, this.selectCanvasElements().append('path').attr('stroke', 'none').attr('fill', 'none'), "f");
|
|
9209
9295
|
}
|
|
9210
9296
|
} else {
|
|
9211
9297
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
9212
9298
|
}
|
|
9213
9299
|
}
|
|
9214
9300
|
}).on(DragEvents.Drag, (event, d) => {
|
|
9215
|
-
var
|
|
9216
|
-
if (this.multipleSelectionOn || this
|
|
9217
|
-
this.
|
|
9301
|
+
var _b, _c, _d, _e, _f;
|
|
9302
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9303
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
9218
9304
|
} else {
|
|
9219
9305
|
if (this.canUserPerformAction(DiagramActions.AddConnection) && !d.removed) {
|
|
9220
|
-
if (this
|
|
9306
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") !== undefined) {
|
|
9221
9307
|
const endCoords = [event.x, event.y];
|
|
9222
|
-
(
|
|
9223
|
-
const unfinishedConnectionGhostNode = (
|
|
9308
|
+
(_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));
|
|
9309
|
+
const unfinishedConnectionGhostNode = (_e = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionTracer, "f")) === null || _e === void 0 ? void 0 : _e.node();
|
|
9224
9310
|
if (unfinishedConnectionGhostNode) {
|
|
9225
9311
|
let margin = 2;
|
|
9226
9312
|
const unfinishedConnectionTotalLength = unfinishedConnectionGhostNode.getTotalLength();
|
|
@@ -9228,13 +9314,13 @@ class DiagramCanvas {
|
|
|
9228
9314
|
margin = 0;
|
|
9229
9315
|
}
|
|
9230
9316
|
const beforeUnfinishedConnectionEnd = unfinishedConnectionGhostNode.getPointAtLength(unfinishedConnectionTotalLength - margin);
|
|
9231
|
-
this.
|
|
9317
|
+
__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endCoords = [beforeUnfinishedConnectionEnd.x, beforeUnfinishedConnectionEnd.y];
|
|
9232
9318
|
} else {
|
|
9233
9319
|
// if it fails, just use the event coordinates
|
|
9234
|
-
this.
|
|
9320
|
+
__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").endCoords = endCoords;
|
|
9235
9321
|
}
|
|
9236
9322
|
this.updateConnectionsInView(UNFINISHED_CONNECTION_ID);
|
|
9237
|
-
(
|
|
9323
|
+
(_f = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionPort, "f")) === null || _f === void 0 ? void 0 : _f.raise(false);
|
|
9238
9324
|
// highlight closest target port
|
|
9239
9325
|
if (this.model.ports.length > 0) {
|
|
9240
9326
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
@@ -9257,17 +9343,17 @@ class DiagramCanvas {
|
|
|
9257
9343
|
}
|
|
9258
9344
|
}
|
|
9259
9345
|
}).on(DragEvents.End, (event, d) => {
|
|
9260
|
-
var
|
|
9261
|
-
if (this.multipleSelectionOn || this
|
|
9262
|
-
this.
|
|
9346
|
+
var _b;
|
|
9347
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9348
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
9263
9349
|
} else {
|
|
9264
9350
|
if (this.canUserPerformAction(DiagramActions.AddConnection) && !d.removed) {
|
|
9265
|
-
(
|
|
9351
|
+
(_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnectionTracer, "f")) === null || _b === void 0 ? void 0 : _b.remove();
|
|
9266
9352
|
const userHighlight = this.userHighlight.getFocus();
|
|
9267
9353
|
if (userHighlight instanceof DiagramPort) {
|
|
9268
|
-
this.
|
|
9354
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishConnection).call(this, userHighlight);
|
|
9269
9355
|
} else if (userHighlight instanceof DiagramField && userHighlight.rootElement instanceof DiagramPort) {
|
|
9270
|
-
this.
|
|
9356
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishConnection).call(this, userHighlight.rootElement);
|
|
9271
9357
|
} else if (userHighlight instanceof DiagramNode || userHighlight instanceof DiagramSection || userHighlight instanceof DiagramField) {
|
|
9272
9358
|
let targetRootElement;
|
|
9273
9359
|
if (userHighlight instanceof DiagramNode || userHighlight instanceof DiagramSection) {
|
|
@@ -9275,22 +9361,22 @@ class DiagramCanvas {
|
|
|
9275
9361
|
} else if (userHighlight.rootElement instanceof DiagramNode || userHighlight.rootElement instanceof DiagramSection) {
|
|
9276
9362
|
targetRootElement = userHighlight.rootElement;
|
|
9277
9363
|
} else {
|
|
9278
|
-
this.
|
|
9364
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
9279
9365
|
return;
|
|
9280
9366
|
}
|
|
9281
9367
|
const closestPort = targetRootElement.getClosestPortToPoint([event.x, event.y]);
|
|
9282
9368
|
if (closestPort !== undefined) {
|
|
9283
|
-
this.
|
|
9369
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishConnection).call(this, closestPort);
|
|
9284
9370
|
} else {
|
|
9285
|
-
this.
|
|
9371
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
9286
9372
|
}
|
|
9287
9373
|
} else {
|
|
9288
|
-
this.
|
|
9374
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
9289
9375
|
}
|
|
9290
9376
|
}
|
|
9291
9377
|
setCursorStyle();
|
|
9292
9378
|
}
|
|
9293
|
-
this
|
|
9379
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
|
|
9294
9380
|
}));
|
|
9295
9381
|
enterSelection.filter('.image-look').append('image');
|
|
9296
9382
|
initializeLook(enterSelection);
|
|
@@ -9298,9 +9384,9 @@ class DiagramCanvas {
|
|
|
9298
9384
|
updateLook(mergeSelection);
|
|
9299
9385
|
}
|
|
9300
9386
|
updateConnectionsInView(...ids) {
|
|
9301
|
-
const connectionList = this.model.connections.filter(e => this
|
|
9302
|
-
if (this
|
|
9303
|
-
connectionList.push(this
|
|
9387
|
+
const connectionList = this.model.connections.filter(e => __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") !== undefined ? e.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f") : true);
|
|
9388
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) {
|
|
9389
|
+
connectionList.push(__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f"));
|
|
9304
9390
|
}
|
|
9305
9391
|
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-connection').data(connectionList, d => d.id);
|
|
9306
9392
|
const exitSelection = updateSelection.exit();
|
|
@@ -9311,7 +9397,7 @@ class DiagramCanvas {
|
|
|
9311
9397
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
9312
9398
|
exitSelection.remove();
|
|
9313
9399
|
enterSelection.on(Events.MouseOver, (_event, d) => {
|
|
9314
|
-
if (d.end !== undefined && !this
|
|
9400
|
+
if (d.end !== undefined && !__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9315
9401
|
this.userHighlight.focusOn(d);
|
|
9316
9402
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
9317
9403
|
}
|
|
@@ -9324,10 +9410,10 @@ class DiagramCanvas {
|
|
|
9324
9410
|
this.userSelection.toggle(d);
|
|
9325
9411
|
this.diagramEvent$.next(new DiagramSelectionEvent([d], d.selected));
|
|
9326
9412
|
}).on(Events.ContextMenu, (event, d) => {
|
|
9327
|
-
if (this
|
|
9413
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9328
9414
|
event.preventDefault();
|
|
9329
9415
|
event.stopPropagation();
|
|
9330
|
-
this
|
|
9416
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
9331
9417
|
return;
|
|
9332
9418
|
}
|
|
9333
9419
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -9344,14 +9430,14 @@ class DiagramCanvas {
|
|
|
9344
9430
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
9345
9431
|
this.diagramEvent$.next(diagramEvent);
|
|
9346
9432
|
}).call(d3.drag().filter(event => {
|
|
9347
|
-
this
|
|
9433
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
9348
9434
|
return true;
|
|
9349
9435
|
}).on(DragEvents.Start, event => {
|
|
9350
|
-
this.
|
|
9436
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
9351
9437
|
}).on(DragEvents.Drag, event => {
|
|
9352
|
-
this.
|
|
9438
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
9353
9439
|
}).on(DragEvents.End, event => {
|
|
9354
|
-
this.
|
|
9440
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
9355
9441
|
}));
|
|
9356
9442
|
enterSelection.append('path').attr('class', 'diagram-connection-path');
|
|
9357
9443
|
enterSelection.append('path').attr('class', 'diagram-connection-path-box');
|
|
@@ -9367,22 +9453,22 @@ class DiagramCanvas {
|
|
|
9367
9453
|
enterSelection.select('g.diagram-connection-end-label').append('path');
|
|
9368
9454
|
enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
|
|
9369
9455
|
mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
|
|
9370
|
-
var
|
|
9371
|
-
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, (
|
|
9456
|
+
var _b, _c;
|
|
9457
|
+
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);
|
|
9372
9458
|
}).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');
|
|
9373
9459
|
mergeSelection.select('path.diagram-connection-path-box').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, (
|
|
9460
|
+
var _b, _c;
|
|
9461
|
+
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
9462
|
}).attr('stroke', 'transparent')
|
|
9377
9463
|
// allow generating pointer events even when it is transparent
|
|
9378
9464
|
.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');
|
|
9379
9465
|
mergeSelection.data().forEach(connection => {
|
|
9380
|
-
this.
|
|
9381
|
-
this.
|
|
9466
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_updateConnectionLabelsInView).call(this, connection);
|
|
9467
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_updateConnectionMarkersInView).call(this, connection);
|
|
9382
9468
|
});
|
|
9383
9469
|
}
|
|
9384
9470
|
updateFieldsInView(...ids) {
|
|
9385
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-field').data(this.model.fields.filter(e => this
|
|
9471
|
+
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);
|
|
9386
9472
|
const exitSelection = updateSelection.exit();
|
|
9387
9473
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-field');
|
|
9388
9474
|
if (ids && ids.length > 0) {
|
|
@@ -9391,7 +9477,7 @@ class DiagramCanvas {
|
|
|
9391
9477
|
const mergeSelection = enterSelection.merge(updateSelection);
|
|
9392
9478
|
exitSelection.remove();
|
|
9393
9479
|
enterSelection.on(Events.MouseOver, (_event, d) => {
|
|
9394
|
-
if (!this
|
|
9480
|
+
if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9395
9481
|
this.userHighlight.focusOn(d);
|
|
9396
9482
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
9397
9483
|
}
|
|
@@ -9405,10 +9491,10 @@ class DiagramCanvas {
|
|
|
9405
9491
|
this.userSelection.toggle(elementToBeToggled);
|
|
9406
9492
|
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
9407
9493
|
}).on(Events.ContextMenu, (event, d) => {
|
|
9408
|
-
if (this
|
|
9494
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9409
9495
|
event.preventDefault();
|
|
9410
9496
|
event.stopPropagation();
|
|
9411
|
-
this
|
|
9497
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
9412
9498
|
return;
|
|
9413
9499
|
}
|
|
9414
9500
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -9426,15 +9512,14 @@ class DiagramCanvas {
|
|
|
9426
9512
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
9427
9513
|
this.diagramEvent$.next(diagramEvent);
|
|
9428
9514
|
if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.EditField) && d.editable && !d.removed) {
|
|
9429
|
-
this.currentAction = new EditFieldAction(this, d.id, d.text, '');
|
|
9430
9515
|
this.openTextInput(d.id);
|
|
9431
9516
|
}
|
|
9432
9517
|
}).call(d3.drag().filter(event => {
|
|
9433
|
-
this
|
|
9518
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
9434
9519
|
return true;
|
|
9435
9520
|
}).on(DragEvents.Start, (event, d) => {
|
|
9436
|
-
if (this.multipleSelectionOn || this
|
|
9437
|
-
this.
|
|
9521
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9522
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
9438
9523
|
} else {
|
|
9439
9524
|
let node;
|
|
9440
9525
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9443,14 +9528,14 @@ class DiagramCanvas {
|
|
|
9443
9528
|
node = d.rootElement.node;
|
|
9444
9529
|
}
|
|
9445
9530
|
if (node) {
|
|
9446
|
-
this.
|
|
9531
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, node);
|
|
9447
9532
|
} else {
|
|
9448
9533
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
9449
9534
|
}
|
|
9450
9535
|
}
|
|
9451
9536
|
}).on(DragEvents.Drag, (event, d) => {
|
|
9452
|
-
if (this.multipleSelectionOn || this
|
|
9453
|
-
this.
|
|
9537
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9538
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
9454
9539
|
} else {
|
|
9455
9540
|
let node;
|
|
9456
9541
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9459,14 +9544,14 @@ class DiagramCanvas {
|
|
|
9459
9544
|
node = d.rootElement.node;
|
|
9460
9545
|
}
|
|
9461
9546
|
if (node) {
|
|
9462
|
-
this.
|
|
9547
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, node);
|
|
9463
9548
|
} else {
|
|
9464
9549
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
9465
9550
|
}
|
|
9466
9551
|
}
|
|
9467
9552
|
}).on(DragEvents.End, (event, d) => {
|
|
9468
|
-
if (this.multipleSelectionOn || this
|
|
9469
|
-
this.
|
|
9553
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9554
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
9470
9555
|
} else {
|
|
9471
9556
|
let node;
|
|
9472
9557
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9475,24 +9560,24 @@ class DiagramCanvas {
|
|
|
9475
9560
|
node = d.rootElement.node;
|
|
9476
9561
|
}
|
|
9477
9562
|
if (node) {
|
|
9478
|
-
this.
|
|
9563
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, node);
|
|
9479
9564
|
} else {
|
|
9480
9565
|
setCursorStyle();
|
|
9481
9566
|
}
|
|
9482
9567
|
}
|
|
9483
|
-
this
|
|
9568
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
|
|
9484
9569
|
}));
|
|
9485
9570
|
enterSelection.append('text').style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
|
|
9486
9571
|
enterSelection.append('rect');
|
|
9487
9572
|
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 === HorizontalAlign.Center ? d.width / 2 : d.horizontalAlign === HorizontalAlign.Right ? d.width : 0).attr('text-anchor', d => d.horizontalAlign === HorizontalAlign.Center ? 'middle' : d.horizontalAlign === HorizontalAlign.Right ? 'end' : 'start').attr('y', d => d.verticalAlign === VerticalAlign.Center ? d.height / 2 : d.verticalAlign === VerticalAlign.Bottom ? d.height : 0).attr('dominant-baseline', d => d.verticalAlign === VerticalAlign.Center ? 'middle' : d.verticalAlign === 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 => {
|
|
9488
|
-
this.
|
|
9573
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_setFieldTextAndWrap).call(this, d);
|
|
9489
9574
|
});
|
|
9490
9575
|
mergeSelection
|
|
9491
9576
|
// add a transparent rectangle to capture pointer events on the text
|
|
9492
9577
|
.select('rect').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('fill', 'transparent');
|
|
9493
9578
|
}
|
|
9494
9579
|
updateObjectsInView(...ids) {
|
|
9495
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-object').data(this.model.objects.filter(e => this
|
|
9580
|
+
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);
|
|
9496
9581
|
const exitSelection = updateSelection.exit();
|
|
9497
9582
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-object');
|
|
9498
9583
|
if (ids && ids.length > 0) {
|
|
@@ -9502,10 +9587,10 @@ class DiagramCanvas {
|
|
|
9502
9587
|
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);
|
|
9503
9588
|
exitSelection.remove();
|
|
9504
9589
|
enterSelection.on(Events.ContextMenu, (event, d) => {
|
|
9505
|
-
if (this
|
|
9590
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9506
9591
|
event.preventDefault();
|
|
9507
9592
|
event.stopPropagation();
|
|
9508
|
-
this
|
|
9593
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
9509
9594
|
return;
|
|
9510
9595
|
}
|
|
9511
9596
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -9518,24 +9603,24 @@ class DiagramCanvas {
|
|
|
9518
9603
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
9519
9604
|
this.diagramEvent$.next(diagramEvent);
|
|
9520
9605
|
}).call(d3.drag().filter(event => {
|
|
9521
|
-
this
|
|
9606
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
9522
9607
|
return true;
|
|
9523
9608
|
}).on(DragEvents.Start, event => {
|
|
9524
|
-
if (this.multipleSelectionOn || this
|
|
9525
|
-
this.
|
|
9609
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9610
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
9526
9611
|
}
|
|
9527
9612
|
}).on(DragEvents.Drag, event => {
|
|
9528
|
-
if (this.multipleSelectionOn || this
|
|
9529
|
-
this.
|
|
9613
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9614
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
9530
9615
|
}
|
|
9531
9616
|
}).on(DragEvents.End, event => {
|
|
9532
|
-
if (this.multipleSelectionOn || this
|
|
9533
|
-
this.
|
|
9617
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9618
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
9534
9619
|
}
|
|
9535
9620
|
}));
|
|
9536
9621
|
}
|
|
9537
9622
|
updateDecoratorsInView(...ids) {
|
|
9538
|
-
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-decorator').data(this.model.decorators.filter(e => this
|
|
9623
|
+
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);
|
|
9539
9624
|
const exitSelection = updateSelection.exit();
|
|
9540
9625
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-decorator');
|
|
9541
9626
|
if (ids && ids.length > 0) {
|
|
@@ -9545,7 +9630,7 @@ class DiagramCanvas {
|
|
|
9545
9630
|
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);
|
|
9546
9631
|
exitSelection.remove();
|
|
9547
9632
|
enterSelection.on(Events.MouseOver, (_event, d) => {
|
|
9548
|
-
if (!this
|
|
9633
|
+
if (!__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9549
9634
|
this.userHighlight.focusOn(d);
|
|
9550
9635
|
this.diagramEvent$.next(new DiagramHighlightedEvent(d));
|
|
9551
9636
|
}
|
|
@@ -9561,10 +9646,10 @@ class DiagramCanvas {
|
|
|
9561
9646
|
this.diagramEvent$.next(new DiagramSelectionEvent([elementToBeToggled], elementToBeToggled.selected));
|
|
9562
9647
|
}
|
|
9563
9648
|
}).on(Events.ContextMenu, (event, d) => {
|
|
9564
|
-
if (this
|
|
9649
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_dragging, "f")) {
|
|
9565
9650
|
event.preventDefault();
|
|
9566
9651
|
event.stopPropagation();
|
|
9567
|
-
this
|
|
9652
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
9568
9653
|
return;
|
|
9569
9654
|
}
|
|
9570
9655
|
const diagramEvent = new DiagramSecondaryClickEvent(event, d);
|
|
@@ -9584,11 +9669,11 @@ class DiagramCanvas {
|
|
|
9584
9669
|
const diagramEvent = new DiagramDoubleClickEvent(event, d);
|
|
9585
9670
|
this.diagramEvent$.next(diagramEvent);
|
|
9586
9671
|
}).call(d3.drag().filter(event => {
|
|
9587
|
-
this
|
|
9672
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, isSecondaryButton(event), "f");
|
|
9588
9673
|
return true;
|
|
9589
9674
|
}).on(DragEvents.Start, (event, d) => {
|
|
9590
|
-
if (this.multipleSelectionOn || this
|
|
9591
|
-
this.
|
|
9675
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9676
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMultipleSelection).call(this, event);
|
|
9592
9677
|
} else {
|
|
9593
9678
|
let node;
|
|
9594
9679
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9597,14 +9682,14 @@ class DiagramCanvas {
|
|
|
9597
9682
|
node = d.rootElement.node;
|
|
9598
9683
|
}
|
|
9599
9684
|
if (node) {
|
|
9600
|
-
this.
|
|
9685
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_startMovingNode).call(this, event, node);
|
|
9601
9686
|
} else {
|
|
9602
9687
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
9603
9688
|
}
|
|
9604
9689
|
}
|
|
9605
9690
|
}).on(DragEvents.Drag, (event, d) => {
|
|
9606
|
-
if (this.multipleSelectionOn || this
|
|
9607
|
-
this.
|
|
9691
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9692
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMultipleSelection).call(this, event);
|
|
9608
9693
|
} else {
|
|
9609
9694
|
let node;
|
|
9610
9695
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9613,14 +9698,14 @@ class DiagramCanvas {
|
|
|
9613
9698
|
node = d.rootElement.node;
|
|
9614
9699
|
}
|
|
9615
9700
|
if (node) {
|
|
9616
|
-
this.
|
|
9701
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_continueMovingNode).call(this, event, node);
|
|
9617
9702
|
} else {
|
|
9618
9703
|
setCursorStyle(CursorStyle.NotAllowed);
|
|
9619
9704
|
}
|
|
9620
9705
|
}
|
|
9621
9706
|
}).on(DragEvents.End, (event, d) => {
|
|
9622
|
-
if (this.multipleSelectionOn || this
|
|
9623
|
-
this.
|
|
9707
|
+
if (this.multipleSelectionOn || __classPrivateFieldGet(this, _DiagramCanvas_secondaryButton, "f")) {
|
|
9708
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMultipleSelection).call(this, event);
|
|
9624
9709
|
} else {
|
|
9625
9710
|
let node;
|
|
9626
9711
|
if (d.rootElement instanceof DiagramNode) {
|
|
@@ -9629,165 +9714,14 @@ class DiagramCanvas {
|
|
|
9629
9714
|
node = d.rootElement.node;
|
|
9630
9715
|
}
|
|
9631
9716
|
if (node) {
|
|
9632
|
-
this.
|
|
9717
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_finishMovingNode).call(this, event, node);
|
|
9633
9718
|
} else {
|
|
9634
9719
|
setCursorStyle();
|
|
9635
9720
|
}
|
|
9636
9721
|
}
|
|
9637
|
-
this
|
|
9722
|
+
__classPrivateFieldSet(this, _DiagramCanvas_secondaryButton, false, "f");
|
|
9638
9723
|
}));
|
|
9639
9724
|
}
|
|
9640
|
-
updateConnectionLabelsInView(connection) {
|
|
9641
|
-
var _a, _b, _c;
|
|
9642
|
-
const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
|
|
9643
|
-
const pathSelection = connectionSelection.select('path');
|
|
9644
|
-
const pathNode = pathSelection.node();
|
|
9645
|
-
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), connection.type.label);
|
|
9646
|
-
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
9647
|
-
if (pathNode) {
|
|
9648
|
-
const pathLength = pathNode.getTotalLength();
|
|
9649
|
-
let startLabelShiftX = 0;
|
|
9650
|
-
let startLabelShiftY = 0;
|
|
9651
|
-
let middleLabelShiftX = 0;
|
|
9652
|
-
let middleLabelShiftY = 0;
|
|
9653
|
-
let endLabelShiftX = 0;
|
|
9654
|
-
let endLabelShiftY = 0;
|
|
9655
|
-
if (labelConfiguration.look.fillColor === 'transparent') {
|
|
9656
|
-
// background color is transparent / not set, so we find an alternative position for the label
|
|
9657
|
-
const deltaX = connection.endCoords[0] - connection.startCoords[0];
|
|
9658
|
-
const deltaY = connection.endCoords[1] - connection.startCoords[1];
|
|
9659
|
-
switch (connection.startDirection) {
|
|
9660
|
-
case Side.Top:
|
|
9661
|
-
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
9662
|
-
endLabelShiftX = startLabelShiftX;
|
|
9663
|
-
break;
|
|
9664
|
-
case Side.Bottom:
|
|
9665
|
-
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
9666
|
-
endLabelShiftX = startLabelShiftX;
|
|
9667
|
-
break;
|
|
9668
|
-
case Side.Left:
|
|
9669
|
-
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9670
|
-
endLabelShiftY = startLabelShiftY;
|
|
9671
|
-
break;
|
|
9672
|
-
case Side.Right:
|
|
9673
|
-
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9674
|
-
endLabelShiftY = startLabelShiftY;
|
|
9675
|
-
break;
|
|
9676
|
-
default:
|
|
9677
|
-
startLabelShiftX = 0.5;
|
|
9678
|
-
endLabelShiftX = startLabelShiftX;
|
|
9679
|
-
startLabelShiftY = -0.5;
|
|
9680
|
-
endLabelShiftY = startLabelShiftY;
|
|
9681
|
-
}
|
|
9682
|
-
switch (connection.endDirection) {
|
|
9683
|
-
case Side.Top:
|
|
9684
|
-
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
9685
|
-
break;
|
|
9686
|
-
case Side.Bottom:
|
|
9687
|
-
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
9688
|
-
break;
|
|
9689
|
-
case Side.Left:
|
|
9690
|
-
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
9691
|
-
break;
|
|
9692
|
-
case Side.Right:
|
|
9693
|
-
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
9694
|
-
break;
|
|
9695
|
-
default:
|
|
9696
|
-
endLabelShiftX = 0.5;
|
|
9697
|
-
endLabelShiftY = -0.5;
|
|
9698
|
-
}
|
|
9699
|
-
if (Math.abs(deltaX) >= Math.abs(deltaY)) {
|
|
9700
|
-
// horizontal quadrant
|
|
9701
|
-
middleLabelShiftX = deltaX > 0 ? -0.5 : 0.5;
|
|
9702
|
-
middleLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
9703
|
-
} else {
|
|
9704
|
-
// vertical quadrant
|
|
9705
|
-
middleLabelShiftX = deltaX > 0 ? 0.5 : -0.5;
|
|
9706
|
-
middleLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9707
|
-
}
|
|
9708
|
-
}
|
|
9709
|
-
// bind start labels
|
|
9710
|
-
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);
|
|
9711
|
-
const startLabelBoundingRect = (_a = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
9712
|
-
if (startLabelBoundingRect) {
|
|
9713
|
-
// don't create space for the label if the label is empty
|
|
9714
|
-
const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
9715
|
-
const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
9716
|
-
let pathStartLabelPoint;
|
|
9717
|
-
switch (connection.startDirection) {
|
|
9718
|
-
case Side.Left:
|
|
9719
|
-
pathStartLabelPoint = pathNode.getPointAtLength(getRightMargin(labelConfiguration) + boundingWidth / 2);
|
|
9720
|
-
break;
|
|
9721
|
-
case Side.Right:
|
|
9722
|
-
pathStartLabelPoint = pathNode.getPointAtLength(getLeftMargin(labelConfiguration) + boundingWidth / 2);
|
|
9723
|
-
break;
|
|
9724
|
-
case Side.Top:
|
|
9725
|
-
pathStartLabelPoint = pathNode.getPointAtLength(getBottomMargin(labelConfiguration) + boundingHeight / 2);
|
|
9726
|
-
break;
|
|
9727
|
-
case Side.Bottom:
|
|
9728
|
-
pathStartLabelPoint = pathNode.getPointAtLength(getTopMargin(labelConfiguration) + boundingHeight / 2);
|
|
9729
|
-
break;
|
|
9730
|
-
default:
|
|
9731
|
-
pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
9732
|
-
}
|
|
9733
|
-
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');
|
|
9734
|
-
connectionSelection.select('g.diagram-connection-start-label').attr('transform', `translate(${pathStartLabelPoint.x + startLabelShiftX * boundingWidth},${pathStartLabelPoint.y + startLabelShiftY * boundingHeight})`);
|
|
9735
|
-
}
|
|
9736
|
-
// bind middle labels
|
|
9737
|
-
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);
|
|
9738
|
-
const middleLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
9739
|
-
if (middleLabelBoundingRect) {
|
|
9740
|
-
// don't create space for the label if the label is empty
|
|
9741
|
-
const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
9742
|
-
const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
9743
|
-
const pathMiddleLabelPoint = pathNode.getPointAtLength(pathLength / 2);
|
|
9744
|
-
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');
|
|
9745
|
-
connectionSelection.select('g.diagram-connection-middle-label').attr('transform', `translate(${pathMiddleLabelPoint.x + middleLabelShiftX * boundingWidth},${pathMiddleLabelPoint.y + middleLabelShiftY * boundingHeight})`);
|
|
9746
|
-
}
|
|
9747
|
-
// bind end labels
|
|
9748
|
-
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);
|
|
9749
|
-
const endLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
9750
|
-
if (endLabelBoundingRect) {
|
|
9751
|
-
// don't create space for the label if the label is empty
|
|
9752
|
-
const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / this.zoomTransform.k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
9753
|
-
const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / this.zoomTransform.k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
9754
|
-
let pathEndLabelPoint;
|
|
9755
|
-
switch (connection.endDirection) {
|
|
9756
|
-
case Side.Left:
|
|
9757
|
-
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getRightMargin(labelConfiguration) + boundingWidth / 2));
|
|
9758
|
-
break;
|
|
9759
|
-
case Side.Right:
|
|
9760
|
-
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getLeftMargin(labelConfiguration) + boundingWidth / 2));
|
|
9761
|
-
break;
|
|
9762
|
-
case Side.Top:
|
|
9763
|
-
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
9764
|
-
break;
|
|
9765
|
-
case Side.Bottom:
|
|
9766
|
-
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getTopMargin(labelConfiguration) + boundingHeight / 2));
|
|
9767
|
-
break;
|
|
9768
|
-
default:
|
|
9769
|
-
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
9770
|
-
}
|
|
9771
|
-
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');
|
|
9772
|
-
connectionSelection.select('g.diagram-connection-end-label').attr('transform', `translate(${pathEndLabelPoint.x + endLabelShiftX * boundingWidth},${pathEndLabelPoint.y + endLabelShiftY * boundingHeight})`);
|
|
9773
|
-
}
|
|
9774
|
-
}
|
|
9775
|
-
}
|
|
9776
|
-
updateConnectionMarkersInView(connection) {
|
|
9777
|
-
const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
|
|
9778
|
-
const startMarkerSelection = connectionSelection.select('marker.diagram-connection-start-marker');
|
|
9779
|
-
const endMarkerSelection = connectionSelection.select('marker.diagram-connection-end-marker');
|
|
9780
|
-
if (connection.startMarkerLook !== null) {
|
|
9781
|
-
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);
|
|
9782
|
-
} else {
|
|
9783
|
-
startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
|
|
9784
|
-
}
|
|
9785
|
-
if (connection.endMarkerLook !== null) {
|
|
9786
|
-
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);
|
|
9787
|
-
} else {
|
|
9788
|
-
endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
|
|
9789
|
-
}
|
|
9790
|
-
}
|
|
9791
9725
|
bringToFront(node) {
|
|
9792
9726
|
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]]));
|
|
9793
9727
|
let maximumZ = node.z;
|
|
@@ -9803,10 +9737,10 @@ class DiagramCanvas {
|
|
|
9803
9737
|
}));
|
|
9804
9738
|
node.raiseWithZ();
|
|
9805
9739
|
action.to = node.getGeometry();
|
|
9806
|
-
this
|
|
9807
|
-
this.
|
|
9808
|
-
this.actionStack.add(this
|
|
9809
|
-
this
|
|
9740
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, action, "f");
|
|
9741
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9742
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9743
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9810
9744
|
}
|
|
9811
9745
|
sendToBack(node) {
|
|
9812
9746
|
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]]));
|
|
@@ -9823,33 +9757,33 @@ class DiagramCanvas {
|
|
|
9823
9757
|
}));
|
|
9824
9758
|
node.raiseWithZ();
|
|
9825
9759
|
action.to = node.getGeometry();
|
|
9826
|
-
this
|
|
9827
|
-
this.
|
|
9828
|
-
this.actionStack.add(this
|
|
9829
|
-
this
|
|
9760
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, action, "f");
|
|
9761
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9762
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9763
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9830
9764
|
}
|
|
9831
9765
|
fieldRootFitsInView(id) {
|
|
9832
|
-
var
|
|
9766
|
+
var _b, _c, _d, _e;
|
|
9833
9767
|
const field = this.model.fields.get(id);
|
|
9834
9768
|
if (!field) {
|
|
9835
9769
|
return false;
|
|
9836
9770
|
}
|
|
9837
9771
|
if (field.rootElement instanceof DiagramNode || field.rootElement instanceof DiagramSection) {
|
|
9838
|
-
const fieldDimensions = this.
|
|
9839
|
-
const stretchX = fieldDimensions[0] + getLeftMargin((
|
|
9840
|
-
const stretchY = fieldDimensions[1] + getTopMargin((
|
|
9772
|
+
const fieldDimensions = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
|
|
9773
|
+
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;
|
|
9774
|
+
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;
|
|
9841
9775
|
return stretchX <= 0 && stretchY <= 0;
|
|
9842
9776
|
}
|
|
9843
9777
|
return true;
|
|
9844
9778
|
}
|
|
9845
9779
|
fitFieldRootInView(id, shrink = true) {
|
|
9846
|
-
var
|
|
9780
|
+
var _b, _c, _d;
|
|
9847
9781
|
const field = this.model.fields.get(id);
|
|
9848
9782
|
if (!field) {
|
|
9849
9783
|
return;
|
|
9850
9784
|
}
|
|
9851
9785
|
if (field.rootElement instanceof DiagramNode) {
|
|
9852
|
-
const fieldDimensions = this.
|
|
9786
|
+
const fieldDimensions = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
|
|
9853
9787
|
let stretchX = fieldDimensions[0] + getLeftMargin(field.rootElement.type.label) + getRightMargin(field.rootElement.type.label) - field.rootElement.width;
|
|
9854
9788
|
let stretchY = fieldDimensions[1] + getTopMargin(field.rootElement.type.label) + getBottomMargin(field.rootElement.type.label) - field.rootElement.height;
|
|
9855
9789
|
const spacingX = getGridSpacingX(this.gridConfig);
|
|
@@ -9875,15 +9809,15 @@ class DiagramCanvas {
|
|
|
9875
9809
|
}
|
|
9876
9810
|
}
|
|
9877
9811
|
if (field.rootElement instanceof DiagramSection) {
|
|
9878
|
-
const fieldDimensions = this.
|
|
9812
|
+
const fieldDimensions = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
|
|
9879
9813
|
let minimumFieldWidth = fieldDimensions[0];
|
|
9880
9814
|
let minimumFieldHeight = fieldDimensions[1];
|
|
9881
|
-
for (const section of ((
|
|
9815
|
+
for (const section of ((_b = field.rootElement.node) === null || _b === void 0 ? void 0 : _b.sections) || []) {
|
|
9882
9816
|
if (section.label) {
|
|
9883
9817
|
if (section.indexXInNode === field.rootElement.indexXInNode && section.indexYInNode !== field.rootElement.indexYInNode) {
|
|
9884
|
-
minimumFieldWidth = Math.max(minimumFieldWidth, this.
|
|
9818
|
+
minimumFieldWidth = Math.max(minimumFieldWidth, __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, section.label)[0]);
|
|
9885
9819
|
} else if (section.indexXInNode !== field.rootElement.indexXInNode && section.indexYInNode === field.rootElement.indexYInNode) {
|
|
9886
|
-
minimumFieldHeight = Math.max(minimumFieldHeight, this.
|
|
9820
|
+
minimumFieldHeight = Math.max(minimumFieldHeight, __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, section.label)[1]);
|
|
9887
9821
|
}
|
|
9888
9822
|
}
|
|
9889
9823
|
}
|
|
@@ -9912,25 +9846,25 @@ class DiagramCanvas {
|
|
|
9912
9846
|
stretchY = (field.rootElement.getMinHeight() || 0) - field.rootElement.height;
|
|
9913
9847
|
}
|
|
9914
9848
|
if (shrink || stretchX > 0) {
|
|
9915
|
-
(
|
|
9849
|
+
(_c = field.rootElement.node) === null || _c === void 0 ? void 0 : _c.stretchSections(Side.Right, stretchX, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
|
|
9916
9850
|
}
|
|
9917
9851
|
if (shrink || stretchY > 0) {
|
|
9918
|
-
(
|
|
9852
|
+
(_d = field.rootElement.node) === null || _d === void 0 ? void 0 : _d.stretchSections(Side.Bottom, stretchY, field.rootElement.indexXInNode, field.rootElement.indexYInNode);
|
|
9919
9853
|
}
|
|
9920
9854
|
}
|
|
9921
9855
|
}
|
|
9922
9856
|
fitNodeInView(id, shrink = true) {
|
|
9923
|
-
var
|
|
9857
|
+
var _b, _c;
|
|
9924
9858
|
const node = this.model.nodes.get(id);
|
|
9925
9859
|
if (!node) {
|
|
9926
9860
|
return;
|
|
9927
9861
|
}
|
|
9928
|
-
if (node.sections.length > 0 && this
|
|
9862
|
+
if (node.sections.length > 0 && __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f")) {
|
|
9929
9863
|
let newNodeWidth = 0;
|
|
9930
9864
|
let newNodeHeight = 0;
|
|
9931
9865
|
// calculate newNodeWidth, newNodeHeight as the rightmost and bottommost points of any of the sections of the node
|
|
9932
9866
|
for (const section of node.sections) {
|
|
9933
|
-
if (section.getPriority() >= this
|
|
9867
|
+
if (section.getPriority() >= __classPrivateFieldGet(this, _DiagramCanvas_priorityThreshold, "f")) {
|
|
9934
9868
|
const sectionLastXCoordRelativeToNode = section.coords[0] + section.width - node.coords[0];
|
|
9935
9869
|
const sectionLastYCoordRelativeToNode = section.coords[1] + section.height - node.coords[1];
|
|
9936
9870
|
newNodeWidth = Math.max(newNodeWidth, sectionLastXCoordRelativeToNode);
|
|
@@ -9938,8 +9872,8 @@ class DiagramCanvas {
|
|
|
9938
9872
|
}
|
|
9939
9873
|
}
|
|
9940
9874
|
// add the margin that goes between the rightmost and bottommost points of the sections and the edge of the node
|
|
9941
|
-
newNodeWidth += ((
|
|
9942
|
-
newNodeHeight += ((
|
|
9875
|
+
newNodeWidth += ((_b = node.type.sectionGrid) === null || _b === void 0 ? void 0 : _b.margin) || 0;
|
|
9876
|
+
newNodeHeight += ((_c = node.type.sectionGrid) === null || _c === void 0 ? void 0 : _c.margin) || 0;
|
|
9943
9877
|
if (shrink || newNodeWidth > node.width) {
|
|
9944
9878
|
node.stretch(Side.Right, newNodeWidth - node.width);
|
|
9945
9879
|
}
|
|
@@ -9949,7 +9883,7 @@ class DiagramCanvas {
|
|
|
9949
9883
|
}
|
|
9950
9884
|
}
|
|
9951
9885
|
selectRoot() {
|
|
9952
|
-
return d3.select(this
|
|
9886
|
+
return d3.select(__classPrivateFieldGet(this, _DiagramCanvas_diagramRoot, "f"));
|
|
9953
9887
|
}
|
|
9954
9888
|
selectSVGElement() {
|
|
9955
9889
|
return this.selectRoot().select('svg');
|
|
@@ -9960,107 +9894,10 @@ class DiagramCanvas {
|
|
|
9960
9894
|
selectCanvasElements() {
|
|
9961
9895
|
return this.selectCanvasView().select(`.daga-canvas-elements`);
|
|
9962
9896
|
}
|
|
9963
|
-
// User actions
|
|
9964
|
-
startConnection(port) {
|
|
9965
|
-
var _a, _b, _c, _d;
|
|
9966
|
-
if (port.allowsOutgoing || port.allowsIncoming) {
|
|
9967
|
-
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)) {
|
|
9968
|
-
this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
9969
|
-
this.unfinishedConnectionPort = port;
|
|
9970
|
-
} else {
|
|
9971
|
-
if (this.inferConnectionType) {
|
|
9972
|
-
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
9973
|
-
var _a, _b;
|
|
9974
|
-
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) || '');
|
|
9975
|
-
});
|
|
9976
|
-
if (differentConnectionType === undefined) {
|
|
9977
|
-
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
9978
|
-
var _a, _b;
|
|
9979
|
-
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) || '');
|
|
9980
|
-
});
|
|
9981
|
-
}
|
|
9982
|
-
if (differentConnectionType !== undefined) {
|
|
9983
|
-
this.unfinishedConnection = new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
9984
|
-
this.unfinishedConnectionPort = port;
|
|
9985
|
-
}
|
|
9986
|
-
}
|
|
9987
|
-
}
|
|
9988
|
-
}
|
|
9989
|
-
}
|
|
9990
|
-
finishConnection(port) {
|
|
9991
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
9992
|
-
this.userHighlight.clear();
|
|
9993
|
-
if (this.unfinishedConnection !== undefined) {
|
|
9994
|
-
if (!this.allowConnectionLoops && this.unfinishedConnection.start === port) {
|
|
9995
|
-
this.dropConnection();
|
|
9996
|
-
return;
|
|
9997
|
-
}
|
|
9998
|
-
if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
|
|
9999
|
-
this.dropConnection();
|
|
10000
|
-
return;
|
|
10001
|
-
}
|
|
10002
|
-
if (!this.allowSharingBothPorts && this.model.connections.find(c => {
|
|
10003
|
-
var _a, _b;
|
|
10004
|
-
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);
|
|
10005
|
-
}) !== undefined) {
|
|
10006
|
-
this.dropConnection();
|
|
10007
|
-
return;
|
|
10008
|
-
}
|
|
10009
|
-
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) {
|
|
10010
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, (_j = this.unfinishedConnection.start) === null || _j === void 0 ? void 0 : _j.id, port.id);
|
|
10011
|
-
// clean up the previous unfinished connection
|
|
10012
|
-
this.dropConnection();
|
|
10013
|
-
addConnectionAction.do();
|
|
10014
|
-
this.actionStack.add(addConnectionAction);
|
|
10015
|
-
} 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) {
|
|
10016
|
-
const addConnectionAction = new AddConnectionAction(this, this.unfinishedConnection.type, port.id, (_t = this.unfinishedConnection.start) === null || _t === void 0 ? void 0 : _t.id);
|
|
10017
|
-
// clean up the previous unfinished connection
|
|
10018
|
-
this.dropConnection();
|
|
10019
|
-
addConnectionAction.do();
|
|
10020
|
-
this.actionStack.add(addConnectionAction);
|
|
10021
|
-
} else {
|
|
10022
|
-
if (this.inferConnectionType) {
|
|
10023
|
-
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
10024
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10025
|
-
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;
|
|
10026
|
-
});
|
|
10027
|
-
let invertConnection = false;
|
|
10028
|
-
if (differentConnectionType === undefined) {
|
|
10029
|
-
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
10030
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
10031
|
-
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;
|
|
10032
|
-
});
|
|
10033
|
-
invertConnection = true;
|
|
10034
|
-
}
|
|
10035
|
-
if (differentConnectionType !== undefined) {
|
|
10036
|
-
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);
|
|
10037
|
-
// clean up the previous unfinished connection
|
|
10038
|
-
this.dropConnection();
|
|
10039
|
-
addConnectionAction.do();
|
|
10040
|
-
this.actionStack.add(addConnectionAction);
|
|
10041
|
-
} else {
|
|
10042
|
-
// error: connection target of wrong type and no allowed type can be found
|
|
10043
|
-
this.dropConnection();
|
|
10044
|
-
}
|
|
10045
|
-
} else {
|
|
10046
|
-
// error: connection target of wrong type and can't guess for a different type
|
|
10047
|
-
this.dropConnection();
|
|
10048
|
-
}
|
|
10049
|
-
}
|
|
10050
|
-
}
|
|
10051
|
-
}
|
|
10052
|
-
dropConnection() {
|
|
10053
|
-
var _a, _b, _c, _d;
|
|
10054
|
-
(_a = this.unfinishedConnection) === null || _a === void 0 ? void 0 : _a.setStart(undefined);
|
|
10055
|
-
(_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.setEnd(undefined);
|
|
10056
|
-
(_d = (_c = this.unfinishedConnection) === null || _c === void 0 ? void 0 : _c.select()) === null || _d === void 0 ? void 0 : _d.remove();
|
|
10057
|
-
this.unfinishedConnection = undefined;
|
|
10058
|
-
this.unfinishedConnectionPort = undefined;
|
|
10059
|
-
}
|
|
10060
9897
|
cancelAllUserActions() {
|
|
10061
|
-
this
|
|
10062
|
-
this.
|
|
10063
|
-
this.
|
|
9898
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
9899
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
9900
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
|
|
10064
9901
|
this.contextMenu.close();
|
|
10065
9902
|
this.userSelection.clear();
|
|
10066
9903
|
}
|
|
@@ -10070,7 +9907,8 @@ class DiagramCanvas {
|
|
|
10070
9907
|
openTextInput(id) {
|
|
10071
9908
|
const field = this.model.fields.get(id);
|
|
10072
9909
|
if (field) {
|
|
10073
|
-
this
|
|
9910
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new EditFieldAction(this, field.id, field.text, ''), "f");
|
|
9911
|
+
__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, () => {
|
|
10074
9912
|
// (_text)
|
|
10075
9913
|
/*
|
|
10076
9914
|
Empty for now
|
|
@@ -10079,257 +9917,483 @@ class DiagramCanvas {
|
|
|
10079
9917
|
*/
|
|
10080
9918
|
}, text => {
|
|
10081
9919
|
field.text = text;
|
|
10082
|
-
if (this
|
|
10083
|
-
this.
|
|
10084
|
-
this.
|
|
10085
|
-
this.actionStack.add(this
|
|
10086
|
-
this
|
|
9920
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof EditFieldAction) {
|
|
9921
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = text;
|
|
9922
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
9923
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
9924
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
10087
9925
|
}
|
|
10088
9926
|
});
|
|
10089
9927
|
}
|
|
10090
9928
|
}
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10098
|
-
|
|
10099
|
-
|
|
10100
|
-
|
|
10101
|
-
|
|
10102
|
-
|
|
10103
|
-
|
|
10104
|
-
|
|
10105
|
-
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10123
|
-
|
|
10124
|
-
|
|
10125
|
-
|
|
10126
|
-
|
|
10127
|
-
|
|
10128
|
-
|
|
9929
|
+
}
|
|
9930
|
+
_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) {
|
|
9931
|
+
var _b, _c, _d;
|
|
9932
|
+
const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
|
|
9933
|
+
const pathSelection = connectionSelection.select('path');
|
|
9934
|
+
const pathNode = pathSelection.node();
|
|
9935
|
+
const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), connection.type.label);
|
|
9936
|
+
labelConfiguration.look = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS.look), labelConfiguration.look);
|
|
9937
|
+
if (pathNode) {
|
|
9938
|
+
const pathLength = pathNode.getTotalLength();
|
|
9939
|
+
let startLabelShiftX = 0;
|
|
9940
|
+
let startLabelShiftY = 0;
|
|
9941
|
+
let middleLabelShiftX = 0;
|
|
9942
|
+
let middleLabelShiftY = 0;
|
|
9943
|
+
let endLabelShiftX = 0;
|
|
9944
|
+
let endLabelShiftY = 0;
|
|
9945
|
+
if (labelConfiguration.look.fillColor === 'transparent') {
|
|
9946
|
+
// background color is transparent / not set, so we find an alternative position for the label
|
|
9947
|
+
const deltaX = connection.endCoords[0] - connection.startCoords[0];
|
|
9948
|
+
const deltaY = connection.endCoords[1] - connection.startCoords[1];
|
|
9949
|
+
switch (connection.startDirection) {
|
|
9950
|
+
case Side.Top:
|
|
9951
|
+
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
9952
|
+
endLabelShiftX = startLabelShiftX;
|
|
9953
|
+
break;
|
|
9954
|
+
case Side.Bottom:
|
|
9955
|
+
startLabelShiftX = deltaX >= 0 ? -0.5 : 0.5;
|
|
9956
|
+
endLabelShiftX = startLabelShiftX;
|
|
9957
|
+
break;
|
|
9958
|
+
case Side.Left:
|
|
9959
|
+
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9960
|
+
endLabelShiftY = startLabelShiftY;
|
|
9961
|
+
break;
|
|
9962
|
+
case Side.Right:
|
|
9963
|
+
startLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9964
|
+
endLabelShiftY = startLabelShiftY;
|
|
9965
|
+
break;
|
|
9966
|
+
default:
|
|
9967
|
+
startLabelShiftX = 0.5;
|
|
9968
|
+
endLabelShiftX = startLabelShiftX;
|
|
9969
|
+
startLabelShiftY = -0.5;
|
|
9970
|
+
endLabelShiftY = startLabelShiftY;
|
|
10129
9971
|
}
|
|
10130
|
-
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
9972
|
+
switch (connection.endDirection) {
|
|
9973
|
+
case Side.Top:
|
|
9974
|
+
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
9975
|
+
break;
|
|
9976
|
+
case Side.Bottom:
|
|
9977
|
+
endLabelShiftX = deltaX >= 0 ? 0.5 : -0.5;
|
|
9978
|
+
break;
|
|
9979
|
+
case Side.Left:
|
|
9980
|
+
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
9981
|
+
break;
|
|
9982
|
+
case Side.Right:
|
|
9983
|
+
endLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
9984
|
+
break;
|
|
9985
|
+
default:
|
|
9986
|
+
endLabelShiftX = 0.5;
|
|
9987
|
+
endLabelShiftY = -0.5;
|
|
10137
9988
|
}
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
9989
|
+
if (Math.abs(deltaX) >= Math.abs(deltaY)) {
|
|
9990
|
+
// horizontal quadrant
|
|
9991
|
+
middleLabelShiftX = deltaX > 0 ? -0.5 : 0.5;
|
|
9992
|
+
middleLabelShiftY = deltaY > 0 ? 0.5 : -0.5;
|
|
9993
|
+
} else {
|
|
9994
|
+
// vertical quadrant
|
|
9995
|
+
middleLabelShiftX = deltaX > 0 ? 0.5 : -0.5;
|
|
9996
|
+
middleLabelShiftY = deltaY > 0 ? -0.5 : 0.5;
|
|
9997
|
+
}
|
|
9998
|
+
}
|
|
9999
|
+
// bind start labels
|
|
10000
|
+
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);
|
|
10001
|
+
const startLabelBoundingRect = (_b = connectionSelection.select('g.diagram-connection-start-label text').node()) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
|
|
10002
|
+
if (startLabelBoundingRect) {
|
|
10003
|
+
// don't create space for the label if the label is empty
|
|
10004
|
+
const boundingWidth = !connection.startLabel ? 0 : startLabelBoundingRect.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
10005
|
+
const boundingHeight = !connection.startLabel ? 0 : startLabelBoundingRect.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
10006
|
+
let pathStartLabelPoint;
|
|
10007
|
+
switch (connection.startDirection) {
|
|
10008
|
+
case Side.Left:
|
|
10009
|
+
pathStartLabelPoint = pathNode.getPointAtLength(getRightMargin(labelConfiguration) + boundingWidth / 2);
|
|
10010
|
+
break;
|
|
10011
|
+
case Side.Right:
|
|
10012
|
+
pathStartLabelPoint = pathNode.getPointAtLength(getLeftMargin(labelConfiguration) + boundingWidth / 2);
|
|
10013
|
+
break;
|
|
10014
|
+
case Side.Top:
|
|
10015
|
+
pathStartLabelPoint = pathNode.getPointAtLength(getBottomMargin(labelConfiguration) + boundingHeight / 2);
|
|
10016
|
+
break;
|
|
10017
|
+
case Side.Bottom:
|
|
10018
|
+
pathStartLabelPoint = pathNode.getPointAtLength(getTopMargin(labelConfiguration) + boundingHeight / 2);
|
|
10019
|
+
break;
|
|
10020
|
+
default:
|
|
10021
|
+
pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
10022
|
+
}
|
|
10023
|
+
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');
|
|
10024
|
+
connectionSelection.select('g.diagram-connection-start-label').attr('transform', `translate(${pathStartLabelPoint.x + startLabelShiftX * boundingWidth},${pathStartLabelPoint.y + startLabelShiftY * boundingHeight})`);
|
|
10025
|
+
}
|
|
10026
|
+
// bind middle labels
|
|
10027
|
+
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);
|
|
10028
|
+
const middleLabelBoundingRect = (_c = connectionSelection.select('g.diagram-connection-middle-label text').node()) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect();
|
|
10029
|
+
if (middleLabelBoundingRect) {
|
|
10030
|
+
// don't create space for the label if the label is empty
|
|
10031
|
+
const boundingWidth = !connection.middleLabel ? 0 : middleLabelBoundingRect.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
10032
|
+
const boundingHeight = !connection.middleLabel ? 0 : middleLabelBoundingRect.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
10033
|
+
const pathMiddleLabelPoint = pathNode.getPointAtLength(pathLength / 2);
|
|
10034
|
+
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');
|
|
10035
|
+
connectionSelection.select('g.diagram-connection-middle-label').attr('transform', `translate(${pathMiddleLabelPoint.x + middleLabelShiftX * boundingWidth},${pathMiddleLabelPoint.y + middleLabelShiftY * boundingHeight})`);
|
|
10036
|
+
}
|
|
10037
|
+
// bind end labels
|
|
10038
|
+
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);
|
|
10039
|
+
const endLabelBoundingRect = (_d = connectionSelection.select('g.diagram-connection-end-label text').node()) === null || _d === void 0 ? void 0 : _d.getBoundingClientRect();
|
|
10040
|
+
if (endLabelBoundingRect) {
|
|
10041
|
+
// don't create space for the label if the label is empty
|
|
10042
|
+
const boundingWidth = !connection.endLabel ? 0 : endLabelBoundingRect.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getLeftPadding$1(labelConfiguration) + getRightPadding$1(labelConfiguration);
|
|
10043
|
+
const boundingHeight = !connection.endLabel ? 0 : endLabelBoundingRect.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k + getTopPadding$1(labelConfiguration) + getBottomPadding$1(labelConfiguration);
|
|
10044
|
+
let pathEndLabelPoint;
|
|
10045
|
+
switch (connection.endDirection) {
|
|
10046
|
+
case Side.Left:
|
|
10047
|
+
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getRightMargin(labelConfiguration) + boundingWidth / 2));
|
|
10048
|
+
break;
|
|
10049
|
+
case Side.Right:
|
|
10050
|
+
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getLeftMargin(labelConfiguration) + boundingWidth / 2));
|
|
10051
|
+
break;
|
|
10052
|
+
case Side.Top:
|
|
10053
|
+
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
10054
|
+
break;
|
|
10055
|
+
case Side.Bottom:
|
|
10056
|
+
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getTopMargin(labelConfiguration) + boundingHeight / 2));
|
|
10057
|
+
break;
|
|
10058
|
+
default:
|
|
10059
|
+
pathEndLabelPoint = pathNode.getPointAtLength(pathLength - Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
|
|
10060
|
+
}
|
|
10061
|
+
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');
|
|
10062
|
+
connectionSelection.select('g.diagram-connection-end-label').attr('transform', `translate(${pathEndLabelPoint.x + endLabelShiftX * boundingWidth},${pathEndLabelPoint.y + endLabelShiftY * boundingHeight})`);
|
|
10063
|
+
}
|
|
10142
10064
|
}
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
(
|
|
10149
|
-
|
|
10065
|
+
}, _DiagramCanvas_updateConnectionMarkersInView = function _DiagramCanvas_updateConnectionMarkersInView(connection) {
|
|
10066
|
+
const connectionSelection = this.selectCanvasView().select(`[id='${escapeSelector(connection.id)}']`);
|
|
10067
|
+
const startMarkerSelection = connectionSelection.select('marker.diagram-connection-start-marker');
|
|
10068
|
+
const endMarkerSelection = connectionSelection.select('marker.diagram-connection-end-marker');
|
|
10069
|
+
if (connection.startMarkerLook !== null) {
|
|
10070
|
+
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);
|
|
10071
|
+
} else {
|
|
10072
|
+
startMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
|
|
10150
10073
|
}
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10074
|
+
if (connection.endMarkerLook !== null) {
|
|
10075
|
+
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);
|
|
10076
|
+
} else {
|
|
10077
|
+
endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
|
|
10078
|
+
}
|
|
10079
|
+
}, _DiagramCanvas_startConnection = function _DiagramCanvas_startConnection(port) {
|
|
10080
|
+
var _b, _c, _d, _e;
|
|
10081
|
+
if (port.allowsOutgoing || port.allowsIncoming) {
|
|
10082
|
+
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)) {
|
|
10083
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnection, new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID), "f");
|
|
10084
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionPort, port, "f");
|
|
10085
|
+
} else {
|
|
10086
|
+
if (this.inferConnectionType) {
|
|
10087
|
+
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
10088
|
+
var _b, _c;
|
|
10089
|
+
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) || '');
|
|
10090
|
+
});
|
|
10091
|
+
if (differentConnectionType === undefined) {
|
|
10092
|
+
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
10093
|
+
var _b, _c;
|
|
10094
|
+
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) || '');
|
|
10095
|
+
});
|
|
10096
|
+
}
|
|
10097
|
+
if (differentConnectionType !== undefined) {
|
|
10098
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnection, new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID), "f");
|
|
10099
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionPort, port, "f");
|
|
10100
|
+
}
|
|
10101
|
+
}
|
|
10157
10102
|
}
|
|
10158
|
-
const textBoundingBox = textNode.getBoundingClientRect();
|
|
10159
|
-
return [textBoundingBox.width / this.zoomTransform.k, textBoundingBox.height / this.zoomTransform.k];
|
|
10160
10103
|
}
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
if (
|
|
10166
|
-
this
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10104
|
+
}, _DiagramCanvas_finishConnection = function _DiagramCanvas_finishConnection(port) {
|
|
10105
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
10106
|
+
this.userHighlight.clear();
|
|
10107
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f") !== undefined) {
|
|
10108
|
+
if (!this.allowConnectionLoops && __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f").start === port) {
|
|
10109
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10110
|
+
return;
|
|
10111
|
+
}
|
|
10112
|
+
if (!this.allowSharingPorts && (port.incomingConnections.filter(c => !c.removed).length > 0 || port.outgoingConnections.filter(c => !c.removed).length > 0)) {
|
|
10113
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10170
10114
|
return;
|
|
10171
10115
|
}
|
|
10172
|
-
if (
|
|
10173
|
-
|
|
10116
|
+
if (!this.allowSharingBothPorts && this.model.connections.find(c => {
|
|
10117
|
+
var _b, _c;
|
|
10118
|
+
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);
|
|
10119
|
+
}) !== undefined) {
|
|
10120
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10174
10121
|
return;
|
|
10175
10122
|
}
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10123
|
+
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) {
|
|
10124
|
+
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);
|
|
10125
|
+
// clean up the previous unfinished connection
|
|
10126
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10127
|
+
addConnectionAction.do();
|
|
10128
|
+
this.actionStack.add(addConnectionAction);
|
|
10129
|
+
} 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) {
|
|
10130
|
+
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);
|
|
10131
|
+
// clean up the previous unfinished connection
|
|
10132
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10133
|
+
addConnectionAction.do();
|
|
10134
|
+
this.actionStack.add(addConnectionAction);
|
|
10135
|
+
} else {
|
|
10136
|
+
if (this.inferConnectionType) {
|
|
10137
|
+
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
10138
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10139
|
+
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;
|
|
10140
|
+
});
|
|
10141
|
+
let invertConnection = false;
|
|
10142
|
+
if (differentConnectionType === undefined) {
|
|
10143
|
+
differentConnectionType = this.model.connections.types.all().find(t => {
|
|
10144
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10145
|
+
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;
|
|
10146
|
+
});
|
|
10147
|
+
invertConnection = true;
|
|
10148
|
+
}
|
|
10149
|
+
if (differentConnectionType !== undefined) {
|
|
10150
|
+
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);
|
|
10151
|
+
// clean up the previous unfinished connection
|
|
10152
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10153
|
+
addConnectionAction.do();
|
|
10154
|
+
this.actionStack.add(addConnectionAction);
|
|
10155
|
+
} else {
|
|
10156
|
+
// error: connection target of wrong type and no allowed type can be found
|
|
10157
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10158
|
+
}
|
|
10182
10159
|
} else {
|
|
10183
|
-
|
|
10184
|
-
|
|
10185
|
-
|
|
10186
|
-
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
|
|
10160
|
+
// error: connection target of wrong type and can't guess for a different type
|
|
10161
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_dropConnection).call(this);
|
|
10162
|
+
}
|
|
10163
|
+
}
|
|
10164
|
+
}
|
|
10165
|
+
}, _DiagramCanvas_dropConnection = function _DiagramCanvas_dropConnection() {
|
|
10166
|
+
var _b, _c, _d, _e;
|
|
10167
|
+
(_b = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _b === void 0 ? void 0 : _b.setStart(undefined);
|
|
10168
|
+
(_c = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _c === void 0 ? void 0 : _c.setEnd(undefined);
|
|
10169
|
+
(_e = (_d = __classPrivateFieldGet(this, _DiagramCanvas_unfinishedConnection, "f")) === null || _d === void 0 ? void 0 : _d.select()) === null || _e === void 0 ? void 0 : _e.remove();
|
|
10170
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnection, undefined, "f");
|
|
10171
|
+
__classPrivateFieldSet(this, _DiagramCanvas_unfinishedConnectionPort, undefined, "f");
|
|
10172
|
+
}, _DiagramCanvas_createInputField = function _DiagramCanvas_createInputField(text, coords, width, height, fontSize, fontFamily, orientation, multiline, changeCallback, finishCallback) {
|
|
10173
|
+
// if we have a text input open, close it before creating a new one
|
|
10174
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
|
|
10175
|
+
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');
|
|
10176
|
+
__classPrivateFieldSet(this, _DiagramCanvas_inputFieldContainer, inputFieldContainer, "f");
|
|
10177
|
+
const inputField = inputFieldContainer.append('xhtml:textarea');
|
|
10178
|
+
let inputFieldWidth;
|
|
10179
|
+
let inputFieldHeight;
|
|
10180
|
+
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(Events.KeyDown, event => {
|
|
10181
|
+
event.stopPropagation();
|
|
10182
|
+
if (event.key === Keys.Escape || event.key === Keys.Enter && !multiline) {
|
|
10183
|
+
const value = inputField.property('value') || '';
|
|
10184
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
|
|
10185
|
+
if (finishCallback) {
|
|
10186
|
+
finishCallback(value);
|
|
10191
10187
|
}
|
|
10192
|
-
minimumSize = this.minimumSizeOfField(field);
|
|
10193
10188
|
}
|
|
10194
|
-
}
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10189
|
+
}).on(Events.KeyUp, event => {
|
|
10190
|
+
event.stopPropagation();
|
|
10191
|
+
}).on(Events.Input, () => {
|
|
10192
|
+
const value = inputField.property('value');
|
|
10193
|
+
inputField.attr('cols', numberOfColumns(value) + 1);
|
|
10194
|
+
inputField.attr('rows', numberOfRows(value) + 1);
|
|
10195
|
+
// reset width and height so that later the scrollWidth and scrollHeight are fit to the size of the text
|
|
10196
|
+
inputField.style('width', '');
|
|
10197
|
+
inputField.style('height', '');
|
|
10198
|
+
// add one diagram unit of margin of error
|
|
10199
|
+
inputFieldWidth = inputField.property('scrollWidth') + 1;
|
|
10200
|
+
inputFieldHeight = inputField.property('scrollHeight') + 1;
|
|
10201
|
+
// keep the field from shrinking below its original size
|
|
10202
|
+
const newWidth = Math.max(inputFieldWidth, width);
|
|
10203
|
+
const newHeight = Math.max(inputFieldHeight, height);
|
|
10204
|
+
inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('width', `${newWidth}px`);
|
|
10205
|
+
inputField.style('width', `${newWidth}px`);
|
|
10206
|
+
inputFieldContainer === null || inputFieldContainer === void 0 ? void 0 : inputFieldContainer.attr('height', `${newHeight}px`);
|
|
10207
|
+
inputField.style('height', `${newHeight}px`);
|
|
10208
|
+
if (changeCallback) {
|
|
10209
|
+
changeCallback(value);
|
|
10210
|
+
}
|
|
10211
|
+
}).on(Events.Click, event => {
|
|
10212
|
+
event.stopPropagation();
|
|
10213
|
+
}).on(Events.FocusOut, () => {
|
|
10214
|
+
const value = inputField.property('value');
|
|
10215
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_removeInputField).call(this);
|
|
10216
|
+
if (finishCallback) {
|
|
10217
|
+
finishCallback(value);
|
|
10200
10218
|
}
|
|
10201
|
-
}
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10219
|
+
});
|
|
10220
|
+
const htmlInput = inputField.node();
|
|
10221
|
+
htmlInput.focus();
|
|
10222
|
+
htmlInput.select();
|
|
10223
|
+
}, _DiagramCanvas_removeInputField = function _DiagramCanvas_removeInputField() {
|
|
10224
|
+
var _b, _c, _d;
|
|
10225
|
+
// when removing an element, a blur event is emitted
|
|
10226
|
+
// we remove the listener for blur so that it does not emit again on element removal
|
|
10227
|
+
(_c = (_b = __classPrivateFieldGet(this, _DiagramCanvas_inputFieldContainer, "f")) === null || _b === void 0 ? void 0 : _b.select('input')) === null || _c === void 0 ? void 0 : _c.on(Events.Blur, null);
|
|
10228
|
+
(_d = __classPrivateFieldGet(this, _DiagramCanvas_inputFieldContainer, "f")) === null || _d === void 0 ? void 0 : _d.remove();
|
|
10229
|
+
__classPrivateFieldSet(this, _DiagramCanvas_inputFieldContainer, undefined, "f");
|
|
10230
|
+
}, _DiagramCanvas_minimumSizeOfField = function _DiagramCanvas_minimumSizeOfField(field) {
|
|
10231
|
+
var _b, _c;
|
|
10232
|
+
const textNode = (_c = (_b = field.select()) === null || _b === void 0 ? void 0 : _b.select('text')) === null || _c === void 0 ? void 0 : _c.node();
|
|
10233
|
+
if (!textNode) {
|
|
10234
|
+
// happens when a field has been created but not updated in view yet
|
|
10235
|
+
return [0, 0];
|
|
10236
|
+
}
|
|
10237
|
+
const textBoundingBox = textNode.getBoundingClientRect();
|
|
10238
|
+
return [textBoundingBox.width / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k, textBoundingBox.height / __classPrivateFieldGet(this, _DiagramCanvas_zoomTransform, "f").k];
|
|
10239
|
+
}, _DiagramCanvas_setFieldTextAndWrap = function _DiagramCanvas_setFieldTextAndWrap(field) {
|
|
10240
|
+
var _b, _c, _d, _e;
|
|
10241
|
+
const textSelection = (_b = field.select()) === null || _b === void 0 ? void 0 : _b.select('text');
|
|
10242
|
+
const textNode = textSelection === null || textSelection === void 0 ? void 0 : textSelection.node();
|
|
10243
|
+
if (textSelection && textNode) {
|
|
10244
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_setFieldText).call(this, field, textSelection, field.text);
|
|
10245
|
+
} else {
|
|
10246
|
+
// can happen if a field has been created but not updated in view yet
|
|
10247
|
+
// not sure if this still happens but should check just in case
|
|
10248
|
+
return;
|
|
10249
|
+
}
|
|
10250
|
+
if (field.fit) {
|
|
10251
|
+
// no need to wrap
|
|
10252
|
+
return;
|
|
10253
|
+
}
|
|
10254
|
+
let minimumSize = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
|
|
10255
|
+
while (minimumSize[0] > field.width || minimumSize[1] > field.height) {
|
|
10256
|
+
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)) || '';
|
|
10257
|
+
let newTextString = '...';
|
|
10258
|
+
if (textString.endsWith('...')) {
|
|
10259
|
+
newTextString = textString.slice(0, -4) + '...';
|
|
10215
10260
|
} else {
|
|
10216
|
-
|
|
10261
|
+
newTextString = textString.slice(0, -1) + '...';
|
|
10217
10262
|
}
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
* Method to call to continue the moving of a node triggered by a user drag event.
|
|
10221
|
-
*/
|
|
10222
|
-
continueMovingNode(event, d) {
|
|
10223
|
-
if (this.canUserPerformAction(DiagramActions.MoveNode) && (this.currentAction instanceof MoveAction || this.currentAction instanceof SetGeometryAction) && !d.removed) {
|
|
10224
|
-
const newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
10225
|
-
if (d.selected) {
|
|
10226
|
-
this.userSelection.move([newNodeCoords[0] - d.coords[0], newNodeCoords[1] - d.coords[1]]);
|
|
10227
|
-
} else {
|
|
10228
|
-
d.move(newNodeCoords);
|
|
10229
|
-
}
|
|
10230
|
-
this.userHighlight.clear();
|
|
10231
|
-
this.dragging = true;
|
|
10232
|
-
this.diagramEvent$.next(new DiagramDraggingNodeEvent(d));
|
|
10263
|
+
if (textSelection) {
|
|
10264
|
+
__classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_setFieldText).call(this, field, textSelection, newTextString);
|
|
10233
10265
|
}
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
*/
|
|
10238
|
-
finishMovingNode(event, d) {
|
|
10239
|
-
var _a, _b, _c, _d;
|
|
10240
|
-
if (this.canUserPerformAction(DiagramActions.MoveNode) && !d.removed) {
|
|
10241
|
-
// prevent drag behavior if mouse hasn't moved
|
|
10242
|
-
if (this.draggingFrom[0] !== event.x || this.draggingFrom[1] !== event.y) {
|
|
10243
|
-
let newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
10244
|
-
if ((_a = this.gridConfig) === null || _a === void 0 ? void 0 : _a.snap) {
|
|
10245
|
-
newNodeCoords = this.getClosestGridPoint([newNodeCoords[0] - d.type.snapToGridOffset[0], newNodeCoords[1] - d.type.snapToGridOffset[1]]);
|
|
10246
|
-
newNodeCoords[0] += d.type.snapToGridOffset[0];
|
|
10247
|
-
newNodeCoords[1] += d.type.snapToGridOffset[1];
|
|
10248
|
-
}
|
|
10249
|
-
if (this.currentAction instanceof MoveAction) {
|
|
10250
|
-
const movingFrom = this.currentAction.delta;
|
|
10251
|
-
this.currentAction.delta = [newNodeCoords[0] - movingFrom[0], newNodeCoords[1] - movingFrom[1]];
|
|
10252
|
-
// reset position of node prior to moving it again
|
|
10253
|
-
if (d.selected) {
|
|
10254
|
-
this.userSelection.move([movingFrom[0] - d.coords[0], movingFrom[1] - d.coords[1]]);
|
|
10255
|
-
} else {
|
|
10256
|
-
d.move(movingFrom);
|
|
10257
|
-
}
|
|
10258
|
-
} else if (this.currentAction instanceof SetGeometryAction) {
|
|
10259
|
-
d.move(newNodeCoords);
|
|
10260
|
-
// if moving a single node, we can change the node's parent,
|
|
10261
|
-
// so we check whether we dropped this node on a potential parent
|
|
10262
|
-
const nodesAtLocation = this.model.nodes.getAtCoordinates(event.x, event.y).filter(n => n.id !== d.id && !n.isDescendantOf(d));
|
|
10263
|
-
// filter by which nodes can have this node as a child
|
|
10264
|
-
const nodesAtLocationWhichCanHaveNodeAsAChild = nodesAtLocation.filter(n => n.type.childrenTypes.includes(d.type.id));
|
|
10265
|
-
// filter by which nodes don't have descendants in this collection
|
|
10266
|
-
const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
|
|
10267
|
-
const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
|
|
10268
|
-
if (droppedOn !== d.parent && (d.type.canBeParentless || droppedOn !== undefined)) {
|
|
10269
|
-
const ancestorOfDroppedOn = droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.getLastAncestor();
|
|
10270
|
-
const fromChildGeometry = this.currentAction.from;
|
|
10271
|
-
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));
|
|
10272
|
-
(_c = d.parent) === null || _c === void 0 ? void 0 : _c.removeChild(d);
|
|
10273
|
-
if (droppedOn !== undefined) {
|
|
10274
|
-
droppedOn.addChild(d);
|
|
10275
|
-
}
|
|
10276
|
-
setParentAction.toChildGeometry = d.getGeometry(d.id);
|
|
10277
|
-
setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id);
|
|
10278
|
-
this.currentAction = setParentAction;
|
|
10279
|
-
} else {
|
|
10280
|
-
const ancestorOfNode = d === null || d === void 0 ? void 0 : d.getLastAncestor();
|
|
10281
|
-
this.currentAction.ancestorId = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id;
|
|
10282
|
-
this.currentAction.fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
|
|
10283
|
-
(_d = d.parent) === null || _d === void 0 ? void 0 : _d.fitToChild(d);
|
|
10284
|
-
this.currentAction.to = d.getGeometry(d.id);
|
|
10285
|
-
this.currentAction.toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
|
|
10286
|
-
}
|
|
10287
|
-
}
|
|
10288
|
-
if (this.currentAction !== undefined) {
|
|
10289
|
-
this.currentAction.do();
|
|
10290
|
-
this.actionStack.add(this.currentAction);
|
|
10291
|
-
this.currentAction = undefined;
|
|
10292
|
-
}
|
|
10293
|
-
}
|
|
10266
|
+
if (newTextString === '...') {
|
|
10267
|
+
// if no more characters can be removed and the new text is a bare ellipsis, stop the execution
|
|
10268
|
+
return;
|
|
10294
10269
|
}
|
|
10295
|
-
|
|
10296
|
-
this.dragging = false;
|
|
10270
|
+
minimumSize = __classPrivateFieldGet(this, _DiagramCanvas_instances, "m", _DiagramCanvas_minimumSizeOfField).call(this, field);
|
|
10297
10271
|
}
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10272
|
+
}, _DiagramCanvas_setFieldText = function _DiagramCanvas_setFieldText(field, textSelection, text) {
|
|
10273
|
+
const lines = text.split('\n');
|
|
10274
|
+
textSelection.html('');
|
|
10275
|
+
for (let i = 0; i < lines.length; ++i) {
|
|
10276
|
+
textSelection.append('tspan').attr('x', field.horizontalAlign === HorizontalAlign.Center ? field.width / 2 : field.horizontalAlign === HorizontalAlign.Right ? field.width : 0).attr('y', field.verticalAlign === VerticalAlign.Center ? (i + 0.5 - lines.length / 2) * (field.look.fontSize || DIAGRAM_FIELD_DEFAULTS.look.fontSize) + field.height / 2 : field.verticalAlign === 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]);
|
|
10303
10277
|
}
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
this.
|
|
10278
|
+
}, _DiagramCanvas_startMovingNode = function _DiagramCanvas_startMovingNode(event, d) {
|
|
10279
|
+
if (this.canUserPerformAction(DiagramActions.MoveNode) && !d.removed) {
|
|
10280
|
+
setCursorStyle(CursorStyle.Grabbing);
|
|
10281
|
+
__classPrivateFieldSet(this, _DiagramCanvas_draggingFrom, [event.x, event.y], "f");
|
|
10282
|
+
if (d.selected && this.userSelection.count(e => e instanceof DiagramNode) > 1) {
|
|
10283
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new MoveAction(this, this.userSelection.filter(e => e instanceof DiagramNode).map(n => n.id), d.coords), "f");
|
|
10284
|
+
} else {
|
|
10285
|
+
const ancestorOfNode = d.getLastAncestor();
|
|
10286
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, new SetGeometryAction(this, 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");
|
|
10313
10287
|
}
|
|
10288
|
+
} else {
|
|
10289
|
+
setCursorStyle(CursorStyle.NotAllowed);
|
|
10314
10290
|
}
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
const
|
|
10318
|
-
(
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
if (rectanglesIntersect([node.coords, [node.coords[0] + node.width, node.coords[1] + node.height]], [this.draggingFrom, pointerCoords])) {
|
|
10323
|
-
this.userSelection.add(node);
|
|
10324
|
-
}
|
|
10291
|
+
}, _DiagramCanvas_continueMovingNode = function _DiagramCanvas_continueMovingNode(event, d) {
|
|
10292
|
+
if (this.canUserPerformAction(DiagramActions.MoveNode) && (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof MoveAction || __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction) && !d.removed) {
|
|
10293
|
+
const newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
10294
|
+
if (d.selected) {
|
|
10295
|
+
this.userSelection.move([newNodeCoords[0] - d.coords[0], newNodeCoords[1] - d.coords[1]]);
|
|
10296
|
+
} else {
|
|
10297
|
+
d.move(newNodeCoords);
|
|
10325
10298
|
}
|
|
10326
|
-
this.
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
}
|
|
10330
|
-
}
|
|
10331
|
-
|
|
10299
|
+
this.userHighlight.clear();
|
|
10300
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, true, "f");
|
|
10301
|
+
this.diagramEvent$.next(new DiagramDraggingNodeEvent(d));
|
|
10302
|
+
}
|
|
10303
|
+
}, _DiagramCanvas_finishMovingNode = function _DiagramCanvas_finishMovingNode(event, d) {
|
|
10304
|
+
var _b, _c, _d, _e;
|
|
10305
|
+
if (this.canUserPerformAction(DiagramActions.MoveNode) && !d.removed) {
|
|
10306
|
+
// prevent drag behavior if mouse hasn't moved
|
|
10307
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[0] !== event.x || __classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[1] !== event.y) {
|
|
10308
|
+
let newNodeCoords = [event.x - d.width / 2, event.y - d.height / 2];
|
|
10309
|
+
if ((_b = this.gridConfig) === null || _b === void 0 ? void 0 : _b.snap) {
|
|
10310
|
+
newNodeCoords = this.getClosestGridPoint([newNodeCoords[0] - d.type.snapToGridOffset[0], newNodeCoords[1] - d.type.snapToGridOffset[1]]);
|
|
10311
|
+
newNodeCoords[0] += d.type.snapToGridOffset[0];
|
|
10312
|
+
newNodeCoords[1] += d.type.snapToGridOffset[1];
|
|
10313
|
+
}
|
|
10314
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof MoveAction) {
|
|
10315
|
+
const movingFrom = __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").delta;
|
|
10316
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").delta = [newNodeCoords[0] - movingFrom[0], newNodeCoords[1] - movingFrom[1]];
|
|
10317
|
+
// reset position of node prior to moving it again
|
|
10318
|
+
if (d.selected) {
|
|
10319
|
+
this.userSelection.move([movingFrom[0] - d.coords[0], movingFrom[1] - d.coords[1]]);
|
|
10320
|
+
} else {
|
|
10321
|
+
d.move(movingFrom);
|
|
10322
|
+
}
|
|
10323
|
+
} else if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") instanceof SetGeometryAction) {
|
|
10324
|
+
d.move(newNodeCoords);
|
|
10325
|
+
// if moving a single node, we can change the node's parent,
|
|
10326
|
+
// so we check whether we dropped this node on a potential parent
|
|
10327
|
+
const nodesAtLocation = this.model.nodes.getAtCoordinates(event.x, event.y).filter(n => n.id !== d.id && !n.isDescendantOf(d));
|
|
10328
|
+
// filter by which nodes can have this node as a child
|
|
10329
|
+
const nodesAtLocationWhichCanHaveNodeAsAChild = nodesAtLocation.filter(n => n.type.childrenTypes.includes(d.type.id));
|
|
10330
|
+
// filter by which nodes don't have descendants in this collection
|
|
10331
|
+
const filteredNodesAtLocation = filterByOnlyDescendants(nodesAtLocationWhichCanHaveNodeAsAChild);
|
|
10332
|
+
const droppedOn = filteredNodesAtLocation[filteredNodesAtLocation.length - 1];
|
|
10333
|
+
if (droppedOn !== d.parent && (d.type.canBeParentless || droppedOn !== undefined)) {
|
|
10334
|
+
const ancestorOfDroppedOn = droppedOn === null || droppedOn === void 0 ? void 0 : droppedOn.getLastAncestor();
|
|
10335
|
+
const fromChildGeometry = __classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").from;
|
|
10336
|
+
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));
|
|
10337
|
+
(_d = d.parent) === null || _d === void 0 ? void 0 : _d.removeChild(d);
|
|
10338
|
+
if (droppedOn !== undefined) {
|
|
10339
|
+
droppedOn.addChild(d);
|
|
10340
|
+
}
|
|
10341
|
+
setParentAction.toChildGeometry = d.getGeometry(d.id);
|
|
10342
|
+
setParentAction.toAncestorGeometry = ancestorOfDroppedOn === null || ancestorOfDroppedOn === void 0 ? void 0 : ancestorOfDroppedOn.getGeometry(d.id);
|
|
10343
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, setParentAction, "f");
|
|
10344
|
+
} else {
|
|
10345
|
+
const ancestorOfNode = d === null || d === void 0 ? void 0 : d.getLastAncestor();
|
|
10346
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").ancestorId = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.id;
|
|
10347
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").fromAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
|
|
10348
|
+
(_e = d.parent) === null || _e === void 0 ? void 0 : _e.fitToChild(d);
|
|
10349
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").to = d.getGeometry(d.id);
|
|
10350
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").toAncestorGeometry = ancestorOfNode === null || ancestorOfNode === void 0 ? void 0 : ancestorOfNode.getGeometry(d.id);
|
|
10351
|
+
}
|
|
10352
|
+
}
|
|
10353
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f") !== undefined) {
|
|
10354
|
+
__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f").do();
|
|
10355
|
+
this.actionStack.add(__classPrivateFieldGet(this, _DiagramCanvas_currentAction, "f"));
|
|
10356
|
+
__classPrivateFieldSet(this, _DiagramCanvas_currentAction, undefined, "f");
|
|
10357
|
+
}
|
|
10358
|
+
}
|
|
10359
|
+
}
|
|
10360
|
+
setCursorStyle();
|
|
10361
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, false, "f");
|
|
10362
|
+
}, _DiagramCanvas_startMultipleSelection = function _DiagramCanvas_startMultipleSelection(event) {
|
|
10363
|
+
__classPrivateFieldSet(this, _DiagramCanvas_draggingFrom, this.getPointerLocationRelativeToCanvas(event), "f");
|
|
10364
|
+
// we put the multiple selection rectangle in the diagram svg element
|
|
10365
|
+
// so it's not affected by the zoom level in the diagram elements
|
|
10366
|
+
__classPrivateFieldSet(this, _DiagramCanvas_multipleSelectionContainer, this.selectSVGElement().append('rect').attr('stroke', '#0E74B6').attr('fill', 'rgba(14, 116, 182, 0.06)'), "f");
|
|
10367
|
+
}, _DiagramCanvas_continueMultipleSelection = function _DiagramCanvas_continueMultipleSelection(event) {
|
|
10368
|
+
var _b, _c, _d, _e;
|
|
10369
|
+
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
10370
|
+
if (__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[0] !== pointerCoords[0] || __classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f")[1] !== pointerCoords[1]) {
|
|
10371
|
+
setCursorStyle(CursorStyle.Crosshair);
|
|
10372
|
+
// since the multiple selection rectangle is not affected by zoom,
|
|
10373
|
+
// we compensate its coordinates based in the zoom transform to draw it
|
|
10374
|
+
(_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);
|
|
10375
|
+
__classPrivateFieldSet(this, _DiagramCanvas_dragging, true, "f");
|
|
10376
|
+
}
|
|
10377
|
+
}, _DiagramCanvas_finishMultipleSelection = function _DiagramCanvas_finishMultipleSelection(event) {
|
|
10378
|
+
var _b;
|
|
10379
|
+
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
10380
|
+
(_b = __classPrivateFieldGet(this, _DiagramCanvas_multipleSelectionContainer, "f")) === null || _b === void 0 ? void 0 : _b.remove();
|
|
10381
|
+
__classPrivateFieldSet(this, _DiagramCanvas_multipleSelectionContainer, undefined, "f");
|
|
10382
|
+
this.userSelection.clear();
|
|
10383
|
+
for (const node of this.model.nodes) {
|
|
10384
|
+
if (rectanglesIntersect([node.coords, [node.coords[0] + node.width, node.coords[1] + node.height]], [__classPrivateFieldGet(this, _DiagramCanvas_draggingFrom, "f"), pointerCoords])) {
|
|
10385
|
+
this.userSelection.add(node);
|
|
10386
|
+
}
|
|
10387
|
+
}
|
|
10388
|
+
this.multipleSelectionOn = false;
|
|
10389
|
+
this.diagramEvent$.next(new DiagramSelectionEvent(this.userSelection.all(), true));
|
|
10390
|
+
setCursorStyle();
|
|
10391
|
+
};
|
|
10392
|
+
_DiagramCanvas_canvasCount = {
|
|
10393
|
+
value: 0
|
|
10394
|
+
};
|
|
10332
10395
|
|
|
10396
|
+
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;
|
|
10333
10397
|
const VERSION = '0.0.1';
|
|
10334
10398
|
/**
|
|
10335
10399
|
* The client that communicates with the daga-server over WebSockets.
|
|
@@ -10339,24 +10403,26 @@ const VERSION = '0.0.1';
|
|
|
10339
10403
|
*/
|
|
10340
10404
|
class CollabClient {
|
|
10341
10405
|
constructor(dagaServer, userId) {
|
|
10342
|
-
this
|
|
10406
|
+
_CollabClient_instances.add(this);
|
|
10407
|
+
_CollabClient_webSocket.set(this, void 0);
|
|
10408
|
+
_CollabClient_sendQueue.set(this, []);
|
|
10343
10409
|
/**
|
|
10344
10410
|
* Joined sessions by locator.
|
|
10345
10411
|
*/
|
|
10346
|
-
this
|
|
10412
|
+
_CollabClient_sessions.set(this, new Map());
|
|
10347
10413
|
/**
|
|
10348
10414
|
* Created but unacked sessions by refId.
|
|
10349
10415
|
*/
|
|
10350
|
-
this
|
|
10416
|
+
_CollabClient_pendingSessions.set(this, new Map());
|
|
10351
10417
|
this.dagaServer = dagaServer;
|
|
10352
10418
|
this.userId = userId;
|
|
10353
10419
|
this.clientId = v4();
|
|
10354
|
-
this
|
|
10355
|
-
this.
|
|
10356
|
-
this.
|
|
10357
|
-
this.
|
|
10358
|
-
this.
|
|
10359
|
-
this.
|
|
10420
|
+
__classPrivateFieldSet(this, _CollabClient_webSocket, new WebSocket(this.dagaServer, 'esgrima'), "f");
|
|
10421
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('open', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onOpen).bind(this));
|
|
10422
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('message', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onMessage).bind(this));
|
|
10423
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('close', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onClose).bind(this));
|
|
10424
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").addEventListener('error', __classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_onError).bind(this));
|
|
10425
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
|
|
10360
10426
|
type: 'HELO',
|
|
10361
10427
|
clientId: this.clientId,
|
|
10362
10428
|
userId: this.userId,
|
|
@@ -10364,86 +10430,6 @@ class CollabClient {
|
|
|
10364
10430
|
ts: now()
|
|
10365
10431
|
});
|
|
10366
10432
|
}
|
|
10367
|
-
onOpen() {
|
|
10368
|
-
// Send queued messages.
|
|
10369
|
-
for (const serialized of this.sendQueue) {
|
|
10370
|
-
this.ws.send(serialized);
|
|
10371
|
-
}
|
|
10372
|
-
this.sendQueue = [];
|
|
10373
|
-
}
|
|
10374
|
-
onMessage(e) {
|
|
10375
|
-
const serialized = e.data;
|
|
10376
|
-
const message = JSON.parse(serialized);
|
|
10377
|
-
this.receive(message);
|
|
10378
|
-
}
|
|
10379
|
-
onClose(e) {
|
|
10380
|
-
console.error('WebSocket closed', e);
|
|
10381
|
-
}
|
|
10382
|
-
onError(e) {
|
|
10383
|
-
console.error('WebSocket error', e);
|
|
10384
|
-
}
|
|
10385
|
-
/**
|
|
10386
|
-
* Internal send method. Use instead of calling ws.send directly.
|
|
10387
|
-
*/
|
|
10388
|
-
send(message) {
|
|
10389
|
-
const serialized = JSON.stringify(message);
|
|
10390
|
-
if (this.ws.readyState === WebSocket.OPEN) {
|
|
10391
|
-
this.ws.send(serialized);
|
|
10392
|
-
} else {
|
|
10393
|
-
// Queue until after we connect.
|
|
10394
|
-
this.sendQueue.push(serialized);
|
|
10395
|
-
}
|
|
10396
|
-
}
|
|
10397
|
-
/**
|
|
10398
|
-
* Internal receive method. Use instead of handling ws receive events directly.
|
|
10399
|
-
*/
|
|
10400
|
-
receive(message) {
|
|
10401
|
-
var _a, _b;
|
|
10402
|
-
switch (message.type) {
|
|
10403
|
-
case 'EACK':
|
|
10404
|
-
{
|
|
10405
|
-
const session = this.sessions.get(message.locator);
|
|
10406
|
-
if (session === undefined) {
|
|
10407
|
-
throw new Error(`EACK for unknown locator: "${message.locator}"`);
|
|
10408
|
-
}
|
|
10409
|
-
const initialModel = message.initialModel;
|
|
10410
|
-
new DagaImporter().import(session.canvas.model, initialModel);
|
|
10411
|
-
this.startSyncing(session);
|
|
10412
|
-
(_a = session.joinRoomResolve) === null || _a === void 0 ? void 0 : _a.call(session);
|
|
10413
|
-
session.joinRoomResolve = undefined;
|
|
10414
|
-
break;
|
|
10415
|
-
}
|
|
10416
|
-
case 'ADD':
|
|
10417
|
-
{
|
|
10418
|
-
const session = this.sessions.get(message.locator);
|
|
10419
|
-
if (session === undefined) {
|
|
10420
|
-
throw new Error(`ADD for unknown locator: "${message.locator}"`);
|
|
10421
|
-
}
|
|
10422
|
-
const action = message.payload;
|
|
10423
|
-
session.canvas.collabEngine.receive(action);
|
|
10424
|
-
break;
|
|
10425
|
-
}
|
|
10426
|
-
case 'CACK':
|
|
10427
|
-
{
|
|
10428
|
-
const session = this.pendingSessions.get(message.refId);
|
|
10429
|
-
if (session === undefined) {
|
|
10430
|
-
throw new Error(`CACK for unknown refId: "${message.refId}"`);
|
|
10431
|
-
}
|
|
10432
|
-
session.locator = message.locator;
|
|
10433
|
-
this.pendingSessions.delete(message.refId);
|
|
10434
|
-
this.sessions.set(session.locator, session);
|
|
10435
|
-
(_b = session.createRoomResolve) === null || _b === void 0 ? void 0 : _b.call(session, session.locator);
|
|
10436
|
-
session.createRoomResolve = undefined;
|
|
10437
|
-
// Deliver queued AddMessages now that we have a locator.
|
|
10438
|
-
for (const message of session.addQueue) {
|
|
10439
|
-
this.send(Object.assign(Object.assign({}, message), {
|
|
10440
|
-
locator: session.locator
|
|
10441
|
-
}));
|
|
10442
|
-
}
|
|
10443
|
-
session.addQueue = [];
|
|
10444
|
-
}
|
|
10445
|
-
}
|
|
10446
|
-
}
|
|
10447
10433
|
/**
|
|
10448
10434
|
* Creates and joins a room. The given canvas becomes collaborative, starting
|
|
10449
10435
|
* with its current model.
|
|
@@ -10458,7 +10444,7 @@ class CollabClient {
|
|
|
10458
10444
|
canvas.collabEngine.isInRoom = true;
|
|
10459
10445
|
const refId = v4();
|
|
10460
10446
|
const initialModel = new DagaExporter().export(canvas.model, true);
|
|
10461
|
-
this.
|
|
10447
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
|
|
10462
10448
|
type: 'CREA',
|
|
10463
10449
|
clientId: this.clientId,
|
|
10464
10450
|
userId: this.userId,
|
|
@@ -10471,10 +10457,10 @@ class CollabClient {
|
|
|
10471
10457
|
locator: null,
|
|
10472
10458
|
addQueue: []
|
|
10473
10459
|
};
|
|
10474
|
-
this.
|
|
10460
|
+
__classPrivateFieldGet(this, _CollabClient_pendingSessions, "f").set(refId, session);
|
|
10475
10461
|
// We need to start queuing local AddMessages immediately, in case the user edits
|
|
10476
10462
|
// the diagram while the CREA message is in-flight.
|
|
10477
|
-
this.
|
|
10463
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_startSyncing).call(this, session);
|
|
10478
10464
|
return new Promise(resolve => {
|
|
10479
10465
|
session.createRoomResolve = resolve;
|
|
10480
10466
|
});
|
|
@@ -10493,7 +10479,7 @@ class CollabClient {
|
|
|
10493
10479
|
throw new Error('Canvas is already in a room');
|
|
10494
10480
|
}
|
|
10495
10481
|
canvas.collabEngine.isInRoom = true;
|
|
10496
|
-
this.
|
|
10482
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
|
|
10497
10483
|
type: 'ENRO',
|
|
10498
10484
|
clientId: this.clientId,
|
|
10499
10485
|
userId: this.userId,
|
|
@@ -10505,36 +10491,104 @@ class CollabClient {
|
|
|
10505
10491
|
locator,
|
|
10506
10492
|
addQueue: []
|
|
10507
10493
|
};
|
|
10508
|
-
this.
|
|
10494
|
+
__classPrivateFieldGet(this, _CollabClient_sessions, "f").set(locator, session);
|
|
10509
10495
|
return new Promise(resolve => {
|
|
10510
10496
|
session.joinRoomResolve = resolve;
|
|
10511
10497
|
});
|
|
10512
10498
|
}
|
|
10513
|
-
startSyncing(session) {
|
|
10514
|
-
// Sync AddMessages from us to the server.
|
|
10515
|
-
session.canvas.collabEngine.onSend = action => {
|
|
10516
|
-
if (session.locator === null) {
|
|
10517
|
-
// Queue until we receive the locator in the CACK message.
|
|
10518
|
-
session.addQueue.push({
|
|
10519
|
-
type: 'ADD',
|
|
10520
|
-
clientId: this.clientId,
|
|
10521
|
-
userId: this.userId,
|
|
10522
|
-
payload: action,
|
|
10523
|
-
ts: now()
|
|
10524
|
-
});
|
|
10525
|
-
} else {
|
|
10526
|
-
this.send({
|
|
10527
|
-
type: 'ADD',
|
|
10528
|
-
clientId: this.clientId,
|
|
10529
|
-
userId: this.userId,
|
|
10530
|
-
locator: session.locator,
|
|
10531
|
-
payload: action,
|
|
10532
|
-
ts: now()
|
|
10533
|
-
});
|
|
10534
|
-
}
|
|
10535
|
-
};
|
|
10536
|
-
}
|
|
10537
10499
|
}
|
|
10500
|
+
_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() {
|
|
10501
|
+
// Send queued messages.
|
|
10502
|
+
for (const serialized of __classPrivateFieldGet(this, _CollabClient_sendQueue, "f")) {
|
|
10503
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").send(serialized);
|
|
10504
|
+
}
|
|
10505
|
+
__classPrivateFieldSet(this, _CollabClient_sendQueue, [], "f");
|
|
10506
|
+
}, _CollabClient_onMessage = function _CollabClient_onMessage(e) {
|
|
10507
|
+
const serialized = e.data;
|
|
10508
|
+
const message = JSON.parse(serialized);
|
|
10509
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_receive).call(this, message);
|
|
10510
|
+
}, _CollabClient_onClose = function _CollabClient_onClose(e) {
|
|
10511
|
+
console.error('WebSocket closed', e);
|
|
10512
|
+
}, _CollabClient_onError = function _CollabClient_onError(e) {
|
|
10513
|
+
console.error('WebSocket error', e);
|
|
10514
|
+
}, _CollabClient_send = function _CollabClient_send(message) {
|
|
10515
|
+
const serialized = JSON.stringify(message);
|
|
10516
|
+
if (__classPrivateFieldGet(this, _CollabClient_webSocket, "f").readyState === WebSocket.OPEN) {
|
|
10517
|
+
__classPrivateFieldGet(this, _CollabClient_webSocket, "f").send(serialized);
|
|
10518
|
+
} else {
|
|
10519
|
+
// Queue until after we connect.
|
|
10520
|
+
__classPrivateFieldGet(this, _CollabClient_sendQueue, "f").push(serialized);
|
|
10521
|
+
}
|
|
10522
|
+
}, _CollabClient_receive = function _CollabClient_receive(message) {
|
|
10523
|
+
var _a, _b;
|
|
10524
|
+
switch (message.type) {
|
|
10525
|
+
case 'EACK':
|
|
10526
|
+
{
|
|
10527
|
+
const session = __classPrivateFieldGet(this, _CollabClient_sessions, "f").get(message.locator);
|
|
10528
|
+
if (session === undefined) {
|
|
10529
|
+
throw new Error(`EACK for unknown locator: "${message.locator}"`);
|
|
10530
|
+
}
|
|
10531
|
+
const initialModel = message.initialModel;
|
|
10532
|
+
new DagaImporter().import(session.canvas.model, initialModel);
|
|
10533
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_startSyncing).call(this, session);
|
|
10534
|
+
(_a = session.joinRoomResolve) === null || _a === void 0 ? void 0 : _a.call(session);
|
|
10535
|
+
session.joinRoomResolve = undefined;
|
|
10536
|
+
break;
|
|
10537
|
+
}
|
|
10538
|
+
case 'ADD':
|
|
10539
|
+
{
|
|
10540
|
+
const session = __classPrivateFieldGet(this, _CollabClient_sessions, "f").get(message.locator);
|
|
10541
|
+
if (session === undefined) {
|
|
10542
|
+
throw new Error(`ADD for unknown locator: "${message.locator}"`);
|
|
10543
|
+
}
|
|
10544
|
+
const action = message.payload;
|
|
10545
|
+
session.canvas.collabEngine.receive(action);
|
|
10546
|
+
break;
|
|
10547
|
+
}
|
|
10548
|
+
case 'CACK':
|
|
10549
|
+
{
|
|
10550
|
+
const session = __classPrivateFieldGet(this, _CollabClient_pendingSessions, "f").get(message.refId);
|
|
10551
|
+
if (session === undefined) {
|
|
10552
|
+
throw new Error(`CACK for unknown refId: "${message.refId}"`);
|
|
10553
|
+
}
|
|
10554
|
+
session.locator = message.locator;
|
|
10555
|
+
__classPrivateFieldGet(this, _CollabClient_pendingSessions, "f").delete(message.refId);
|
|
10556
|
+
__classPrivateFieldGet(this, _CollabClient_sessions, "f").set(session.locator, session);
|
|
10557
|
+
(_b = session.createRoomResolve) === null || _b === void 0 ? void 0 : _b.call(session, session.locator);
|
|
10558
|
+
session.createRoomResolve = undefined;
|
|
10559
|
+
// Deliver queued AddMessages now that we have a locator.
|
|
10560
|
+
for (const message of session.addQueue) {
|
|
10561
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, Object.assign(Object.assign({}, message), {
|
|
10562
|
+
locator: session.locator
|
|
10563
|
+
}));
|
|
10564
|
+
}
|
|
10565
|
+
session.addQueue = [];
|
|
10566
|
+
}
|
|
10567
|
+
}
|
|
10568
|
+
}, _CollabClient_startSyncing = function _CollabClient_startSyncing(session) {
|
|
10569
|
+
// Sync AddMessages from us to the server.
|
|
10570
|
+
session.canvas.collabEngine.onSend = action => {
|
|
10571
|
+
if (session.locator === null) {
|
|
10572
|
+
// Queue until we receive the locator in the CACK message.
|
|
10573
|
+
session.addQueue.push({
|
|
10574
|
+
type: 'ADD',
|
|
10575
|
+
clientId: this.clientId,
|
|
10576
|
+
userId: this.userId,
|
|
10577
|
+
payload: action,
|
|
10578
|
+
ts: now()
|
|
10579
|
+
});
|
|
10580
|
+
} else {
|
|
10581
|
+
__classPrivateFieldGet(this, _CollabClient_instances, "m", _CollabClient_send).call(this, {
|
|
10582
|
+
type: 'ADD',
|
|
10583
|
+
clientId: this.clientId,
|
|
10584
|
+
userId: this.userId,
|
|
10585
|
+
locator: session.locator,
|
|
10586
|
+
payload: action,
|
|
10587
|
+
ts: now()
|
|
10588
|
+
});
|
|
10589
|
+
}
|
|
10590
|
+
};
|
|
10591
|
+
};
|
|
10538
10592
|
/**
|
|
10539
10593
|
* Returns the current timestamp for a message's ts field.
|
|
10540
10594
|
*/
|
|
@@ -10542,66 +10596,67 @@ function now() {
|
|
|
10542
10596
|
return new Date().toISOString();
|
|
10543
10597
|
}
|
|
10544
10598
|
|
|
10599
|
+
var _Grid_grid, _Grid_offsetX, _Grid_offsetY;
|
|
10545
10600
|
/**
|
|
10546
10601
|
* A two dimensional array of elements of the given class that can extend infinitely in any direction, both positive and negative.
|
|
10547
10602
|
* @private
|
|
10548
10603
|
*/
|
|
10549
10604
|
class Grid {
|
|
10550
10605
|
constructor() {
|
|
10551
|
-
this
|
|
10552
|
-
this
|
|
10553
|
-
this
|
|
10606
|
+
_Grid_grid.set(this, [[undefined]]);
|
|
10607
|
+
_Grid_offsetX.set(this, 0);
|
|
10608
|
+
_Grid_offsetY.set(this, 0);
|
|
10554
10609
|
}
|
|
10555
10610
|
/**
|
|
10556
10611
|
* Get the minimum x coordinate among the elements in the grid.
|
|
10557
10612
|
*/
|
|
10558
10613
|
minX() {
|
|
10559
|
-
return -this
|
|
10614
|
+
return -__classPrivateFieldGet(this, _Grid_offsetX, "f");
|
|
10560
10615
|
}
|
|
10561
10616
|
/**
|
|
10562
10617
|
* Get the maximum x coordinate among the elements in the grid.
|
|
10563
10618
|
*/
|
|
10564
10619
|
maxX() {
|
|
10565
|
-
return this.width() - 1 - this
|
|
10620
|
+
return this.width() - 1 - __classPrivateFieldGet(this, _Grid_offsetX, "f");
|
|
10566
10621
|
}
|
|
10567
10622
|
/**
|
|
10568
10623
|
* Get the minimum y coordinate among the elements in the grid.
|
|
10569
10624
|
*/
|
|
10570
10625
|
minY() {
|
|
10571
|
-
return -this
|
|
10626
|
+
return -__classPrivateFieldGet(this, _Grid_offsetY, "f");
|
|
10572
10627
|
}
|
|
10573
10628
|
/**
|
|
10574
10629
|
* Get the maximum y coordinate among the elements in the grid.
|
|
10575
10630
|
*/
|
|
10576
10631
|
maxY() {
|
|
10577
|
-
return this.height() - 1 - this
|
|
10632
|
+
return this.height() - 1 - __classPrivateFieldGet(this, _Grid_offsetY, "f");
|
|
10578
10633
|
}
|
|
10579
10634
|
/**
|
|
10580
10635
|
* Get the total extension of the grid along the x axis.
|
|
10581
10636
|
*/
|
|
10582
10637
|
width() {
|
|
10583
|
-
return this
|
|
10638
|
+
return __classPrivateFieldGet(this, _Grid_grid, "f")[0].length;
|
|
10584
10639
|
}
|
|
10585
10640
|
/**
|
|
10586
10641
|
* Get the total extension of the grid along the y axis.
|
|
10587
10642
|
*/
|
|
10588
10643
|
height() {
|
|
10589
|
-
return this.
|
|
10644
|
+
return __classPrivateFieldGet(this, _Grid_grid, "f").length;
|
|
10590
10645
|
}
|
|
10591
10646
|
/**
|
|
10592
10647
|
* Add a new column at the start of the x axis.
|
|
10593
10648
|
*/
|
|
10594
10649
|
addColumnLeft() {
|
|
10595
|
-
for (const row of this
|
|
10650
|
+
for (const row of __classPrivateFieldGet(this, _Grid_grid, "f")) {
|
|
10596
10651
|
row.splice(0, 0, undefined);
|
|
10597
10652
|
}
|
|
10598
|
-
this
|
|
10653
|
+
__classPrivateFieldSet(this, _Grid_offsetX, __classPrivateFieldGet(this, _Grid_offsetX, "f") + 1, "f");
|
|
10599
10654
|
}
|
|
10600
10655
|
/**
|
|
10601
10656
|
* Add a new column at the end of the x axis.
|
|
10602
10657
|
*/
|
|
10603
10658
|
addColumnRight() {
|
|
10604
|
-
for (const row of this
|
|
10659
|
+
for (const row of __classPrivateFieldGet(this, _Grid_grid, "f")) {
|
|
10605
10660
|
row.push(undefined);
|
|
10606
10661
|
}
|
|
10607
10662
|
}
|
|
@@ -10610,28 +10665,28 @@ class Grid {
|
|
|
10610
10665
|
*/
|
|
10611
10666
|
addRowTop() {
|
|
10612
10667
|
const newRow = [];
|
|
10613
|
-
for (let i = 0; i < this
|
|
10668
|
+
for (let i = 0; i < __classPrivateFieldGet(this, _Grid_grid, "f")[0].length; ++i) {
|
|
10614
10669
|
newRow.push(undefined);
|
|
10615
10670
|
}
|
|
10616
|
-
this.
|
|
10617
|
-
this
|
|
10671
|
+
__classPrivateFieldGet(this, _Grid_grid, "f").splice(0, 0, newRow);
|
|
10672
|
+
__classPrivateFieldSet(this, _Grid_offsetY, __classPrivateFieldGet(this, _Grid_offsetY, "f") + 1, "f");
|
|
10618
10673
|
}
|
|
10619
10674
|
/**
|
|
10620
10675
|
* Add a new row at the end of the y axis.
|
|
10621
10676
|
*/
|
|
10622
10677
|
addRowBottom() {
|
|
10623
10678
|
const newRow = [];
|
|
10624
|
-
for (let i = 0; i < this
|
|
10679
|
+
for (let i = 0; i < __classPrivateFieldGet(this, _Grid_grid, "f")[0].length; ++i) {
|
|
10625
10680
|
newRow.push(undefined);
|
|
10626
10681
|
}
|
|
10627
|
-
this.
|
|
10682
|
+
__classPrivateFieldGet(this, _Grid_grid, "f").push(newRow);
|
|
10628
10683
|
}
|
|
10629
10684
|
/**
|
|
10630
10685
|
* Get the element at the given coordinates or undefined if there is no element at the given coordinates.
|
|
10631
10686
|
*/
|
|
10632
10687
|
get(coords) {
|
|
10633
|
-
if (this
|
|
10634
|
-
return this
|
|
10688
|
+
if (__classPrivateFieldGet(this, _Grid_grid, "f")[coords[1] + __classPrivateFieldGet(this, _Grid_offsetY, "f")]) {
|
|
10689
|
+
return __classPrivateFieldGet(this, _Grid_grid, "f")[coords[1] + __classPrivateFieldGet(this, _Grid_offsetY, "f")][coords[0] + __classPrivateFieldGet(this, _Grid_offsetX, "f")];
|
|
10635
10690
|
}
|
|
10636
10691
|
return undefined;
|
|
10637
10692
|
}
|
|
@@ -10639,19 +10694,19 @@ class Grid {
|
|
|
10639
10694
|
* Set the element at the given coordinates to the given element.
|
|
10640
10695
|
*/
|
|
10641
10696
|
set(coords, value) {
|
|
10642
|
-
while (coords[0] < -this
|
|
10697
|
+
while (coords[0] < -__classPrivateFieldGet(this, _Grid_offsetX, "f")) {
|
|
10643
10698
|
this.addColumnLeft();
|
|
10644
10699
|
}
|
|
10645
|
-
while (coords[0] >= this.width() - this
|
|
10700
|
+
while (coords[0] >= this.width() - __classPrivateFieldGet(this, _Grid_offsetX, "f")) {
|
|
10646
10701
|
this.addColumnRight();
|
|
10647
10702
|
}
|
|
10648
|
-
while (coords[1] < -this
|
|
10703
|
+
while (coords[1] < -__classPrivateFieldGet(this, _Grid_offsetY, "f")) {
|
|
10649
10704
|
this.addRowTop();
|
|
10650
10705
|
}
|
|
10651
|
-
while (coords[1] >= this.height() - this
|
|
10706
|
+
while (coords[1] >= this.height() - __classPrivateFieldGet(this, _Grid_offsetY, "f")) {
|
|
10652
10707
|
this.addRowBottom();
|
|
10653
10708
|
}
|
|
10654
|
-
this
|
|
10709
|
+
__classPrivateFieldGet(this, _Grid_grid, "f")[coords[1] + __classPrivateFieldGet(this, _Grid_offsetY, "f")][coords[0] + __classPrivateFieldGet(this, _Grid_offsetX, "f")] = value;
|
|
10655
10710
|
}
|
|
10656
10711
|
/**
|
|
10657
10712
|
* Get the closest coordinates to the given coordinates that are not set to an element.
|
|
@@ -10681,6 +10736,7 @@ class Grid {
|
|
|
10681
10736
|
}
|
|
10682
10737
|
}
|
|
10683
10738
|
}
|
|
10739
|
+
_Grid_grid = new WeakMap(), _Grid_offsetX = new WeakMap(), _Grid_offsetY = new WeakMap();
|
|
10684
10740
|
|
|
10685
10741
|
/**
|
|
10686
10742
|
* A layout which places adjacent nodes close by, placing nodes in order according to depth first search.
|