@metadev/daga 5.1.0 → 5.1.2

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/index.cjs.js CHANGED
@@ -1172,7 +1172,9 @@ exports.CursorStyle = void 0;
1172
1172
  CursorStyle["Grabbing"] = "grabbing";
1173
1173
  CursorStyle["Move"] = "move";
1174
1174
  CursorStyle["NoDrop"] = "no-drop";
1175
+ CursorStyle["NESWResize"] = "nesw-resize";
1175
1176
  CursorStyle["NSResize"] = "ns-resize";
1177
+ CursorStyle["NWSEResize"] = "nwse-resize";
1176
1178
  CursorStyle["NotAllowed"] = "not-allowed";
1177
1179
  CursorStyle["ZoomIn"] = "zoom-in";
1178
1180
  CursorStyle["ZoomOut"] = "zoom-out";
@@ -1271,283 +1273,6 @@ const extractLooksFromConfig = lookConfig => {
1271
1273
  };
1272
1274
  };
1273
1275
 
1274
- /**
1275
- * Represents a collection of diagram entities of a type that exists as part of a diagram model.
1276
- * @public
1277
- * @see DiagramEntity
1278
- * @see DiagramModel
1279
- */
1280
- class DiagramEntitySet {
1281
- constructor() {
1282
- /**
1283
- * The list of entities contained in this set.
1284
- * @private
1285
- */
1286
- this.entities = [];
1287
- /**
1288
- * A mapping of entity ids to their corresponding entity in this set for quickly fetching entities based on their id.
1289
- * @private
1290
- */
1291
- this.entityMap = {};
1292
- }
1293
- /**
1294
- * The number of entities in this set.
1295
- * @public
1296
- */
1297
- get length() {
1298
- return this.size();
1299
- }
1300
- /**
1301
- * Gets all of the entities of this set.
1302
- * @public
1303
- * @returns An array containing all of the entities of this set.
1304
- */
1305
- all() {
1306
- return [...this.entities];
1307
- }
1308
- /**
1309
- * Adds an entity to this set if there are no entities with the same id. Has no effect if there already exists an entity with the same id as the given entity.
1310
- * For creating entities with relationships with other entities, the new() method should be used instead. The add() method adds an entity but doesn't take care of setting that entity's relationships with other entities.
1311
- * @private
1312
- * @param entity An entity to be added to this set.
1313
- */
1314
- add(entity) {
1315
- if (this.entityMap[entity.id] === undefined) {
1316
- this.entityMap[entity.id] = entity;
1317
- this.entities.push(entity);
1318
- }
1319
- }
1320
- /**
1321
- * Removes all the entities in this set.
1322
- * @public
1323
- */
1324
- clear() {
1325
- // remove each entity individually in case classes that extend this implement their own specific cleanup
1326
- while (this.entities.length > 0) {
1327
- this.remove(this.entities[0].id);
1328
- }
1329
- }
1330
- /**
1331
- * Checks if this set contains an entity with the given id.
1332
- * @public
1333
- * @param id An id.
1334
- * @returns `true` if this set contains an entity with the given id, `false` otherwise.
1335
- */
1336
- contains(id) {
1337
- return this.entityMap[id] !== undefined;
1338
- }
1339
- /**
1340
- * Counts the number of entities of this set following the given criteria.
1341
- * @public
1342
- * @returns The number of entities of this set following the given criteria.
1343
- */
1344
- count(predicate) {
1345
- return this.entities.filter(predicate).length;
1346
- }
1347
- /**
1348
- * Gets all of the entities of this set filtered following given criteria.
1349
- * @public
1350
- * @returns An array containing the entities of this set that meet the given criteria.
1351
- */
1352
- filter(predicate) {
1353
- return this.entities.filter(predicate);
1354
- }
1355
- /**
1356
- * Gets an entity of this set matching specific criteria.
1357
- * @public
1358
- * @returns An entity of this set.
1359
- */
1360
- find(predicate) {
1361
- return this.entities.find(predicate);
1362
- }
1363
- /**
1364
- * Gets an entity from this set.
1365
- * @public
1366
- * @param id An id.
1367
- * @returns An entity with the given id, or `undefined` if there are no entities with the given id.
1368
- */
1369
- get(id) {
1370
- return this.entityMap[id];
1371
- }
1372
- /**
1373
- * Gets all of the entities of this set mapped to the result of the given function applied to them.
1374
- * @public
1375
- * @returns An array containing the entities of this set that meet the given criteria.
1376
- */
1377
- map(callback) {
1378
- return this.entities.map(callback);
1379
- }
1380
- /**
1381
- * Attempts to find and remove an entity with the given id. Has no effect if there are no entities with the given id.
1382
- * @public
1383
- * @param id An id.
1384
- */
1385
- remove(id) {
1386
- const entity = this.get(id);
1387
- if (entity !== undefined) {
1388
- delete this.entityMap[id];
1389
- removeIfExists(this.entities, entity);
1390
- }
1391
- }
1392
- /**
1393
- * Gets the number of entities in this set.
1394
- * @public
1395
- */
1396
- size() {
1397
- return this.entities.length;
1398
- }
1399
- /**
1400
- * Iterator to iterate over the entities of this set.
1401
- * @public
1402
- */
1403
- *[Symbol.iterator]() {
1404
- for (const entity of this.entities) {
1405
- yield entity;
1406
- }
1407
- }
1408
- }
1409
-
1410
- /**
1411
- * Default priority value for diagram elements.
1412
- * @private
1413
- */
1414
- const DEFAULT_PRIORITY = 0;
1415
- /**
1416
- * Represents an object which exists as part of a specific diagram model and has a visual representation in a diagram canvas.
1417
- * @public
1418
- * @see DiagramModel
1419
- * @see DiagramCanvas
1420
- */
1421
- class DiagramElement {
1422
- /**
1423
- * Identifier that uniquely identifies this element within its diagram model. Cannot be an empty string.
1424
- * @public
1425
- */
1426
- get id() {
1427
- return this._id;
1428
- }
1429
- /**
1430
- * Whether this diagram element is currently in the user highlight.
1431
- * @private
1432
- */
1433
- get highlighted() {
1434
- var _a, _b;
1435
- return ((_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userHighlight) === null || _b === void 0 ? void 0 : _b.contains(this.id)) || false;
1436
- }
1437
- /**
1438
- * Whether this diagram element is currently in the user selection.
1439
- */
1440
- get selected() {
1441
- var _a, _b;
1442
- 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;
1443
- }
1444
- constructor(model, id) {
1445
- /**
1446
- * Whether this diagram element has itself been explicitly removed.
1447
- *
1448
- * Override the `removed` getter so that it returns true if and only if:
1449
- * - `selfRemoved` is true, or
1450
- * - `removed` is true for any of this element's dependencies.
1451
- *
1452
- * For example, a DiagramConnection is removed if either of its ports are removed,
1453
- * even if the connection's own `selfRemoved` field is false.
1454
- * @private
1455
- */
1456
- this.selfRemoved = false;
1457
- /**
1458
- * Collaborative timestamp for selfRemoved.
1459
- * @private
1460
- */
1461
- this.selfRemovedTimestamp = null;
1462
- this.model = model;
1463
- this._id = id;
1464
- }
1465
- /**
1466
- * Obtain the selection of this element.
1467
- * @private
1468
- */
1469
- select() {
1470
- var _a, _b;
1471
- 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)}']`);
1472
- }
1473
- }
1474
- class DiagramElementSet extends DiagramEntitySet {
1475
- all(includeRemoved = false) {
1476
- if (includeRemoved) {
1477
- return super.all();
1478
- } else {
1479
- return super.filter(e => !e.removed);
1480
- }
1481
- }
1482
- contains(id, includeRemoved = false) {
1483
- if (includeRemoved) {
1484
- return super.contains(id);
1485
- } else {
1486
- return super.contains(id) && !this.entityMap[id].removed;
1487
- }
1488
- }
1489
- count(predicate, includeRemoved = false) {
1490
- if (includeRemoved) {
1491
- return super.count(predicate);
1492
- } else {
1493
- return super.count((e, i, a) => predicate(e, i, a) && !e.removed);
1494
- }
1495
- }
1496
- filter(predicate, includeRemoved = false) {
1497
- if (includeRemoved) {
1498
- return super.filter(predicate);
1499
- } else {
1500
- return super.filter((e, i, a) => predicate(e, i, a) && !e.removed);
1501
- }
1502
- }
1503
- find(predicate, includeRemoved = false) {
1504
- if (includeRemoved) {
1505
- return super.find(predicate);
1506
- } else {
1507
- return super.find((e, i, a) => predicate(e, i, a) && !e.removed);
1508
- }
1509
- }
1510
- get(id, includeRemoved = false) {
1511
- if (includeRemoved) {
1512
- return super.get(id);
1513
- } else {
1514
- return this.contains(id) ? super.get(id) : undefined;
1515
- }
1516
- }
1517
- map(callback, includeRemoved = false) {
1518
- if (includeRemoved) {
1519
- return super.map(callback);
1520
- } else {
1521
- return super.filter(e => !e.removed).map(callback);
1522
- }
1523
- }
1524
- remove(id) {
1525
- const entity = this.get(id, true);
1526
- if (entity !== undefined) {
1527
- delete this.entityMap[id];
1528
- removeIfExists(this.entities, entity);
1529
- }
1530
- }
1531
- size(includeRemoved = false) {
1532
- if (includeRemoved) {
1533
- return super.size();
1534
- } else {
1535
- return super.filter(e => !e.removed).length;
1536
- }
1537
- }
1538
- *[Symbol.iterator](includeRemoved = false) {
1539
- if (includeRemoved) {
1540
- for (const entity of this.entities) {
1541
- yield entity;
1542
- }
1543
- } else {
1544
- for (const entity of this.entities.filter(e => !e.removed)) {
1545
- yield entity;
1546
- }
1547
- }
1548
- }
1549
- }
1550
-
1551
1276
  /**
1552
1277
  * A property which is part of a property set and defines what values a value in a value set can take.
1553
1278
  * @public
@@ -2044,94 +1769,371 @@ class ValueSet {
2044
1769
  }
2045
1770
  }
2046
1771
  /**
2047
- * Variant of `overwriteValues` that applies last-writer-wins to each key, updating timestamps if appropriate.
2048
- * @private
2049
- * @param values An object containing all values to set the values to.
1772
+ * Variant of `overwriteValues` that applies last-writer-wins to each key, updating timestamps if appropriate.
1773
+ * @private
1774
+ * @param values An object containing all values to set the values to.
1775
+ */
1776
+ overwriteValuesLww(values, timestamp) {
1777
+ for (const key in values) {
1778
+ const property = this.propertySet.getProperty(key);
1779
+ if (property.type === exports.Type.Object) {
1780
+ this.valueSets[key].overwriteValuesLww(values[key], timestamp);
1781
+ } else {
1782
+ if (timestampWins(timestamp, this.ownTimestamps[key])) {
1783
+ this.setValue(key, values[key]);
1784
+ this.ownTimestamps[key] = timestamp;
1785
+ }
1786
+ }
1787
+ }
1788
+ }
1789
+ /**
1790
+ * Sets all the values of this set to the defaults.
1791
+ * If this set has a root element and any of its properties have root attributes, the root element's attributes are also set to the property's default value if one is provided.
1792
+ * @private
1793
+ */
1794
+ resetValues() {
1795
+ this.displayedProperties = [];
1796
+ this.hiddenProperties = [];
1797
+ this.ownTimestamps = {};
1798
+ for (const key in this.propertySet.propertyMap) {
1799
+ const property = this.propertySet.getProperty(key);
1800
+ const rootAttribute = property.rootAttribute;
1801
+ if (property.type === exports.Type.Object) {
1802
+ this.valueSets[key] = this.constructSubValueSet(key);
1803
+ } else {
1804
+ this.values[key] = clone(property.defaultValue);
1805
+ }
1806
+ if (rootAttribute !== undefined && rootAttribute !== null) {
1807
+ if (property.defaultValue !== undefined && !equals(this.getRootElementValue(rootAttribute), property.defaultValue)) {
1808
+ this.setRootElementValue(rootAttribute, this.values[key]);
1809
+ }
1810
+ }
1811
+ if (property.basic !== false) {
1812
+ this.displayedProperties.push(property);
1813
+ } else {
1814
+ this.hiddenProperties.push(property);
1815
+ }
1816
+ }
1817
+ }
1818
+ /**
1819
+ * Constructs a ValueSet with its corresponding PropertySet representing the values of the object.
1820
+ * @private
1821
+ * @param key Key that the ValueSet is under.
1822
+ * @returns The constructed ValueSet.
1823
+ */
1824
+ constructSubValueSet(key) {
1825
+ const property = this.propertySet.getProperty(key);
1826
+ const propertySet = new PropertySet(property.properties);
1827
+ const valueSet = new ValueSet(propertySet, this.rootElement);
1828
+ valueSet.overwriteValues(clone(property.defaultValue));
1829
+ return valueSet;
1830
+ }
1831
+ /**
1832
+ * Gets the ValueSet under the given key when there are nested ValueSets.
1833
+ * @private
1834
+ * @param key A key.
1835
+ * @returns A ValueSet.
1836
+ */
1837
+ getSubValueSet(key) {
1838
+ return this.valueSets[key];
1839
+ }
1840
+ /**
1841
+ * Moves the given property to the list of displayed properties.
1842
+ * @private
1843
+ * @param property A property.
1844
+ */
1845
+ displayProperty(property) {
1846
+ if (!this.displayedProperties.includes(property)) {
1847
+ this.displayedProperties.push(property);
1848
+ removeIfExists(this.hiddenProperties, property);
1849
+ }
1850
+ }
1851
+ /**
1852
+ * Moves the given property to the list of hidden properties.
1853
+ * @private
1854
+ * @param property A property.
1855
+ */
1856
+ hideProperty(property) {
1857
+ if (!this.hiddenProperties.includes(property)) {
1858
+ this.hiddenProperties.push(property);
1859
+ removeIfExists(this.displayedProperties, property);
1860
+ }
1861
+ }
1862
+ }
1863
+
1864
+ /**
1865
+ * Represents a collection of diagram entities of a type that exists as part of a diagram model.
1866
+ * @public
1867
+ * @see DiagramEntity
1868
+ * @see DiagramModel
1869
+ */
1870
+ class DiagramEntitySet {
1871
+ constructor() {
1872
+ /**
1873
+ * The list of entities contained in this set.
1874
+ * @private
1875
+ */
1876
+ this.entities = [];
1877
+ /**
1878
+ * A mapping of entity ids to their corresponding entity in this set for quickly fetching entities based on their id.
1879
+ * @private
1880
+ */
1881
+ this.entityMap = {};
1882
+ }
1883
+ /**
1884
+ * The number of entities in this set.
1885
+ * @public
1886
+ */
1887
+ get length() {
1888
+ return this.size();
1889
+ }
1890
+ /**
1891
+ * Gets all of the entities of this set.
1892
+ * @public
1893
+ * @returns An array containing all of the entities of this set.
1894
+ */
1895
+ all() {
1896
+ return [...this.entities];
1897
+ }
1898
+ /**
1899
+ * Adds an entity to this set if there are no entities with the same id. Has no effect if there already exists an entity with the same id as the given entity.
1900
+ * For creating entities with relationships with other entities, the new() method should be used instead. The add() method adds an entity but doesn't take care of setting that entity's relationships with other entities.
1901
+ * @private
1902
+ * @param entity An entity to be added to this set.
1903
+ */
1904
+ add(entity) {
1905
+ if (this.entityMap[entity.id] === undefined) {
1906
+ this.entityMap[entity.id] = entity;
1907
+ this.entities.push(entity);
1908
+ }
1909
+ }
1910
+ /**
1911
+ * Removes all the entities in this set.
1912
+ * @public
1913
+ */
1914
+ clear() {
1915
+ // remove each entity individually in case classes that extend this implement their own specific cleanup
1916
+ while (this.entities.length > 0) {
1917
+ this.remove(this.entities[0].id);
1918
+ }
1919
+ }
1920
+ /**
1921
+ * Checks if this set contains an entity with the given id.
1922
+ * @public
1923
+ * @param id An id.
1924
+ * @returns `true` if this set contains an entity with the given id, `false` otherwise.
1925
+ */
1926
+ contains(id) {
1927
+ return this.entityMap[id] !== undefined;
1928
+ }
1929
+ /**
1930
+ * Counts the number of entities of this set following the given criteria.
1931
+ * @public
1932
+ * @returns The number of entities of this set following the given criteria.
1933
+ */
1934
+ count(predicate) {
1935
+ return this.entities.filter(predicate).length;
1936
+ }
1937
+ /**
1938
+ * Gets all of the entities of this set filtered following given criteria.
1939
+ * @public
1940
+ * @returns An array containing the entities of this set that meet the given criteria.
1941
+ */
1942
+ filter(predicate) {
1943
+ return this.entities.filter(predicate);
1944
+ }
1945
+ /**
1946
+ * Gets an entity of this set matching specific criteria.
1947
+ * @public
1948
+ * @returns An entity of this set.
1949
+ */
1950
+ find(predicate) {
1951
+ return this.entities.find(predicate);
1952
+ }
1953
+ /**
1954
+ * Gets an entity from this set.
1955
+ * @public
1956
+ * @param id An id.
1957
+ * @returns An entity with the given id, or `undefined` if there are no entities with the given id.
1958
+ */
1959
+ get(id) {
1960
+ return this.entityMap[id];
1961
+ }
1962
+ /**
1963
+ * Gets all of the entities of this set mapped to the result of the given function applied to them.
1964
+ * @public
1965
+ * @returns An array containing the entities of this set that meet the given criteria.
1966
+ */
1967
+ map(callback) {
1968
+ return this.entities.map(callback);
1969
+ }
1970
+ /**
1971
+ * Attempts to find and remove an entity with the given id. Has no effect if there are no entities with the given id.
1972
+ * @public
1973
+ * @param id An id.
1974
+ */
1975
+ remove(id) {
1976
+ const entity = this.get(id);
1977
+ if (entity !== undefined) {
1978
+ delete this.entityMap[id];
1979
+ removeIfExists(this.entities, entity);
1980
+ }
1981
+ }
1982
+ /**
1983
+ * Gets the number of entities in this set.
1984
+ * @public
2050
1985
  */
2051
- overwriteValuesLww(values, timestamp) {
2052
- for (const key in values) {
2053
- const property = this.propertySet.getProperty(key);
2054
- if (property.type === exports.Type.Object) {
2055
- this.valueSets[key].overwriteValuesLww(values[key], timestamp);
2056
- } else {
2057
- if (timestampWins(timestamp, this.ownTimestamps[key])) {
2058
- this.setValue(key, values[key]);
2059
- this.ownTimestamps[key] = timestamp;
2060
- }
2061
- }
2062
- }
1986
+ size() {
1987
+ return this.entities.length;
2063
1988
  }
2064
1989
  /**
2065
- * Sets all the values of this set to the defaults.
2066
- * If this set has a root element and any of its properties have root attributes, the root element's attributes are also set to the property's default value if one is provided.
2067
- * @private
1990
+ * Iterator to iterate over the entities of this set.
1991
+ * @public
2068
1992
  */
2069
- resetValues() {
2070
- this.displayedProperties = [];
2071
- this.hiddenProperties = [];
2072
- this.ownTimestamps = {};
2073
- for (const key in this.propertySet.propertyMap) {
2074
- const property = this.propertySet.getProperty(key);
2075
- const rootAttribute = property.rootAttribute;
2076
- if (property.type === exports.Type.Object) {
2077
- this.valueSets[key] = this.constructSubValueSet(key);
2078
- } else {
2079
- this.values[key] = clone(property.defaultValue);
2080
- }
2081
- if (rootAttribute !== undefined && rootAttribute !== null) {
2082
- if (property.defaultValue !== undefined && !equals(this.getRootElementValue(rootAttribute), property.defaultValue)) {
2083
- this.setRootElementValue(rootAttribute, this.values[key]);
2084
- }
2085
- }
2086
- if (property.basic !== false) {
2087
- this.displayedProperties.push(property);
2088
- } else {
2089
- this.hiddenProperties.push(property);
2090
- }
1993
+ *[Symbol.iterator]() {
1994
+ for (const entity of this.entities) {
1995
+ yield entity;
2091
1996
  }
2092
1997
  }
1998
+ }
1999
+
2000
+ /**
2001
+ * Default priority value for diagram elements.
2002
+ * @private
2003
+ */
2004
+ const DEFAULT_PRIORITY = 0;
2005
+ /**
2006
+ * Represents an object which exists as part of a specific diagram model and has a visual representation in a diagram canvas.
2007
+ * @public
2008
+ * @see DiagramModel
2009
+ * @see DiagramCanvas
2010
+ */
2011
+ class DiagramElement {
2093
2012
  /**
2094
- * Constructs a ValueSet with its corresponding PropertySet representing the values of the object.
2095
- * @private
2096
- * @param key Key that the ValueSet is under.
2097
- * @returns The constructed ValueSet.
2013
+ * Identifier that uniquely identifies this element within its diagram model. Cannot be an empty string.
2014
+ * @public
2098
2015
  */
2099
- constructSubValueSet(key) {
2100
- const property = this.propertySet.getProperty(key);
2101
- const propertySet = new PropertySet(property.properties);
2102
- const valueSet = new ValueSet(propertySet, this.rootElement);
2103
- valueSet.overwriteValues(clone(property.defaultValue));
2104
- return valueSet;
2016
+ get id() {
2017
+ return this._id;
2105
2018
  }
2106
2019
  /**
2107
- * Gets the ValueSet under the given key when there are nested ValueSets.
2020
+ * Whether this diagram element is currently in the user highlight.
2108
2021
  * @private
2109
- * @param key A key.
2110
- * @returns A ValueSet.
2111
2022
  */
2112
- getSubValueSet(key) {
2113
- return this.valueSets[key];
2023
+ get highlighted() {
2024
+ var _a, _b;
2025
+ return ((_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userHighlight) === null || _b === void 0 ? void 0 : _b.contains(this.id)) || false;
2114
2026
  }
2115
2027
  /**
2116
- * Moves the given property to the list of displayed properties.
2117
- * @private
2118
- * @param property A property.
2028
+ * Whether this diagram element is currently in the user selection.
2119
2029
  */
2120
- displayProperty(property) {
2121
- if (!this.displayedProperties.includes(property)) {
2122
- this.displayedProperties.push(property);
2123
- removeIfExists(this.hiddenProperties, property);
2124
- }
2030
+ get selected() {
2031
+ var _a, _b;
2032
+ return ((_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.userSelection) === null || _b === void 0 ? void 0 : _b.contains(this.id)) || false;
2033
+ }
2034
+ constructor(model, id) {
2035
+ /**
2036
+ * Whether this diagram element has itself been explicitly removed.
2037
+ *
2038
+ * Override the `removed` getter so that it returns true if and only if:
2039
+ * - `selfRemoved` is true, or
2040
+ * - `removed` is true for any of this element's dependencies.
2041
+ *
2042
+ * For example, a DiagramConnection is removed if either of its ports are removed,
2043
+ * even if the connection's own `selfRemoved` field is false.
2044
+ * @private
2045
+ */
2046
+ this.selfRemoved = false;
2047
+ /**
2048
+ * Collaborative timestamp for selfRemoved.
2049
+ * @private
2050
+ */
2051
+ this.selfRemovedTimestamp = null;
2052
+ this.model = model;
2053
+ this._id = id;
2125
2054
  }
2126
2055
  /**
2127
- * Moves the given property to the list of hidden properties.
2056
+ * Obtain the selection of this element.
2128
2057
  * @private
2129
- * @param property A property.
2130
2058
  */
2131
- hideProperty(property) {
2132
- if (!this.hiddenProperties.includes(property)) {
2133
- this.hiddenProperties.push(property);
2134
- removeIfExists(this.displayedProperties, property);
2059
+ select() {
2060
+ var _a, _b;
2061
+ return (_b = (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.selectCanvasView()) === null || _b === void 0 ? void 0 : _b.select(`[id='${escapeSelector(this.id)}']`);
2062
+ }
2063
+ }
2064
+ class DiagramElementSet extends DiagramEntitySet {
2065
+ all(includeRemoved = false) {
2066
+ if (includeRemoved) {
2067
+ return super.all();
2068
+ } else {
2069
+ return super.filter(e => !e.removed);
2070
+ }
2071
+ }
2072
+ contains(id, includeRemoved = false) {
2073
+ if (includeRemoved) {
2074
+ return super.contains(id);
2075
+ } else {
2076
+ return super.contains(id) && !this.entityMap[id].removed;
2077
+ }
2078
+ }
2079
+ count(predicate, includeRemoved = false) {
2080
+ if (includeRemoved) {
2081
+ return super.count(predicate);
2082
+ } else {
2083
+ return super.count((e, i, a) => predicate(e, i, a) && !e.removed);
2084
+ }
2085
+ }
2086
+ filter(predicate, includeRemoved = false) {
2087
+ if (includeRemoved) {
2088
+ return super.filter(predicate);
2089
+ } else {
2090
+ return super.filter((e, i, a) => predicate(e, i, a) && !e.removed);
2091
+ }
2092
+ }
2093
+ find(predicate, includeRemoved = false) {
2094
+ if (includeRemoved) {
2095
+ return super.find(predicate);
2096
+ } else {
2097
+ return super.find((e, i, a) => predicate(e, i, a) && !e.removed);
2098
+ }
2099
+ }
2100
+ get(id, includeRemoved = false) {
2101
+ if (includeRemoved) {
2102
+ return super.get(id);
2103
+ } else {
2104
+ return this.contains(id) ? super.get(id) : undefined;
2105
+ }
2106
+ }
2107
+ map(callback, includeRemoved = false) {
2108
+ if (includeRemoved) {
2109
+ return super.map(callback);
2110
+ } else {
2111
+ return super.filter(e => !e.removed).map(callback);
2112
+ }
2113
+ }
2114
+ remove(id) {
2115
+ const entity = this.get(id, true);
2116
+ if (entity !== undefined) {
2117
+ delete this.entityMap[id];
2118
+ removeIfExists(this.entities, entity);
2119
+ }
2120
+ }
2121
+ size(includeRemoved = false) {
2122
+ if (includeRemoved) {
2123
+ return super.size();
2124
+ } else {
2125
+ return super.filter(e => !e.removed).length;
2126
+ }
2127
+ }
2128
+ *[Symbol.iterator](includeRemoved = false) {
2129
+ if (includeRemoved) {
2130
+ for (const entity of this.entities) {
2131
+ yield entity;
2132
+ }
2133
+ } else {
2134
+ for (const entity of this.entities.filter(e => !e.removed)) {
2135
+ yield entity;
2136
+ }
2135
2137
  }
2136
2138
  }
2137
2139
  }
@@ -2145,7 +2147,6 @@ const DIAGRAM_CONNECTION_TYPE_DEFAULTS = {
2145
2147
  name: '',
2146
2148
  label: null,
2147
2149
  look: {
2148
- lookType: 'connection-look',
2149
2150
  color: '#000000',
2150
2151
  thickness: 1,
2151
2152
  shape: exports.LineShape.Straight,
@@ -2687,9 +2688,26 @@ class DiagramConnectionSet extends DiagramElementSet {
2687
2688
  }
2688
2689
  }
2689
2690
 
2691
+ /**
2692
+ * The different modes for when a node or section can be resized.
2693
+ * @public
2694
+ * @see DiagramNode
2695
+ * @see DiagramSection
2696
+ */
2690
2697
  exports.ResizableMode = void 0;
2691
2698
  (function (ResizableMode) {
2692
- ResizableMode[ResizableMode["OnlyWhenSelected"] = 0] = "OnlyWhenSelected";
2699
+ /**
2700
+ * Resizable mode for always being resizable.
2701
+ */
2702
+ ResizableMode[ResizableMode["Always"] = 0] = "Always";
2703
+ /**
2704
+ * Resizable mode for only being resizable while selected.
2705
+ */
2706
+ ResizableMode[ResizableMode["OnlyWhenSelected"] = 1] = "OnlyWhenSelected";
2707
+ /**
2708
+ * Resizable mode for never being resizable.
2709
+ */
2710
+ ResizableMode[ResizableMode["Never"] = 2] = "Never";
2693
2711
  })(exports.ResizableMode || (exports.ResizableMode = {}));
2694
2712
 
2695
2713
  /**
@@ -2708,7 +2726,6 @@ const DIAGRAM_FIELD_DEFAULTS = {
2708
2726
  fit: false,
2709
2727
  shrink: true,
2710
2728
  look: {
2711
- lookType: 'field-look',
2712
2729
  fillColor: 'transparent',
2713
2730
  fontColor: '#000000',
2714
2731
  fontFamily: "'Wonder Unit Sans', sans-serif",
@@ -2881,9 +2898,7 @@ const getBottomMargin = config => {
2881
2898
  } else if (typeof config.margin === 'number') {
2882
2899
  return config.margin;
2883
2900
  } else {
2884
- if (config.margin.length === 0) {
2885
- return DIAGRAM_FIELD_DEFAULTS.margin;
2886
- } else if (config.margin.length === 1) {
2901
+ if (config.margin.length === 1) {
2887
2902
  return config.margin[0];
2888
2903
  } else if (config.margin.length === 2) {
2889
2904
  return config.margin[0];
@@ -2900,9 +2915,7 @@ const getLeftMargin = config => {
2900
2915
  } else if (typeof config.margin === 'number') {
2901
2916
  return config.margin;
2902
2917
  } else {
2903
- if (config.margin.length === 0) {
2904
- return DIAGRAM_FIELD_DEFAULTS.margin;
2905
- } else if (config.margin.length === 1) {
2918
+ if (config.margin.length === 1) {
2906
2919
  return config.margin[0];
2907
2920
  } else if (config.margin.length === 2) {
2908
2921
  return config.margin[1];
@@ -2919,9 +2932,7 @@ const getRightMargin = config => {
2919
2932
  } else if (typeof config.margin === 'number') {
2920
2933
  return config.margin;
2921
2934
  } else {
2922
- if (config.margin.length === 0) {
2923
- return DIAGRAM_FIELD_DEFAULTS.margin;
2924
- } else if (config.margin.length === 1) {
2935
+ if (config.margin.length === 1) {
2925
2936
  return config.margin[0];
2926
2937
  } else if (config.margin.length === 2) {
2927
2938
  return config.margin[1];
@@ -2938,9 +2949,7 @@ const getTopMargin = config => {
2938
2949
  } else if (typeof config.margin === 'number') {
2939
2950
  return config.margin;
2940
2951
  } else {
2941
- if (config.margin.length === 0) {
2942
- return DIAGRAM_FIELD_DEFAULTS.margin;
2943
- } else if (config.margin.length === 1) {
2952
+ if (config.margin.length === 1) {
2944
2953
  return config.margin[0];
2945
2954
  } else if (config.margin.length === 2) {
2946
2955
  return config.margin[0];
@@ -2957,9 +2966,7 @@ const getBottomPadding$1 = config => {
2957
2966
  } else if (typeof config.padding === 'number') {
2958
2967
  return config.padding;
2959
2968
  } else {
2960
- if (config.padding.length === 0) {
2961
- return DIAGRAM_FIELD_DEFAULTS.padding;
2962
- } else if (config.padding.length === 1) {
2969
+ if (config.padding.length === 1) {
2963
2970
  return config.padding[0];
2964
2971
  } else if (config.padding.length === 2) {
2965
2972
  return config.padding[0];
@@ -2976,9 +2983,7 @@ const getLeftPadding$1 = config => {
2976
2983
  } else if (typeof config.padding === 'number') {
2977
2984
  return config.padding;
2978
2985
  } else {
2979
- if (config.padding.length === 0) {
2980
- return DIAGRAM_FIELD_DEFAULTS.padding;
2981
- } else if (config.padding.length === 1) {
2986
+ if (config.padding.length === 1) {
2982
2987
  return config.padding[0];
2983
2988
  } else if (config.padding.length === 2) {
2984
2989
  return config.padding[1];
@@ -2995,9 +3000,7 @@ const getRightPadding$1 = config => {
2995
3000
  } else if (typeof config.padding === 'number') {
2996
3001
  return config.padding;
2997
3002
  } else {
2998
- if (config.padding.length === 0) {
2999
- return DIAGRAM_FIELD_DEFAULTS.padding;
3000
- } else if (config.padding.length === 1) {
3003
+ if (config.padding.length === 1) {
3001
3004
  return config.padding[0];
3002
3005
  } else if (config.padding.length === 2) {
3003
3006
  return config.padding[1];
@@ -3014,19 +3017,88 @@ const getTopPadding$1 = config => {
3014
3017
  } else if (typeof config.padding === 'number') {
3015
3018
  return config.padding;
3016
3019
  } else {
3017
- if (config.padding.length === 0) {
3018
- return DIAGRAM_FIELD_DEFAULTS.padding;
3019
- } else if (config.padding.length === 1) {
3020
+ if (config.padding.length === 1) {
3020
3021
  return config.padding[0];
3021
3022
  } else if (config.padding.length === 2) {
3022
3023
  return config.padding[0];
3023
3024
  } else if (config.padding.length === 3) {
3024
3025
  return config.padding[0];
3025
3026
  } else {
3026
- return config.padding[0];
3027
+ return config.padding[0];
3028
+ }
3029
+ }
3030
+ };
3031
+
3032
+ /**
3033
+ * Default values of the parameters of a diagram field.
3034
+ * @private
3035
+ * @see ResizerConfig
3036
+ */
3037
+ const DIAGRAM_RESIZER_DEFAULTS = {
3038
+ mode: exports.ResizableMode.Never,
3039
+ thickness: 10,
3040
+ outerMargin: 0,
3041
+ look: {
3042
+ fillColor: 'transparent',
3043
+ borderColor: 'transparent',
3044
+ borderThickness: 0
3045
+ }
3046
+ };
3047
+ /**
3048
+ * Holds the data for the resizers of a type of node or section.
3049
+ * @public
3050
+ * @see DiagramNode
3051
+ * @see DiagramSection
3052
+ */
3053
+ class DiagramResizer {
3054
+ constructor(options) {
3055
+ var _a;
3056
+ let config;
3057
+ if (typeof options === 'boolean') {
3058
+ config = {
3059
+ mode: options ? exports.ResizableMode.Always : exports.ResizableMode.Never
3060
+ };
3061
+ } else if (typeof options === 'string' || typeof options === 'number') {
3062
+ config = {
3063
+ mode: options
3064
+ };
3065
+ } else {
3066
+ config = options;
3067
+ }
3068
+ config = Object.assign(Object.assign({}, DIAGRAM_RESIZER_DEFAULTS), config);
3069
+ this.mode = config.mode;
3070
+ this.thickness = config.thickness;
3071
+ this.outerMargin = config.outerMargin;
3072
+ const looks = extractLooksFromConfig((_a = config.look) !== null && _a !== void 0 ? _a : DIAGRAM_RESIZER_DEFAULTS.look);
3073
+ this.defaultLook = looks.defaultLook;
3074
+ this.selectedLook = looks.selectedLook;
3075
+ this.highlightedLook = looks.highlightedLook;
3076
+ this.selectedAndHighlightedLook = looks.selectedAndHighlightedLook;
3077
+ }
3078
+ /**
3079
+ * Current look of this resizer.
3080
+ * @private
3081
+ */
3082
+ getLook(rootElement) {
3083
+ if (!rootElement) {
3084
+ return this.defaultLook;
3085
+ }
3086
+ if (rootElement.selected) {
3087
+ if (rootElement.highlighted) {
3088
+ return this.selectedAndHighlightedLook;
3089
+ } else {
3090
+ return this.selectedLook;
3091
+ }
3092
+ } else {
3093
+ if (rootElement.highlighted) {
3094
+ return this.highlightedLook;
3095
+ } else {
3096
+ return this.defaultLook;
3097
+ }
3027
3098
  }
3028
3099
  }
3029
- };
3100
+ }
3101
+ const DIAGRAM_DEFAULT_RESIZER = new DiagramResizer(DIAGRAM_RESIZER_DEFAULTS);
3030
3102
 
3031
3103
  /**
3032
3104
  * Default value of the default width of a diagram section.
@@ -3080,8 +3152,21 @@ class DiagramSectionType {
3080
3152
  this.label = options.label || null;
3081
3153
  this.ports = options.ports || [];
3082
3154
  this.priority = options.priority || DEFAULT_PRIORITY;
3083
- this.resizableX = options.resizableX;
3084
- this.resizableY = options.resizableY;
3155
+ if (typeof options.resizableX === 'undefined') {
3156
+ this.resizerX = undefined;
3157
+ } else {
3158
+ this.resizerX = new DiagramResizer(options.resizableX);
3159
+ }
3160
+ if (typeof options.resizableY === 'undefined') {
3161
+ this.resizerY = undefined;
3162
+ } else {
3163
+ this.resizerY = new DiagramResizer(options.resizableY);
3164
+ }
3165
+ if (typeof options.resizableXY === 'undefined') {
3166
+ this.resizerXY = undefined;
3167
+ } else {
3168
+ this.resizerXY = new DiagramResizer(options.resizableXY);
3169
+ }
3085
3170
  const looks = extractLooksFromConfig(options.look || DIAGRAM_NODE_LOOK_DEFAULTS);
3086
3171
  this.defaultLook = looks.defaultLook;
3087
3172
  this.selectedLook = looks.selectedLook;
@@ -3225,6 +3310,30 @@ class DiagramSection extends DiagramElement {
3225
3310
  var _a, _b, _c, _d, _e, _f;
3226
3311
  return ((_f = (_e = (_d = (_c = (_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.sectionGrid) === null || _c === void 0 ? void 0 : _c.sections) === null || _d === void 0 ? void 0 : _d[this.indexYInNode]) === null || _e === void 0 ? void 0 : _e[this.indexXInNode]) === null || _f === void 0 ? void 0 : _f.priority) || DEFAULT_PRIORITY;
3227
3312
  }
3313
+ /**
3314
+ * Returns the horizontal resizer of this section.
3315
+ * @public
3316
+ */
3317
+ getResizerX() {
3318
+ var _a, _b, _c, _d;
3319
+ return (_d = (_b = (_a = this.type) === null || _a === void 0 ? void 0 : _a.resizerX) !== null && _b !== void 0 ? _b : (_c = this.node) === null || _c === void 0 ? void 0 : _c.getResizerX()) !== null && _d !== void 0 ? _d : DIAGRAM_DEFAULT_RESIZER;
3320
+ }
3321
+ /**
3322
+ * Returns the vertical resizer of this section.
3323
+ * @public
3324
+ */
3325
+ getResizerY() {
3326
+ var _a, _b, _c, _d;
3327
+ return (_d = (_b = (_a = this.type) === null || _a === void 0 ? void 0 : _a.resizerY) !== null && _b !== void 0 ? _b : (_c = this.node) === null || _c === void 0 ? void 0 : _c.getResizerY()) !== null && _d !== void 0 ? _d : DIAGRAM_DEFAULT_RESIZER;
3328
+ }
3329
+ /**
3330
+ * Returns the diagonal resizer of this section.
3331
+ * @public
3332
+ */
3333
+ getResizerXY() {
3334
+ var _a, _b, _c, _d;
3335
+ return (_d = (_b = (_a = this.type) === null || _a === void 0 ? void 0 : _a.resizerXY) !== null && _b !== void 0 ? _b : (_c = this.node) === null || _c === void 0 ? void 0 : _c.getResizerXY()) !== null && _d !== void 0 ? _d : DIAGRAM_DEFAULT_RESIZER;
3336
+ }
3228
3337
  /**
3229
3338
  * Returns whether this section can be resized horizontally.
3230
3339
  * If the section has a specific resizableX setting, it uses that.
@@ -3234,11 +3343,16 @@ class DiagramSection extends DiagramElement {
3234
3343
  getResizableX() {
3235
3344
  var _a;
3236
3345
  const sectionType = this.type;
3237
- if ((sectionType === null || sectionType === void 0 ? void 0 : sectionType.resizableX) !== undefined) {
3238
- if (sectionType.resizableX === exports.ResizableMode.OnlyWhenSelected) {
3239
- return this.selected;
3346
+ if ((sectionType === null || sectionType === void 0 ? void 0 : sectionType.resizerX) !== undefined) {
3347
+ switch (sectionType.resizerX.mode) {
3348
+ case exports.ResizableMode.OnlyWhenSelected:
3349
+ return this.selected;
3350
+ case exports.ResizableMode.Always:
3351
+ return true;
3352
+ case exports.ResizableMode.Never:
3353
+ default:
3354
+ return false;
3240
3355
  }
3241
- return sectionType.resizableX;
3242
3356
  }
3243
3357
  return ((_a = this.node) === null || _a === void 0 ? void 0 : _a.getResizableX()) || false;
3244
3358
  }
@@ -3251,14 +3365,41 @@ class DiagramSection extends DiagramElement {
3251
3365
  getResizableY() {
3252
3366
  var _a;
3253
3367
  const sectionType = this.type;
3254
- if ((sectionType === null || sectionType === void 0 ? void 0 : sectionType.resizableY) !== undefined) {
3255
- if (sectionType.resizableY === exports.ResizableMode.OnlyWhenSelected) {
3256
- return this.selected;
3368
+ if ((sectionType === null || sectionType === void 0 ? void 0 : sectionType.resizerY) !== undefined) {
3369
+ switch (sectionType.resizerY.mode) {
3370
+ case exports.ResizableMode.OnlyWhenSelected:
3371
+ return this.selected;
3372
+ case exports.ResizableMode.Always:
3373
+ return true;
3374
+ case exports.ResizableMode.Never:
3375
+ default:
3376
+ return false;
3257
3377
  }
3258
- return sectionType.resizableY;
3259
3378
  }
3260
3379
  return ((_a = this.node) === null || _a === void 0 ? void 0 : _a.getResizableY()) || false;
3261
3380
  }
3381
+ /**
3382
+ * Returns whether this section can be resized diagonally.
3383
+ * If the section has a specific resizableXY setting, it uses that.
3384
+ * Otherwise, it inherits from the parent node's resizableXY setting.
3385
+ * @public
3386
+ */
3387
+ getResizableXY() {
3388
+ var _a;
3389
+ const sectionType = this.type;
3390
+ if ((sectionType === null || sectionType === void 0 ? void 0 : sectionType.resizerXY) !== undefined) {
3391
+ switch (sectionType.resizerXY.mode) {
3392
+ case exports.ResizableMode.OnlyWhenSelected:
3393
+ return this.selected;
3394
+ case exports.ResizableMode.Always:
3395
+ return true;
3396
+ case exports.ResizableMode.Never:
3397
+ default:
3398
+ return false;
3399
+ }
3400
+ }
3401
+ return ((_a = this.node) === null || _a === void 0 ? void 0 : _a.getResizableXY()) || false;
3402
+ }
3262
3403
  /**
3263
3404
  * Get the port of this section which is closest to the given coordinates.
3264
3405
  * @param coords A point in the diagram.
@@ -3550,6 +3691,7 @@ const DIAGRAM_NODE_TYPE_DEFAULTS = {
3550
3691
  defaultHeight: 1,
3551
3692
  minWidth: 1,
3552
3693
  minHeight: 1,
3694
+ defaultZ: 0,
3553
3695
  resizableX: false,
3554
3696
  resizableY: false,
3555
3697
  snapToGridOffset: [0, 0, 0, 0],
@@ -3579,8 +3721,28 @@ class DiagramNodeType {
3579
3721
  this.defaultHeight = values.defaultHeight;
3580
3722
  this.minWidth = values.minWidth;
3581
3723
  this.minHeight = values.minHeight;
3582
- this.resizableX = values.resizableX;
3583
- this.resizableY = values.resizableY;
3724
+ this.defaultZ = values.defaultZ;
3725
+ if (typeof options.resizableX === 'undefined') {
3726
+ this.resizerX = new DiagramResizer({
3727
+ mode: exports.ResizableMode.Never
3728
+ });
3729
+ } else {
3730
+ this.resizerX = new DiagramResizer(options.resizableX);
3731
+ }
3732
+ if (typeof options.resizableY === 'undefined') {
3733
+ this.resizerY = new DiagramResizer({
3734
+ mode: exports.ResizableMode.Never
3735
+ });
3736
+ } else {
3737
+ this.resizerY = new DiagramResizer(options.resizableY);
3738
+ }
3739
+ if (typeof options.resizableXY === 'undefined') {
3740
+ this.resizerXY = new DiagramResizer({
3741
+ mode: exports.ResizableMode.Never
3742
+ });
3743
+ } else {
3744
+ this.resizerXY = new DiagramResizer(options.resizableXY);
3745
+ }
3584
3746
  this.snapToGridOffset = values.snapToGridOffset;
3585
3747
  this.bottomPadding = getBottomPadding(values);
3586
3748
  this.leftPadding = getLeftPadding(values);
@@ -3649,7 +3811,7 @@ class DiagramNode extends DiagramElement {
3649
3811
  }
3650
3812
  }
3651
3813
  /**
3652
- * Current look of this port.
3814
+ * Current look of this node.
3653
3815
  * @private
3654
3816
  */
3655
3817
  get look() {
@@ -3740,6 +3902,7 @@ class DiagramNode extends DiagramElement {
3740
3902
  this.coords = coords;
3741
3903
  this.width = type.defaultWidth;
3742
3904
  this.height = type.defaultHeight;
3905
+ this.z = type.defaultZ;
3743
3906
  }
3744
3907
  get removed() {
3745
3908
  return this.selfRemoved;
@@ -3767,30 +3930,84 @@ class DiagramNode extends DiagramElement {
3767
3930
  child.raise();
3768
3931
  }
3769
3932
  }
3933
+ /**
3934
+ * Put this element above other elements in the view if they have a lower z coordinate.
3935
+ */
3936
+ raiseWithZ() {
3937
+ this.raise();
3938
+ const overlappingNodesWithHigherPriority = this.model.nodes.filter(n => n.id !== this.id && n.z > this.z && rectanglesIntersect([n.coords, [n.coords[0] + n.width, n.coords[1] + n.height]], [this.coords, [this.coords[0] + this.width, this.coords[1] + this.height]]));
3939
+ for (const n of overlappingNodesWithHigherPriority) {
3940
+ n.raiseWithZ();
3941
+ }
3942
+ }
3770
3943
  getPriority() {
3771
3944
  return this.type.priority;
3772
3945
  }
3946
+ /**
3947
+ * Returns the horizontal resizer of this node.
3948
+ * @public
3949
+ */
3950
+ getResizerX() {
3951
+ return this.type.resizerX;
3952
+ }
3953
+ /**
3954
+ * Returns the vertical resizer of this node.
3955
+ * @public
3956
+ */
3957
+ getResizerY() {
3958
+ return this.type.resizerY;
3959
+ }
3960
+ /**
3961
+ * Returns the diagonal resizer of this node.
3962
+ * @public
3963
+ */
3964
+ getResizerXY() {
3965
+ return this.type.resizerXY;
3966
+ }
3773
3967
  /**
3774
3968
  * Returns whether this node can be resized horizontally.
3775
3969
  * @public
3776
3970
  */
3777
3971
  getResizableX() {
3778
- const resizableX = this.type.resizableX;
3779
- if (resizableX === exports.ResizableMode.OnlyWhenSelected) {
3780
- return this.selected;
3972
+ switch (this.type.resizerX.mode) {
3973
+ case exports.ResizableMode.OnlyWhenSelected:
3974
+ return this.selected;
3975
+ case exports.ResizableMode.Always:
3976
+ return true;
3977
+ case exports.ResizableMode.Never:
3978
+ default:
3979
+ return false;
3781
3980
  }
3782
- return resizableX;
3783
3981
  }
3784
3982
  /**
3785
3983
  * Returns whether this node can be resized vertically.
3786
3984
  * @public
3787
3985
  */
3788
3986
  getResizableY() {
3789
- const resizableY = this.type.resizableY;
3790
- if (resizableY === exports.ResizableMode.OnlyWhenSelected) {
3791
- return this.selected;
3987
+ switch (this.type.resizerY.mode) {
3988
+ case exports.ResizableMode.OnlyWhenSelected:
3989
+ return this.selected;
3990
+ case exports.ResizableMode.Always:
3991
+ return true;
3992
+ case exports.ResizableMode.Never:
3993
+ default:
3994
+ return false;
3995
+ }
3996
+ }
3997
+ /**
3998
+ * Returns whether this node can be resized diagonally.
3999
+ * @public
4000
+ */
4001
+ getResizableXY() {
4002
+ switch (this.type.resizerXY.mode) {
4003
+ case exports.ResizableMode.OnlyWhenSelected:
4004
+ return this.selected;
4005
+ case exports.ResizableMode.Always:
4006
+ return true;
4007
+ case exports.ResizableMode.Never:
4008
+ default:
4009
+ return false;
3792
4010
  }
3793
- return resizableY;
3794
4011
  }
3795
4012
  /**
3796
4013
  * Get the port of this node which is closest to the given coordinates.
@@ -4026,6 +4243,7 @@ class DiagramNode extends DiagramElement {
4026
4243
  }
4027
4244
  this.setGeometry({
4028
4245
  coords,
4246
+ z: this.z,
4029
4247
  width: this.width,
4030
4248
  height: this.height,
4031
4249
  // We already moved the sections above - skip changing them in setDimensions.
@@ -4077,6 +4295,7 @@ class DiagramNode extends DiagramElement {
4077
4295
  }
4078
4296
  this.setGeometry({
4079
4297
  coords: [newCoordsX[0], newCoordsY[0]],
4298
+ z: this.z,
4080
4299
  width: newCoordsX[1] - newCoordsX[0],
4081
4300
  height: newCoordsY[1] - newCoordsY[0],
4082
4301
  // we ignore this.sections, the stretching of a node with sections is handled in the stretchSections method
@@ -4184,6 +4403,7 @@ class DiagramNode extends DiagramElement {
4184
4403
  }
4185
4404
  return {
4186
4405
  coords: [...this.coords],
4406
+ z: this.z,
4187
4407
  width: this.width,
4188
4408
  height: this.height,
4189
4409
  sections,
@@ -4200,6 +4420,7 @@ class DiagramNode extends DiagramElement {
4200
4420
  const oldCoordsX = [this.coords[0], this.coords[0] + this.width];
4201
4421
  const oldCoordsY = [this.coords[1], this.coords[1] + this.height];
4202
4422
  this.coords = [...geometry.coords];
4423
+ this.z = geometry.z;
4203
4424
  this.width = geometry.width;
4204
4425
  this.height = geometry.height;
4205
4426
  const newCoordsX = [this.coords[0], this.coords[0] + this.width];
@@ -4529,9 +4750,7 @@ const getBottomPadding = config => {
4529
4750
  } else if (typeof config.padding === 'number') {
4530
4751
  return config.padding;
4531
4752
  } else {
4532
- if (config.padding.length === 0) {
4533
- return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
4534
- } else if (config.padding.length === 1) {
4753
+ if (config.padding.length === 1) {
4535
4754
  return config.padding[0];
4536
4755
  } else if (config.padding.length === 2) {
4537
4756
  return config.padding[0];
@@ -4548,9 +4767,7 @@ const getLeftPadding = config => {
4548
4767
  } else if (typeof config.padding === 'number') {
4549
4768
  return config.padding;
4550
4769
  } else {
4551
- if (config.padding.length === 0) {
4552
- return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
4553
- } else if (config.padding.length === 1) {
4770
+ if (config.padding.length === 1) {
4554
4771
  return config.padding[0];
4555
4772
  } else if (config.padding.length === 2) {
4556
4773
  return config.padding[1];
@@ -4567,9 +4784,7 @@ const getRightPadding = config => {
4567
4784
  } else if (typeof config.padding === 'number') {
4568
4785
  return config.padding;
4569
4786
  } else {
4570
- if (config.padding.length === 0) {
4571
- return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
4572
- } else if (config.padding.length === 1) {
4787
+ if (config.padding.length === 1) {
4573
4788
  return config.padding[0];
4574
4789
  } else if (config.padding.length === 2) {
4575
4790
  return config.padding[1];
@@ -4586,9 +4801,7 @@ const getTopPadding = config => {
4586
4801
  } else if (typeof config.padding === 'number') {
4587
4802
  return config.padding;
4588
4803
  } else {
4589
- if (config.padding.length === 0) {
4590
- return DIAGRAM_NODE_TYPE_DEFAULTS.padding;
4591
- } else if (config.padding.length === 1) {
4804
+ if (config.padding.length === 1) {
4592
4805
  return config.padding[0];
4593
4806
  } else if (config.padding.length === 2) {
4594
4807
  return config.padding[0];
@@ -5384,6 +5597,7 @@ class AddNodeCollabAction {
5384
5597
  } else {
5385
5598
  node.valueSet.resetValues();
5386
5599
  }
5600
+ node.raiseWithZ();
5387
5601
  }
5388
5602
  serialize() {
5389
5603
  return {
@@ -5542,6 +5756,7 @@ class SetGeometryCollabAction {
5542
5756
  }
5543
5757
  }
5544
5758
  (_c = node.parent) === null || _c === void 0 ? void 0 : _c.fitToChild(node);
5759
+ node.raiseWithZ();
5545
5760
  node.geometryTimestamp = this.timestamp;
5546
5761
  }
5547
5762
  }
@@ -6772,14 +6987,28 @@ class DiagramModel {
6772
6987
  }
6773
6988
 
6774
6989
  /**
6775
- * Checks if the given mouse event was produced with a secondary button press.
6990
+ * Checks if the given pointer event was produced with a secondary button press.
6776
6991
  * @private
6777
- * @param event A mouse event.
6778
- * @returns `true` if the given mouse event was produced with a secondary button press, `false` otherwise.
6992
+ * @param event A pointer event.
6993
+ * @returns `true` if the given pointer event was produced with a secondary button press, `false` otherwise.
6779
6994
  */
6780
6995
  const isSecondaryButton = event => {
6781
6996
  return !!event.button;
6782
6997
  };
6998
+ /**
6999
+ * Obtain the pointer event which is valid for passing to the `d3.pointer()` function.
7000
+ * @param event A pointer event.
7001
+ * @returns A pointer event which can be passed to the `d3.pointer()` function.
7002
+ */
7003
+ const getEventHoldingCoordinates = event => {
7004
+ if (event.type === 'drag' || event.type === 'start' || event.type === 'end') {
7005
+ const sourceEvent = event.sourceEvent;
7006
+ if (sourceEvent && (sourceEvent.type === 'touchmove' || sourceEvent.type === 'touchstart' || sourceEvent.type === 'touchend')) {
7007
+ return sourceEvent.touches[0] || sourceEvent.changedTouches[0];
7008
+ }
7009
+ }
7010
+ return event;
7011
+ };
6783
7012
  /**
6784
7013
  * Get the SVG path of a diagram connection.
6785
7014
  * @private
@@ -6808,12 +7037,13 @@ const getRelatedNodeOrItself = element => {
6808
7037
  return element.rootElement instanceof DiagramNode || element.rootElement instanceof DiagramSection || element.rootElement instanceof DiagramPort ? getRelatedNodeOrItself(element.rootElement) : element;
6809
7038
  };
6810
7039
  const needsResizerX = element => {
7040
+ var _a;
6811
7041
  if (element instanceof DiagramNode) {
6812
- return element.type.resizableX !== false;
7042
+ return element.type.resizerX.mode !== exports.ResizableMode.Never;
6813
7043
  }
6814
7044
  if (element instanceof DiagramSection) {
6815
- if (element.type !== undefined) {
6816
- return element.type.resizableX !== false;
7045
+ if (((_a = element.type) === null || _a === void 0 ? void 0 : _a.resizerX) !== undefined) {
7046
+ return element.type.resizerX.mode !== exports.ResizableMode.Never;
6817
7047
  }
6818
7048
  if (element.node !== undefined) {
6819
7049
  return needsResizerX(element.node);
@@ -6822,12 +7052,13 @@ const needsResizerX = element => {
6822
7052
  return false;
6823
7053
  };
6824
7054
  const needsResizerY = element => {
7055
+ var _a;
6825
7056
  if (element instanceof DiagramNode) {
6826
- return element.type.resizableY !== false;
7057
+ return element.type.resizerY.mode !== exports.ResizableMode.Never;
6827
7058
  }
6828
7059
  if (element instanceof DiagramSection) {
6829
- if (element.type !== undefined) {
6830
- return element.type.resizableY !== false;
7060
+ if (((_a = element.type) === null || _a === void 0 ? void 0 : _a.resizerY) !== undefined) {
7061
+ return element.type.resizerY.mode !== exports.ResizableMode.Never;
6831
7062
  }
6832
7063
  if (element.node !== undefined) {
6833
7064
  return needsResizerY(element.node);
@@ -6835,6 +7066,21 @@ const needsResizerY = element => {
6835
7066
  }
6836
7067
  return false;
6837
7068
  };
7069
+ const needsResizerXY = element => {
7070
+ var _a;
7071
+ if (element instanceof DiagramNode) {
7072
+ return element.type.resizerXY.mode !== exports.ResizableMode.Never;
7073
+ }
7074
+ if (element instanceof DiagramSection) {
7075
+ if (((_a = element.type) === null || _a === void 0 ? void 0 : _a.resizerXY) !== undefined) {
7076
+ return element.type.resizerXY.mode !== exports.ResizableMode.Never;
7077
+ }
7078
+ if (element.node !== undefined) {
7079
+ return needsResizerXY(element.node);
7080
+ }
7081
+ }
7082
+ return false;
7083
+ };
6838
7084
  const initializeLook = selection => {
6839
7085
  selection.filter('.shaped-look').append('path');
6840
7086
  selection.filter('.image-look').append('image').attr('preserveAspectRatio', 'none');
@@ -6899,7 +7145,7 @@ const DOTS_GRID_DEFAULTS = Object.assign(Object.assign({}, GRID_DEFAULTS), {
6899
7145
  thickness: 0.05,
6900
7146
  color: 'rgba(0, 0, 0, 0.1)'
6901
7147
  });
6902
- const initializeBackground = (canvas, canvasView, backgroundConfig) => {
7148
+ const initializeBackground = (canvasView, backgroundConfig) => {
6903
7149
  var _a, _b;
6904
7150
  switch ((_a = backgroundConfig === null || backgroundConfig === void 0 ? void 0 : backgroundConfig.style) !== null && _a !== void 0 ? _a : '') {
6905
7151
  case 'image':
@@ -7675,11 +7921,6 @@ class DiagramUserSelection extends DiagramElementSet {
7675
7921
  * @private
7676
7922
  */
7677
7923
  const CONNECTION_PATH_BOX_THICKNESS = 12;
7678
- /**
7679
- * Thickness of the resizer line used to resize nodes and sections on drag, in diagram units.
7680
- * @private
7681
- */
7682
- const RESIZER_THICKNESS = 6;
7683
7924
  /**
7684
7925
  * Maximum number of user actions that can be recorded in the user action stack.
7685
7926
  * @private
@@ -7980,7 +8221,7 @@ class DiagramCanvas {
7980
8221
  }));
7981
8222
  const canvasDefs = canvasView.append('defs');
7982
8223
  const canvasBackground = [];
7983
- canvasBackground.push(initializeBackground(this, canvasView, this.backgroundConfig));
8224
+ canvasBackground.push(initializeBackground(canvasView, this.backgroundConfig).attr('class', 'daga-background'));
7984
8225
  for (let i = 0; i < this.ancillaryGridsConfig.length; ++i) {
7985
8226
  canvasBackground.push(initializeGrid(this, canvasView, canvasDefs, this.ancillaryGridPatternIds[i], this.ancillaryGridsConfig[i]));
7986
8227
  }
@@ -8038,7 +8279,7 @@ class DiagramCanvas {
8038
8279
  }
8039
8280
  getViewCoordinates() {
8040
8281
  var _a, _b, _c;
8041
- const canvasViewBoundingBox = (_c = (_b = (_a = this.selectCanvasView()) === null || _a === void 0 ? void 0 : _a.select('rect')) === null || _b === void 0 ? void 0 : _b.node()) === null || _c === void 0 ? void 0 : _c.getBBox();
8282
+ const canvasViewBoundingBox = (_c = (_b = (_a = this.selectCanvasView()) === null || _a === void 0 ? void 0 : _a.select('.daga-background')) === null || _b === void 0 ? void 0 : _b.node()) === null || _c === void 0 ? void 0 : _c.getBBox();
8042
8283
  /*
8043
8284
  transform the coordinates of the zoomTransform to the coordinates
8044
8285
  needed to point the zoomTransfrom to the center of the screen to
@@ -8090,7 +8331,11 @@ class DiagramCanvas {
8090
8331
  var _a;
8091
8332
  // if there are no nodes, we have nothing to do here
8092
8333
  if (this.model.nodes.length > 0) {
8093
- const canvasViewBoundingBox = (_a = this.selectCanvasView().select('rect').node()) === null || _a === void 0 ? void 0 : _a.getBBox();
8334
+ const canvasViewBoundingBox = (_a = this.selectCanvasView().select('.daga-background').node()) === null || _a === void 0 ? void 0 : _a.getBBox();
8335
+ if (!canvasViewBoundingBox.width || !canvasViewBoundingBox.height) {
8336
+ // prevent errors if the width or height is invalid
8337
+ return;
8338
+ }
8094
8339
  const nonRemovedNodes = (nodeIds === null || nodeIds === void 0 ? void 0 : nodeIds.map(i => this.model.nodes.get(i)).filter(n => !!n)) || this.model.nodes.all();
8095
8340
  const minimumX = Math.min(...nonRemovedNodes.map(n => n.coords[0]));
8096
8341
  const maximumX = Math.max(...nonRemovedNodes.map(n => n.coords[0] + n.width));
@@ -8133,30 +8378,14 @@ class DiagramCanvas {
8133
8378
  const rootDimensions = [(rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.width) || 0, (rootBoundingClientRect === null || rootBoundingClientRect === void 0 ? void 0 : rootBoundingClientRect.height) || 0];
8134
8379
  return [[-this.zoomTransform.x / this.zoomTransform.k, -this.zoomTransform.y / this.zoomTransform.k], [(rootDimensions[0] - this.zoomTransform.x) / this.zoomTransform.k, (rootDimensions[1] - this.zoomTransform.y) / this.zoomTransform.k]];
8135
8380
  }
8136
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8137
- getEventHoldingCoordinates(event) {
8138
- if (event.type === 'drag' || event.type === 'start' || event.type === 'end') {
8139
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8140
- const sourceEvent = event.sourceEvent;
8141
- if (sourceEvent && (sourceEvent.type === 'touchmove' || sourceEvent.type === 'touchstart' || sourceEvent.type === 'touchend')) {
8142
- return (
8143
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8144
- event.sourceEvent.touches[0] ||
8145
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8146
- event.sourceEvent.changedTouches[0]
8147
- );
8148
- }
8149
- }
8150
- return event;
8151
- }
8152
8381
  getPointerLocationRelativeToCanvas(event) {
8153
- return d3__namespace.pointer(this.getEventHoldingCoordinates(event), this.selectCanvasElements().node());
8382
+ return d3__namespace.pointer(getEventHoldingCoordinates(event), this.selectCanvasElements().node());
8154
8383
  }
8155
8384
  getPointerLocationRelativeToRoot(event) {
8156
- return d3__namespace.pointer(this.getEventHoldingCoordinates(event), this.selectSVGElement().node());
8385
+ return d3__namespace.pointer(getEventHoldingCoordinates(event), this.selectSVGElement().node());
8157
8386
  }
8158
8387
  getPointerLocationRelativeToBody(event) {
8159
- return d3__namespace.pointer(this.getEventHoldingCoordinates(event), d3__namespace.select('body').node());
8388
+ return d3__namespace.pointer(getEventHoldingCoordinates(event), d3__namespace.select('body').node());
8160
8389
  }
8161
8390
  getPointerLocationRelativeToScreen(event) {
8162
8391
  const pointerLocationRelativeToBody = this.getPointerLocationRelativeToBody(event);
@@ -8174,7 +8403,7 @@ class DiagramCanvas {
8174
8403
  updateNodesInView(...ids) {
8175
8404
  let updateSelection = this.selectCanvasElements().selectAll('g.diagram-node').data(this.model.nodes.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
8176
8405
  const exitSelection = updateSelection.exit();
8177
- const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-node${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''} ${d.type.defaultLook.lookType}`);
8406
+ 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}`);
8178
8407
  if (ids && ids.length > 0) {
8179
8408
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
8180
8409
  }
@@ -8200,65 +8429,210 @@ class DiagramCanvas {
8200
8429
  this.dragging = false;
8201
8430
  return;
8202
8431
  }
8203
- const diagramEvent = new DiagramSecondaryClickEvent(event, d);
8204
- this.diagramEvent$.next(diagramEvent);
8205
- if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
8206
- event.preventDefault();
8207
- this.userHighlight.focusOn(d);
8208
- this.diagramEvent$.next(new DiagramHighlightedEvent(d));
8209
- this.userSelection.add(d);
8210
- this.diagramEvent$.next(new DiagramSelectionEvent([d], true));
8211
- this.contextMenu.open(event);
8432
+ const diagramEvent = new DiagramSecondaryClickEvent(event, d);
8433
+ this.diagramEvent$.next(diagramEvent);
8434
+ if (!diagramEvent.defaultPrevented && this.canUserPerformAction(exports.DiagramActions.ContextMenu)) {
8435
+ event.preventDefault();
8436
+ this.userHighlight.focusOn(d);
8437
+ this.diagramEvent$.next(new DiagramHighlightedEvent(d));
8438
+ this.userSelection.add(d);
8439
+ this.diagramEvent$.next(new DiagramSelectionEvent([d], true));
8440
+ this.contextMenu.open(event);
8441
+ }
8442
+ }).on(exports.Events.DoubleClick, (event, d) => {
8443
+ const diagramEvent = new DiagramDoubleClickEvent(event, d);
8444
+ this.diagramEvent$.next(diagramEvent);
8445
+ }).call(d3__namespace.drag().filter(event => {
8446
+ this.secondaryButton = isSecondaryButton(event);
8447
+ return true;
8448
+ }).on(exports.DragEvents.Start, (event, d) => {
8449
+ if (this.multipleSelectionOn || this.secondaryButton) {
8450
+ this.startMultipleSelection(event);
8451
+ } else {
8452
+ this.startMovingNode(event, d);
8453
+ }
8454
+ }).on(exports.DragEvents.Drag, (event, d) => {
8455
+ if (this.multipleSelectionOn || this.secondaryButton) {
8456
+ this.continueMultipleSelection(event);
8457
+ } else {
8458
+ this.continueMovingNode(event, d);
8459
+ }
8460
+ }).on(exports.DragEvents.End, (event, d) => {
8461
+ if (this.multipleSelectionOn || this.secondaryButton) {
8462
+ this.finishMultipleSelection(event);
8463
+ } else {
8464
+ this.finishMovingNode(event, d);
8465
+ }
8466
+ this.secondaryButton = false;
8467
+ }));
8468
+ initializeLook(enterSelection);
8469
+ enterSelection.filter('.resizable-x').append('rect').attr('class', 'left-resizer').on(exports.Events.MouseOver, (_event, d) => {
8470
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8471
+ setCursorStyle(exports.CursorStyle.EWResize);
8472
+ }
8473
+ }).on(exports.Events.MouseOut, (_event, d) => {
8474
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8475
+ setCursorStyle();
8476
+ }
8477
+ }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8478
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8479
+ setCursorStyle(exports.CursorStyle.EWResize);
8480
+ this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8481
+ } else {
8482
+ setCursorStyle(exports.CursorStyle.NotAllowed);
8483
+ }
8484
+ }).on(exports.DragEvents.Drag, (event, d) => {
8485
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8486
+ const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8487
+ d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
8488
+ }
8489
+ }).on(exports.DragEvents.End, (event, d) => {
8490
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8491
+ let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8492
+ if (this.gridConfig.snap) {
8493
+ pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
8494
+ pointerCoords[0] += d.type.snapToGridOffset[0];
8495
+ pointerCoords[1] += d.type.snapToGridOffset[1];
8496
+ }
8497
+ d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
8498
+ this.currentAction.to = d.getGeometry();
8499
+ this.currentAction.do();
8500
+ this.actionStack.add(this.currentAction);
8501
+ this.currentAction = undefined;
8502
+ }
8503
+ setCursorStyle();
8504
+ }));
8505
+ enterSelection.filter('.resizable-x').append('rect').attr('class', 'right-resizer').on(exports.Events.MouseOver, (_event, d) => {
8506
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8507
+ setCursorStyle(exports.CursorStyle.EWResize);
8508
+ }
8509
+ }).on(exports.Events.MouseOut, (_event, d) => {
8510
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8511
+ setCursorStyle();
8512
+ }
8513
+ }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8514
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8515
+ setCursorStyle(exports.CursorStyle.EWResize);
8516
+ this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8517
+ } else {
8518
+ setCursorStyle(exports.CursorStyle.NotAllowed);
8519
+ }
8520
+ }).on(exports.DragEvents.Drag, (event, d) => {
8521
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8522
+ const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8523
+ d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8524
+ }
8525
+ }).on(exports.DragEvents.End, (event, d) => {
8526
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8527
+ let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8528
+ if (this.gridConfig.snap) {
8529
+ pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
8530
+ pointerCoords[0] += d.type.snapToGridOffset[2];
8531
+ pointerCoords[1] += d.type.snapToGridOffset[3];
8532
+ }
8533
+ d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8534
+ this.currentAction.to = d.getGeometry();
8535
+ this.currentAction.do();
8536
+ this.actionStack.add(this.currentAction);
8537
+ this.currentAction = undefined;
8538
+ }
8539
+ setCursorStyle();
8540
+ }));
8541
+ enterSelection.filter('.resizable-y').append('rect').attr('class', 'top-resizer').on(exports.Events.MouseOver, (_event, d) => {
8542
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8543
+ setCursorStyle(exports.CursorStyle.NSResize);
8544
+ }
8545
+ }).on(exports.Events.MouseOut, (_event, d) => {
8546
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8547
+ setCursorStyle();
8548
+ }
8549
+ }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8550
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8551
+ setCursorStyle(exports.CursorStyle.NSResize);
8552
+ this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8553
+ } else {
8554
+ setCursorStyle(exports.CursorStyle.NotAllowed);
8555
+ }
8556
+ }).on(exports.DragEvents.Drag, (event, d) => {
8557
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8558
+ const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8559
+ d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8560
+ }
8561
+ }).on(exports.DragEvents.End, (event, d) => {
8562
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8563
+ let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8564
+ if (this.gridConfig.snap) {
8565
+ pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
8566
+ pointerCoords[0] += d.type.snapToGridOffset[0];
8567
+ pointerCoords[1] += d.type.snapToGridOffset[1];
8568
+ }
8569
+ d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8570
+ this.currentAction.to = d.getGeometry();
8571
+ this.currentAction.do();
8572
+ this.actionStack.add(this.currentAction);
8573
+ this.currentAction = undefined;
8574
+ }
8575
+ setCursorStyle();
8576
+ }));
8577
+ enterSelection.filter('.resizable-y').append('rect').attr('class', 'bottom-resizer').on(exports.Events.MouseOver, (_event, d) => {
8578
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8579
+ setCursorStyle(exports.CursorStyle.NSResize);
8580
+ }
8581
+ }).on(exports.Events.MouseOut, (_event, d) => {
8582
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8583
+ setCursorStyle();
8212
8584
  }
8213
- }).on(exports.Events.DoubleClick, (event, d) => {
8214
- const diagramEvent = new DiagramDoubleClickEvent(event, d);
8215
- this.diagramEvent$.next(diagramEvent);
8216
- }).call(d3__namespace.drag().filter(event => {
8217
- this.secondaryButton = isSecondaryButton(event);
8218
- return true;
8219
- }).on(exports.DragEvents.Start, (event, d) => {
8220
- if (this.multipleSelectionOn || this.secondaryButton) {
8221
- this.startMultipleSelection(event);
8585
+ }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8586
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8587
+ setCursorStyle(exports.CursorStyle.NSResize);
8588
+ this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8222
8589
  } else {
8223
- this.startMovingNode(event, d);
8590
+ setCursorStyle(exports.CursorStyle.NotAllowed);
8224
8591
  }
8225
8592
  }).on(exports.DragEvents.Drag, (event, d) => {
8226
- if (this.multipleSelectionOn || this.secondaryButton) {
8227
- this.continueMultipleSelection(event);
8228
- } else {
8229
- this.continueMovingNode(event, d);
8593
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8594
+ const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8595
+ d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8230
8596
  }
8231
8597
  }).on(exports.DragEvents.End, (event, d) => {
8232
- if (this.multipleSelectionOn || this.secondaryButton) {
8233
- this.finishMultipleSelection(event);
8234
- } else {
8235
- this.finishMovingNode(event, d);
8598
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8599
+ let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8600
+ if (this.gridConfig.snap) {
8601
+ pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
8602
+ pointerCoords[0] += d.type.snapToGridOffset[2];
8603
+ pointerCoords[1] += d.type.snapToGridOffset[3];
8604
+ }
8605
+ d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8606
+ this.currentAction.to = d.getGeometry();
8607
+ this.currentAction.do();
8608
+ this.actionStack.add(this.currentAction);
8609
+ this.currentAction = undefined;
8236
8610
  }
8237
- this.secondaryButton = false;
8611
+ setCursorStyle();
8238
8612
  }));
8239
- initializeLook(enterSelection);
8240
- enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(exports.Events.MouseOver, (_event, d) => {
8241
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8242
- setCursorStyle(exports.CursorStyle.EWResize);
8613
+ enterSelection.filter('.resizable-xy').append('rect').attr('class', 'top-left-resizer').on(exports.Events.MouseOver, (_event, d) => {
8614
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8615
+ setCursorStyle(exports.CursorStyle.NWSEResize);
8243
8616
  }
8244
8617
  }).on(exports.Events.MouseOut, (_event, d) => {
8245
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8618
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8246
8619
  setCursorStyle();
8247
8620
  }
8248
8621
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8249
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8250
- setCursorStyle(exports.CursorStyle.EWResize);
8622
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8623
+ setCursorStyle(exports.CursorStyle.NWSEResize);
8251
8624
  this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8252
8625
  } else {
8253
8626
  setCursorStyle(exports.CursorStyle.NotAllowed);
8254
8627
  }
8255
8628
  }).on(exports.DragEvents.Drag, (event, d) => {
8256
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8629
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8257
8630
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8258
8631
  d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
8632
+ d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8259
8633
  }
8260
8634
  }).on(exports.DragEvents.End, (event, d) => {
8261
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8635
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8262
8636
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8263
8637
  if (this.gridConfig.snap) {
8264
8638
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
@@ -8266,6 +8640,7 @@ class DiagramCanvas {
8266
8640
  pointerCoords[1] += d.type.snapToGridOffset[1];
8267
8641
  }
8268
8642
  d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
8643
+ d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8269
8644
  this.currentAction.to = d.getGeometry();
8270
8645
  this.currentAction.do();
8271
8646
  this.actionStack.add(this.currentAction);
@@ -8273,34 +8648,36 @@ class DiagramCanvas {
8273
8648
  }
8274
8649
  setCursorStyle();
8275
8650
  }));
8276
- enterSelection.filter('.resizable-y').append('line').attr('class', 'top-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(exports.Events.MouseOver, (_event, d) => {
8277
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8278
- setCursorStyle(exports.CursorStyle.NSResize);
8651
+ enterSelection.filter('.resizable-xy').append('rect').attr('class', 'top-right-resizer').on(exports.Events.MouseOver, (_event, d) => {
8652
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8653
+ setCursorStyle(exports.CursorStyle.NESWResize);
8279
8654
  }
8280
8655
  }).on(exports.Events.MouseOut, (_event, d) => {
8281
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8656
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8282
8657
  setCursorStyle();
8283
8658
  }
8284
8659
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8285
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8286
- setCursorStyle(exports.CursorStyle.NSResize);
8660
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8661
+ setCursorStyle(exports.CursorStyle.NESWResize);
8287
8662
  this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8288
8663
  } else {
8289
8664
  setCursorStyle(exports.CursorStyle.NotAllowed);
8290
8665
  }
8291
8666
  }).on(exports.DragEvents.Drag, (event, d) => {
8292
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8667
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8293
8668
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8669
+ d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8294
8670
  d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8295
8671
  }
8296
8672
  }).on(exports.DragEvents.End, (event, d) => {
8297
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8673
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8298
8674
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8299
8675
  if (this.gridConfig.snap) {
8300
8676
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
8301
8677
  pointerCoords[0] += d.type.snapToGridOffset[0];
8302
8678
  pointerCoords[1] += d.type.snapToGridOffset[1];
8303
8679
  }
8680
+ d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8304
8681
  d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
8305
8682
  this.currentAction.to = d.getGeometry();
8306
8683
  this.currentAction.do();
@@ -8309,35 +8686,37 @@ class DiagramCanvas {
8309
8686
  }
8310
8687
  setCursorStyle();
8311
8688
  }));
8312
- enterSelection.filter('.resizable-x').append('line').attr('class', 'right-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(exports.Events.MouseOver, (_event, d) => {
8313
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8314
- setCursorStyle(exports.CursorStyle.EWResize);
8689
+ enterSelection.filter('.resizable-xy').append('rect').attr('class', 'bottom-left-resizer').on(exports.Events.MouseOver, (_event, d) => {
8690
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8691
+ setCursorStyle(exports.CursorStyle.NESWResize);
8315
8692
  }
8316
8693
  }).on(exports.Events.MouseOut, (_event, d) => {
8317
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8694
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8318
8695
  setCursorStyle();
8319
8696
  }
8320
8697
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8321
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8322
- setCursorStyle(exports.CursorStyle.EWResize);
8698
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8699
+ setCursorStyle(exports.CursorStyle.NESWResize);
8323
8700
  this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8324
8701
  } else {
8325
8702
  setCursorStyle(exports.CursorStyle.NotAllowed);
8326
8703
  }
8327
8704
  }).on(exports.DragEvents.Drag, (event, d) => {
8328
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8705
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8329
8706
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8330
- d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8707
+ d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
8708
+ d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8331
8709
  }
8332
8710
  }).on(exports.DragEvents.End, (event, d) => {
8333
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8711
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8334
8712
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8335
8713
  if (this.gridConfig.snap) {
8336
- pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
8337
- pointerCoords[0] += d.type.snapToGridOffset[2];
8338
- pointerCoords[1] += d.type.snapToGridOffset[3];
8714
+ pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
8715
+ pointerCoords[0] += d.type.snapToGridOffset[0];
8716
+ pointerCoords[1] += d.type.snapToGridOffset[1];
8339
8717
  }
8340
- d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8718
+ d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
8719
+ d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8341
8720
  this.currentAction.to = d.getGeometry();
8342
8721
  this.currentAction.do();
8343
8722
  this.actionStack.add(this.currentAction);
@@ -8345,34 +8724,36 @@ class DiagramCanvas {
8345
8724
  }
8346
8725
  setCursorStyle();
8347
8726
  }));
8348
- enterSelection.filter('.resizable-y').append('line').attr('class', 'bottom-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(exports.Events.MouseOver, (_event, d) => {
8349
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8350
- setCursorStyle(exports.CursorStyle.NSResize);
8727
+ enterSelection.filter('.resizable-xy').append('rect').attr('class', 'bottom-right-resizer').on(exports.Events.MouseOver, (_event, d) => {
8728
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8729
+ setCursorStyle(exports.CursorStyle.NWSEResize);
8351
8730
  }
8352
8731
  }).on(exports.Events.MouseOut, (_event, d) => {
8353
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8732
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8354
8733
  setCursorStyle();
8355
8734
  }
8356
8735
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8357
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8358
- setCursorStyle(exports.CursorStyle.NSResize);
8736
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8737
+ setCursorStyle(exports.CursorStyle.NWSEResize);
8359
8738
  this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8360
8739
  } else {
8361
8740
  setCursorStyle(exports.CursorStyle.NotAllowed);
8362
8741
  }
8363
8742
  }).on(exports.DragEvents.Drag, (event, d) => {
8364
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8743
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed) {
8365
8744
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8745
+ d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8366
8746
  d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8367
8747
  }
8368
8748
  }).on(exports.DragEvents.End, (event, d) => {
8369
- if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8749
+ if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
8370
8750
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8371
8751
  if (this.gridConfig.snap) {
8372
- pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
8373
- pointerCoords[0] += d.type.snapToGridOffset[2];
8374
- pointerCoords[1] += d.type.snapToGridOffset[3];
8752
+ pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
8753
+ pointerCoords[0] += d.type.snapToGridOffset[0];
8754
+ pointerCoords[1] += d.type.snapToGridOffset[1];
8375
8755
  }
8756
+ d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8376
8757
  d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8377
8758
  this.currentAction.to = d.getGeometry();
8378
8759
  this.currentAction.do();
@@ -8383,17 +8764,21 @@ class DiagramCanvas {
8383
8764
  }));
8384
8765
  mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
8385
8766
  updateLook(mergeSelection);
8386
- mergeSelection.filter('.resizable-x').select('line.left-resizer').style('pointer-events', d => d.getResizableX() ? 'initial' : 'none').attr('x1', RESIZER_THICKNESS / 2).attr('x2', RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
8387
- mergeSelection.filter('.resizable-y').select('line.top-resizer').style('pointer-events', d => d.getResizableY() ? 'initial' : 'none').attr('x1', 0).attr('x2', d => d.width).attr('y1', RESIZER_THICKNESS / 2).attr('y2', RESIZER_THICKNESS / 2);
8388
- mergeSelection.filter('.resizable-x').select('line.right-resizer').style('pointer-events', d => d.getResizableX() ? 'initial' : 'none').attr('x1', d => d.width - RESIZER_THICKNESS / 2).attr('x2', d => d.width - RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
8389
- mergeSelection.filter('.resizable-y').select('line.bottom-resizer').style('pointer-events', d => d.getResizableY() ? 'initial' : 'none').attr('x1', 0).attr('x2', d => d.width).attr('y1', d => d.height - RESIZER_THICKNESS / 2).attr('y2', d => d.height - RESIZER_THICKNESS / 2);
8767
+ mergeSelection.filter('.resizable-x').select('rect.left-resizer').style('pointer-events', d => d.getResizableX() ? 'initial' : 'none').attr('x', d => -d.getResizerX().outerMargin).attr('y', d => d.getResizerXY().thickness - d.getResizerXY().outerMargin).attr('width', d => d.getResizerX().thickness).attr('height', d => d.height - d.getResizerXY().thickness * 2 + d.getResizerXY().outerMargin * 2).attr('fill', d => d.getResizerX().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerX().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerX().getLook(d).borderThickness || 0);
8768
+ mergeSelection.filter('.resizable-x').select('rect.right-resizer').style('pointer-events', d => d.getResizableX() ? 'initial' : 'none').attr('x', d => d.width - d.getResizerX().thickness + d.getResizerX().outerMargin).attr('y', d => d.getResizerXY().thickness - d.getResizerXY().outerMargin).attr('width', d => d.getResizerX().thickness).attr('height', d => d.height - d.getResizerXY().thickness * 2 + d.getResizerXY().outerMargin * 2).attr('fill', d => d.getResizerX().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerX().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerX().getLook(d).borderThickness || 0);
8769
+ mergeSelection.filter('.resizable-y').select('rect.top-resizer').style('pointer-events', d => d.getResizableY() ? 'initial' : 'none').attr('x', d => d.getResizerXY().thickness - d.getResizerXY().outerMargin).attr('y', d => -d.getResizerY().outerMargin).attr('width', d => d.width - d.getResizerXY().thickness * 2 + d.getResizerXY().outerMargin * 2).attr('height', d => d.getResizerY().thickness).attr('fill', d => d.getResizerY().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerY().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerY().getLook(d).borderThickness || 0);
8770
+ mergeSelection.filter('.resizable-y').select('rect.bottom-resizer').style('pointer-events', d => d.getResizableY() ? 'initial' : 'none').attr('x', d => d.getResizerXY().thickness - d.getResizerXY().outerMargin).attr('y', d => d.height - d.getResizerY().thickness + d.getResizerY().outerMargin).attr('width', d => d.width - d.getResizerXY().thickness * 2 + d.getResizerXY().outerMargin * 2).attr('height', d => d.getResizerY().thickness).attr('fill', d => d.getResizerY().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerY().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerY().getLook(d).borderThickness || 0);
8771
+ mergeSelection.filter('.resizable-xy').select('rect.top-left-resizer').style('pointer-events', d => d.getResizableXY() ? 'initial' : 'none').attr('x', d => -d.getResizerXY().outerMargin).attr('y', d => -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);
8772
+ mergeSelection.filter('.resizable-xy').select('rect.top-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.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);
8773
+ mergeSelection.filter('.resizable-xy').select('rect.bottom-left-resizer').style('pointer-events', d => d.getResizableXY() ? 'initial' : 'none').attr('x', d => -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);
8774
+ 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);
8390
8775
  }
8391
8776
  updateSectionsInView(...ids) {
8392
8777
  let updateSelection = this.selectCanvasElements().selectAll('g.diagram-section').data(this.model.sections.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
8393
8778
  const exitSelection = updateSelection.exit();
8394
8779
  const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
8395
8780
  var _a;
8396
- return `diagram-section${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''} ${(_a = d.look) === null || _a === void 0 ? void 0 : _a.lookType}`;
8781
+ return `diagram-section${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''}${needsResizerXY(d) ? ' resizable-xy' : ''} ${(_a = d.look) === null || _a === void 0 ? void 0 : _a.lookType}`;
8397
8782
  });
8398
8783
  if (ids && ids.length > 0) {
8399
8784
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
@@ -8474,7 +8859,7 @@ class DiagramCanvas {
8474
8859
  this.secondaryButton = false;
8475
8860
  }));
8476
8861
  initializeLook(enterSelection);
8477
- enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(exports.Events.MouseOver, (_event, d) => {
8862
+ enterSelection.filter('.resizable-x').append('rect').attr('class', 'left-resizer').on(exports.Events.MouseOver, (_event, d) => {
8478
8863
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed) {
8479
8864
  setCursorStyle(exports.CursorStyle.EWResize);
8480
8865
  }
@@ -8508,7 +8893,41 @@ class DiagramCanvas {
8508
8893
  }
8509
8894
  setCursorStyle();
8510
8895
  }));
8511
- enterSelection.filter('.resizable-y').append('line').attr('class', 'top-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(exports.Events.MouseOver, (_event, d) => {
8896
+ enterSelection.filter('.resizable-x').append('rect').attr('class', 'right-resizer').on(exports.Events.MouseOver, (_event, d) => {
8897
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed) {
8898
+ setCursorStyle(exports.CursorStyle.EWResize);
8899
+ }
8900
+ }).on(exports.Events.MouseOut, (_event, d) => {
8901
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed) {
8902
+ setCursorStyle();
8903
+ }
8904
+ }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8905
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && d.node) {
8906
+ setCursorStyle(exports.CursorStyle.EWResize);
8907
+ this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
8908
+ } else {
8909
+ setCursorStyle(exports.CursorStyle.NotAllowed);
8910
+ }
8911
+ }).on(exports.DragEvents.Drag, (event, d) => {
8912
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && d.node) {
8913
+ const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8914
+ d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
8915
+ }
8916
+ }).on(exports.DragEvents.End, (event, d) => {
8917
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
8918
+ let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8919
+ if (this.gridConfig.snap) {
8920
+ pointerCoords = this.getClosestGridPoint(pointerCoords);
8921
+ }
8922
+ d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
8923
+ this.currentAction.to = d.node.getGeometry();
8924
+ this.currentAction.do();
8925
+ this.actionStack.add(this.currentAction);
8926
+ this.currentAction = undefined;
8927
+ }
8928
+ setCursorStyle();
8929
+ }));
8930
+ enterSelection.filter('.resizable-y').append('rect').attr('class', 'top-resizer').on(exports.Events.MouseOver, (_event, d) => {
8512
8931
  if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed) {
8513
8932
  setCursorStyle(exports.CursorStyle.NSResize);
8514
8933
  }
@@ -8542,33 +8961,105 @@ class DiagramCanvas {
8542
8961
  }
8543
8962
  setCursorStyle();
8544
8963
  }));
8545
- enterSelection.filter('.resizable-x').append('line').attr('class', 'right-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(exports.Events.MouseOver, (_event, d) => {
8546
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed) {
8547
- setCursorStyle(exports.CursorStyle.EWResize);
8964
+ enterSelection.filter('.resizable-y').append('rect').attr('class', 'bottom-resizer').on(exports.Events.MouseOver, (_event, d) => {
8965
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed) {
8966
+ setCursorStyle(exports.CursorStyle.NSResize);
8548
8967
  }
8549
8968
  }).on(exports.Events.MouseOut, (_event, d) => {
8550
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed) {
8969
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed) {
8551
8970
  setCursorStyle();
8552
8971
  }
8553
8972
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8554
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && d.node) {
8555
- setCursorStyle(exports.CursorStyle.EWResize);
8973
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && d.node) {
8974
+ setCursorStyle(exports.CursorStyle.NSResize);
8556
8975
  this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
8557
8976
  } else {
8558
8977
  setCursorStyle(exports.CursorStyle.NotAllowed);
8559
8978
  }
8560
8979
  }).on(exports.DragEvents.Drag, (event, d) => {
8561
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && d.node) {
8980
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && d.node) {
8981
+ const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8982
+ d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
8983
+ }
8984
+ }).on(exports.DragEvents.End, (event, d) => {
8985
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
8986
+ let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8987
+ if (this.gridConfig.snap) {
8988
+ pointerCoords = this.getClosestGridPoint(pointerCoords);
8989
+ }
8990
+ d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
8991
+ this.currentAction.to = d.node.getGeometry();
8992
+ this.currentAction.do();
8993
+ this.actionStack.add(this.currentAction);
8994
+ this.currentAction = undefined;
8995
+ }
8996
+ setCursorStyle();
8997
+ }));
8998
+ enterSelection.filter('.resizable-xy').append('rect').attr('class', 'top-left-resizer').on(exports.Events.MouseOver, (_event, d) => {
8999
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed) {
9000
+ setCursorStyle(exports.CursorStyle.NWSEResize);
9001
+ }
9002
+ }).on(exports.Events.MouseOut, (_event, d) => {
9003
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed) {
9004
+ setCursorStyle();
9005
+ }
9006
+ }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
9007
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
9008
+ setCursorStyle(exports.CursorStyle.NWSEResize);
9009
+ this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
9010
+ } else {
9011
+ setCursorStyle(exports.CursorStyle.NotAllowed);
9012
+ }
9013
+ }).on(exports.DragEvents.Drag, (event, d) => {
9014
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
9015
+ const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
9016
+ d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
9017
+ d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
9018
+ }
9019
+ }).on(exports.DragEvents.End, (event, d) => {
9020
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9021
+ let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
9022
+ if (this.gridConfig.snap) {
9023
+ pointerCoords = this.getClosestGridPoint(pointerCoords);
9024
+ }
9025
+ d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
9026
+ d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
9027
+ this.currentAction.to = d.node.getGeometry();
9028
+ this.currentAction.do();
9029
+ this.actionStack.add(this.currentAction);
9030
+ this.currentAction = undefined;
9031
+ }
9032
+ setCursorStyle();
9033
+ }));
9034
+ enterSelection.filter('.resizable-xy').append('rect').attr('class', 'top-right-resizer').on(exports.Events.MouseOver, (_event, d) => {
9035
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed) {
9036
+ setCursorStyle(exports.CursorStyle.NESWResize);
9037
+ }
9038
+ }).on(exports.Events.MouseOut, (_event, d) => {
9039
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed) {
9040
+ setCursorStyle();
9041
+ }
9042
+ }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
9043
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
9044
+ setCursorStyle(exports.CursorStyle.NESWResize);
9045
+ this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
9046
+ } else {
9047
+ setCursorStyle(exports.CursorStyle.NotAllowed);
9048
+ }
9049
+ }).on(exports.DragEvents.Drag, (event, d) => {
9050
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
8562
9051
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8563
9052
  d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
9053
+ d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
8564
9054
  }
8565
9055
  }).on(exports.DragEvents.End, (event, d) => {
8566
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9056
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
8567
9057
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8568
9058
  if (this.gridConfig.snap) {
8569
9059
  pointerCoords = this.getClosestGridPoint(pointerCoords);
8570
9060
  }
8571
9061
  d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
9062
+ d.node.stretchSections(exports.Side.Top, d.coords[1] - pointerCoords[1], d.indexXInNode, d.indexYInNode);
8572
9063
  this.currentAction.to = d.node.getGeometry();
8573
9064
  this.currentAction.do();
8574
9065
  this.actionStack.add(this.currentAction);
@@ -8576,32 +9067,70 @@ class DiagramCanvas {
8576
9067
  }
8577
9068
  setCursorStyle();
8578
9069
  }));
8579
- enterSelection.filter('.resizable-y').append('line').attr('class', 'bottom-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(exports.Events.MouseOver, (_event, d) => {
8580
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed) {
8581
- setCursorStyle(exports.CursorStyle.NSResize);
9070
+ enterSelection.filter('.resizable-xy').append('rect').attr('class', 'bottom-left-resizer').on(exports.Events.MouseOver, (_event, d) => {
9071
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed) {
9072
+ setCursorStyle(exports.CursorStyle.NESWResize);
8582
9073
  }
8583
9074
  }).on(exports.Events.MouseOut, (_event, d) => {
8584
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed) {
9075
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed) {
8585
9076
  setCursorStyle();
8586
9077
  }
8587
9078
  }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
8588
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && d.node) {
8589
- setCursorStyle(exports.CursorStyle.NSResize);
9079
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
9080
+ setCursorStyle(exports.CursorStyle.NESWResize);
8590
9081
  this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
8591
9082
  } else {
8592
9083
  setCursorStyle(exports.CursorStyle.NotAllowed);
8593
9084
  }
8594
9085
  }).on(exports.DragEvents.Drag, (event, d) => {
8595
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && d.node) {
9086
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
8596
9087
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
9088
+ d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
8597
9089
  d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
8598
9090
  }
8599
9091
  }).on(exports.DragEvents.End, (event, d) => {
8600
- if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9092
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
9093
+ let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
9094
+ if (this.gridConfig.snap) {
9095
+ pointerCoords = this.getClosestGridPoint(pointerCoords);
9096
+ }
9097
+ d.node.stretchSections(exports.Side.Left, d.coords[0] - pointerCoords[0], d.indexXInNode, d.indexYInNode);
9098
+ d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
9099
+ this.currentAction.to = d.node.getGeometry();
9100
+ this.currentAction.do();
9101
+ this.actionStack.add(this.currentAction);
9102
+ this.currentAction = undefined;
9103
+ }
9104
+ setCursorStyle();
9105
+ }));
9106
+ enterSelection.filter('.resizable-xy').append('rect').attr('class', 'bottom-right-resizer').on(exports.Events.MouseOver, (_event, d) => {
9107
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed) {
9108
+ setCursorStyle(exports.CursorStyle.NWSEResize);
9109
+ }
9110
+ }).on(exports.Events.MouseOut, (_event, d) => {
9111
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed) {
9112
+ setCursorStyle();
9113
+ }
9114
+ }).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
9115
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
9116
+ setCursorStyle(exports.CursorStyle.NWSEResize);
9117
+ this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchSection, d.node.id, d.node.getGeometry(), d.node.getGeometry());
9118
+ } else {
9119
+ setCursorStyle(exports.CursorStyle.NotAllowed);
9120
+ }
9121
+ }).on(exports.DragEvents.Drag, (event, d) => {
9122
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && d.node) {
9123
+ const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
9124
+ d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
9125
+ d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
9126
+ }
9127
+ }).on(exports.DragEvents.End, (event, d) => {
9128
+ if (this.canUserPerformAction(exports.DiagramActions.StretchSection) && d.getResizableXY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchSection && d.node) {
8601
9129
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8602
9130
  if (this.gridConfig.snap) {
8603
9131
  pointerCoords = this.getClosestGridPoint(pointerCoords);
8604
9132
  }
9133
+ d.node.stretchSections(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width), d.indexXInNode, d.indexYInNode);
8605
9134
  d.node.stretchSections(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height), d.indexXInNode, d.indexYInNode);
8606
9135
  this.currentAction.to = d.node.getGeometry();
8607
9136
  this.currentAction.do();
@@ -8612,10 +9141,14 @@ class DiagramCanvas {
8612
9141
  }));
8613
9142
  mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
8614
9143
  updateLook(mergeSelection);
8615
- mergeSelection.filter('.resizable-x').select('line.left-resizer').style('pointer-events', d => d.getResizableX() ? 'initial' : 'none').attr('x1', RESIZER_THICKNESS / 2).attr('x2', RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
8616
- mergeSelection.filter('.resizable-y').select('line.top-resizer').style('pointer-events', d => d.getResizableY() ? 'initial' : 'none').attr('x1', 0).attr('x2', d => d.width).attr('y1', RESIZER_THICKNESS / 2).attr('y2', RESIZER_THICKNESS / 2);
8617
- mergeSelection.filter('.resizable-x').select('line.right-resizer').style('pointer-events', d => d.getResizableX() ? 'initial' : 'none').attr('x1', d => d.width - RESIZER_THICKNESS / 2).attr('x2', d => d.width - RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
8618
- mergeSelection.filter('.resizable-y').select('line.bottom-resizer').style('pointer-events', d => d.getResizableY() ? 'initial' : 'none').attr('x1', 0).attr('x2', d => d.width).attr('y1', d => d.height - RESIZER_THICKNESS / 2).attr('y2', d => d.height - RESIZER_THICKNESS / 2);
9144
+ mergeSelection.filter('.resizable-x').select('rect.left-resizer').style('pointer-events', d => d.getResizableX() ? 'initial' : 'none').attr('x', d => -d.getResizerX().outerMargin).attr('y', d => d.getResizerXY().thickness - d.getResizerXY().outerMargin).attr('width', d => d.getResizerX().thickness).attr('height', d => d.height - d.getResizerXY().thickness * 2 + d.getResizerXY().outerMargin * 2).attr('fill', d => d.getResizerX().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerX().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerX().getLook(d).borderThickness || 0);
9145
+ mergeSelection.filter('.resizable-x').select('rect.right-resizer').style('pointer-events', d => d.getResizableX() ? 'initial' : 'none').attr('x', d => d.width - d.getResizerX().thickness + d.getResizerX().outerMargin).attr('y', d => d.getResizerXY().thickness - d.getResizerXY().outerMargin).attr('width', d => d.getResizerX().thickness).attr('height', d => d.height - d.getResizerXY().thickness * 2 + d.getResizerXY().outerMargin * 2).attr('fill', d => d.getResizerX().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerX().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerX().getLook(d).borderThickness || 0);
9146
+ mergeSelection.filter('.resizable-y').select('rect.top-resizer').style('pointer-events', d => d.getResizableY() ? 'initial' : 'none').attr('x', d => d.getResizerXY().thickness - d.getResizerXY().outerMargin).attr('y', d => -d.getResizerY().outerMargin).attr('width', d => d.width - d.getResizerXY().thickness * 2 + d.getResizerXY().outerMargin * 2).attr('height', d => d.getResizerY().thickness).attr('fill', d => d.getResizerY().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerY().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerY().getLook(d).borderThickness || 0);
9147
+ mergeSelection.filter('.resizable-y').select('rect.bottom-resizer').style('pointer-events', d => d.getResizableY() ? 'initial' : 'none').attr('x', d => d.getResizerXY().thickness - d.getResizerXY().outerMargin).attr('y', d => d.height - d.getResizerY().thickness + d.getResizerY().outerMargin).attr('width', d => d.width - d.getResizerXY().thickness * 2 + d.getResizerXY().outerMargin * 2).attr('height', d => d.getResizerY().thickness).attr('fill', d => d.getResizerY().getLook(d).fillColor || 'transparent').attr('stroke', d => d.getResizerY().getLook(d).borderColor || 'transparent').attr('stroke-width', d => d.getResizerY().getLook(d).borderThickness || 0);
9148
+ mergeSelection.filter('.resizable-xy').select('rect.top-left-resizer').style('pointer-events', d => d.getResizableXY() ? 'initial' : 'none').attr('x', d => -d.getResizerXY().outerMargin).attr('y', d => -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);
9149
+ mergeSelection.filter('.resizable-xy').select('rect.top-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.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);
9150
+ mergeSelection.filter('.resizable-xy').select('rect.bottom-left-resizer').style('pointer-events', d => d.getResizableXY() ? 'initial' : 'none').attr('x', d => -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);
9151
+ 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);
8619
9152
  }
8620
9153
  updatePortsInView(...ids) {
8621
9154
  let updateSelection = this.selectCanvasElements().selectAll('g.diagram-port').data(this.model.ports.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
@@ -9276,6 +9809,46 @@ class DiagramCanvas {
9276
9809
  endMarkerSelection.attr('orient', 'auto-start-reverse').attr('markerWidth', 0).attr('markerHeight', 0);
9277
9810
  }
9278
9811
  }
9812
+ bringToFront(node) {
9813
+ 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]]));
9814
+ let maximumZ = node.z;
9815
+ for (const n of overlappingNodes) {
9816
+ if (n.z > maximumZ) {
9817
+ maximumZ = n.z;
9818
+ }
9819
+ }
9820
+ maximumZ += 1;
9821
+ const action = new SetGeometryAction(this, exports.DiagramActions.MoveNode, node.id, node.getGeometry(), node.getGeometry());
9822
+ node.setGeometry(Object.assign(Object.assign({}, node.getGeometry()), {
9823
+ z: maximumZ
9824
+ }));
9825
+ node.raiseWithZ();
9826
+ action.to = node.getGeometry();
9827
+ this.currentAction = action;
9828
+ this.currentAction.do();
9829
+ this.actionStack.add(this.currentAction);
9830
+ this.currentAction = undefined;
9831
+ }
9832
+ sendToBack(node) {
9833
+ 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]]));
9834
+ let minimumZ = node.z;
9835
+ for (const n of overlappingNodes) {
9836
+ if (n.z < minimumZ) {
9837
+ minimumZ = n.z;
9838
+ }
9839
+ }
9840
+ minimumZ -= 1;
9841
+ const action = new SetGeometryAction(this, exports.DiagramActions.MoveNode, node.id, node.getGeometry(), node.getGeometry());
9842
+ node.setGeometry(Object.assign(Object.assign({}, node.getGeometry()), {
9843
+ z: minimumZ
9844
+ }));
9845
+ node.raiseWithZ();
9846
+ action.to = node.getGeometry();
9847
+ this.currentAction = action;
9848
+ this.currentAction.do();
9849
+ this.actionStack.add(this.currentAction);
9850
+ this.currentAction = undefined;
9851
+ }
9279
9852
  fieldRootFitsInView(id) {
9280
9853
  var _a, _b, _c, _d;
9281
9854
  const field = this.model.fields.get(id);