@metadev/daga 4.2.13 → 4.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +14 -0
- package/index.cjs.js +184 -65
- package/index.esm.js +185 -66
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/diagram/canvas/diagram-canvas-util.d.ts +3 -1
- package/src/lib/diagram/canvas/diagram-canvas.d.ts +4 -1
- package/src/lib/diagram/config/diagram-components-config.d.ts +5 -0
- package/src/lib/diagram/config/diagram-config.d.ts +12 -4
- package/src/lib/diagram/model/diagram-connection.d.ts +1 -1
- package/src/lib/diagram/model/diagram-node.d.ts +13 -3
- package/src/lib/diagram/model/diagram-port.d.ts +1 -1
- package/src/lib/diagram/model/diagram-section.d.ts +3 -3
- package/src/lib/interfaces/canvas.d.ts +22 -3
package/Changelog.md
CHANGED
|
@@ -6,6 +6,20 @@ List of releases and changes.
|
|
|
6
6
|
|
|
7
7
|
## Next release Joyeuse
|
|
8
8
|
|
|
9
|
+
## v. 4.2.15
|
|
10
|
+
|
|
11
|
+
- Configure center animation duration in buttons component [#368](https://github.com/metadevpro/daga/pull/368)
|
|
12
|
+
- Handle interruptions in zoom and pan animations [#369](https://github.com/metadevpro/daga/pull/369)
|
|
13
|
+
- Render ports on top of connections in diagram [#370](https://github.com/metadevpro/daga/pull/370)
|
|
14
|
+
- Enable making a connection pass through extra points if configured as such [#371](https://github.com/metadevpro/daga/pull/371)
|
|
15
|
+
- Allow configuring the tightening of connections across ports of different types [#372](https://github.com/metadevpro/daga/pull/372)
|
|
16
|
+
|
|
17
|
+
## v. 4.2.14
|
|
18
|
+
|
|
19
|
+
- Fix `getViewCoordinates()` canvas method to return coordinates such that using those coordinates for the `translateTo()` method results in no changes [#364](https://github.com/metadevpro/daga/pull/364)
|
|
20
|
+
- Add `zoomAndPanTo()` method to canvas to enable zooming and panning with animation [#364](https://github.com/metadevpro/daga/pull/364)
|
|
21
|
+
- Enable configuring nodes and sections to be only resizable when selected [#365](https://github.com/metadevpro/daga/pull/365)
|
|
22
|
+
|
|
9
23
|
## v. 4.2.13
|
|
10
24
|
|
|
11
25
|
- Fix check for whether a browser is Safari [#363](https://github.com/metadevpro/daga/pull/363)
|
package/index.cjs.js
CHANGED
|
@@ -2441,7 +2441,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
2441
2441
|
*/
|
|
2442
2442
|
this.endLabel = '';
|
|
2443
2443
|
/**
|
|
2444
|
-
* Points that this connection
|
|
2444
|
+
* Points that this connection must pass through in its route from its start point to its end point, in order.
|
|
2445
2445
|
* @public
|
|
2446
2446
|
*/
|
|
2447
2447
|
this.points = [];
|
|
@@ -2459,8 +2459,10 @@ class DiagramConnection extends DiagramElement {
|
|
|
2459
2459
|
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateConnectionsInView(this.id);
|
|
2460
2460
|
}
|
|
2461
2461
|
raise() {
|
|
2462
|
-
var _a;
|
|
2462
|
+
var _a, _b, _c;
|
|
2463
2463
|
(_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
|
|
2464
|
+
(_b = this.start) === null || _b === void 0 ? void 0 : _b.raise(false);
|
|
2465
|
+
(_c = this.end) === null || _c === void 0 ? void 0 : _c.raise(false);
|
|
2464
2466
|
}
|
|
2465
2467
|
/**
|
|
2466
2468
|
* Set the start of this connection to the given port or reset this connection's starting port if `undefined`.
|
|
@@ -2514,11 +2516,12 @@ class DiagramConnection extends DiagramElement {
|
|
|
2514
2516
|
* @public
|
|
2515
2517
|
*/
|
|
2516
2518
|
tighten() {
|
|
2517
|
-
var _a, _b, _c, _d, _e;
|
|
2519
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2518
2520
|
const allowConnectionLoops = ((_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.allowConnectionLoops) || false;
|
|
2519
2521
|
const allowSharingPorts = ((_b = this.model.canvas) === null || _b === void 0 ? void 0 : _b.allowSharingPorts) !== false;
|
|
2520
2522
|
const allowSharingBothPorts = ((_c = this.model.canvas) === null || _c === void 0 ? void 0 : _c.allowSharingBothPorts) || false;
|
|
2521
|
-
|
|
2523
|
+
const tightenConnectionsAcrossPortTypes = ((_d = this.model.canvas) === null || _d === void 0 ? void 0 : _d.tightenConnectionsAcrossPortTypes) || false;
|
|
2524
|
+
if (((_e = this.start) === null || _e === void 0 ? void 0 : _e.rootElement) && this.end) {
|
|
2522
2525
|
const alternativeStartPortsSortedByDistanceAscending = this.start.rootElement.ports.map(p => [p, p.distanceTo(this.end.coords)]).sort((a, b) => a[1] - b[1]).map(a => a[0]);
|
|
2523
2526
|
checkAlternativeStartPorts: for (const alternativeStartPort of alternativeStartPortsSortedByDistanceAscending) {
|
|
2524
2527
|
if (!allowConnectionLoops && alternativeStartPort === this.end) {
|
|
@@ -2529,6 +2532,10 @@ class DiagramConnection extends DiagramElement {
|
|
|
2529
2532
|
// alternative start port not valid, it doesn't allow outgoing connections
|
|
2530
2533
|
continue checkAlternativeStartPorts;
|
|
2531
2534
|
}
|
|
2535
|
+
if (!tightenConnectionsAcrossPortTypes && alternativeStartPort.type !== this.start.type) {
|
|
2536
|
+
// alternative start port not valid, the port type is different
|
|
2537
|
+
continue checkAlternativeStartPorts;
|
|
2538
|
+
}
|
|
2532
2539
|
if (!allowSharingPorts && (alternativeStartPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeStartPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
|
|
2533
2540
|
// alternative start port not valid, it already has other connections
|
|
2534
2541
|
continue checkAlternativeStartPorts;
|
|
@@ -2556,7 +2563,7 @@ class DiagramConnection extends DiagramElement {
|
|
|
2556
2563
|
}
|
|
2557
2564
|
}
|
|
2558
2565
|
}
|
|
2559
|
-
if (((
|
|
2566
|
+
if (((_f = this.end) === null || _f === void 0 ? void 0 : _f.rootElement) && this.start) {
|
|
2560
2567
|
const alternativeEndPortsSortedByDistanceAscending = this.end.rootElement.ports.map(p => [p, p.distanceTo(this.start.coords)]).sort((a, b) => a[1] - b[1]).map(a => a[0]);
|
|
2561
2568
|
checkAlternativeEndPorts: for (const alternativeEndPort of alternativeEndPortsSortedByDistanceAscending) {
|
|
2562
2569
|
if (!allowConnectionLoops && alternativeEndPort === this.start) {
|
|
@@ -2567,6 +2574,10 @@ class DiagramConnection extends DiagramElement {
|
|
|
2567
2574
|
// alternative end port not valid, it doesn't allow incoming connections
|
|
2568
2575
|
continue checkAlternativeEndPorts;
|
|
2569
2576
|
}
|
|
2577
|
+
if (!tightenConnectionsAcrossPortTypes && alternativeEndPort.type !== this.end.type) {
|
|
2578
|
+
// alternative end port not valid, the port type is different
|
|
2579
|
+
continue checkAlternativeEndPorts;
|
|
2580
|
+
}
|
|
2570
2581
|
if (!allowSharingPorts && (alternativeEndPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeEndPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
|
|
2571
2582
|
// alternative end port not valid, it already has other connections
|
|
2572
2583
|
continue checkAlternativeEndPorts;
|
|
@@ -2635,6 +2646,7 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
2635
2646
|
* @returns The instanced connection.
|
|
2636
2647
|
*/
|
|
2637
2648
|
new(type, start, end, id) {
|
|
2649
|
+
var _a, _b;
|
|
2638
2650
|
let connectionType;
|
|
2639
2651
|
if (type instanceof DiagramConnectionType) {
|
|
2640
2652
|
connectionType = type;
|
|
@@ -2649,6 +2661,8 @@ class DiagramConnectionSet extends DiagramElementSet {
|
|
|
2649
2661
|
super.add(connection);
|
|
2650
2662
|
connection.updateInView();
|
|
2651
2663
|
connection.valueSet.resetValues();
|
|
2664
|
+
(_a = connection.start) === null || _a === void 0 ? void 0 : _a.raise(false);
|
|
2665
|
+
(_b = connection.end) === null || _b === void 0 ? void 0 : _b.raise(false);
|
|
2652
2666
|
return connection;
|
|
2653
2667
|
}
|
|
2654
2668
|
remove(id) {
|
|
@@ -2977,6 +2991,11 @@ const getTopPadding$1 = config => {
|
|
|
2977
2991
|
}
|
|
2978
2992
|
};
|
|
2979
2993
|
|
|
2994
|
+
exports.ResizableMode = void 0;
|
|
2995
|
+
(function (ResizableMode) {
|
|
2996
|
+
ResizableMode[ResizableMode["OnlyWhenSelected"] = 0] = "OnlyWhenSelected";
|
|
2997
|
+
})(exports.ResizableMode || (exports.ResizableMode = {}));
|
|
2998
|
+
|
|
2980
2999
|
/**
|
|
2981
3000
|
* Default value of the default width of a diagram section.
|
|
2982
3001
|
* @private
|
|
@@ -3181,12 +3200,15 @@ class DiagramSection extends DiagramElement {
|
|
|
3181
3200
|
* @public
|
|
3182
3201
|
*/
|
|
3183
3202
|
getResizableX() {
|
|
3184
|
-
var _a
|
|
3203
|
+
var _a;
|
|
3185
3204
|
const sectionType = this.type;
|
|
3186
3205
|
if ((sectionType === null || sectionType === void 0 ? void 0 : sectionType.resizableX) !== undefined) {
|
|
3206
|
+
if (sectionType.resizableX === exports.ResizableMode.OnlyWhenSelected) {
|
|
3207
|
+
return this.selected;
|
|
3208
|
+
}
|
|
3187
3209
|
return sectionType.resizableX;
|
|
3188
3210
|
}
|
|
3189
|
-
return ((
|
|
3211
|
+
return ((_a = this.node) === null || _a === void 0 ? void 0 : _a.getResizableX()) || false;
|
|
3190
3212
|
}
|
|
3191
3213
|
/**
|
|
3192
3214
|
* Returns whether this section can be resized vertically.
|
|
@@ -3195,12 +3217,15 @@ class DiagramSection extends DiagramElement {
|
|
|
3195
3217
|
* @public
|
|
3196
3218
|
*/
|
|
3197
3219
|
getResizableY() {
|
|
3198
|
-
var _a
|
|
3220
|
+
var _a;
|
|
3199
3221
|
const sectionType = this.type;
|
|
3200
3222
|
if ((sectionType === null || sectionType === void 0 ? void 0 : sectionType.resizableY) !== undefined) {
|
|
3223
|
+
if (sectionType.resizableY === exports.ResizableMode.OnlyWhenSelected) {
|
|
3224
|
+
return this.selected;
|
|
3225
|
+
}
|
|
3201
3226
|
return sectionType.resizableY;
|
|
3202
3227
|
}
|
|
3203
|
-
return ((
|
|
3228
|
+
return ((_a = this.node) === null || _a === void 0 ? void 0 : _a.getResizableY()) || false;
|
|
3204
3229
|
}
|
|
3205
3230
|
/**
|
|
3206
3231
|
* Get the port of this section which is closest to the given coordinates.
|
|
@@ -3711,6 +3736,28 @@ class DiagramNode extends DiagramElement {
|
|
|
3711
3736
|
getPriority() {
|
|
3712
3737
|
return this.type.priority;
|
|
3713
3738
|
}
|
|
3739
|
+
/**
|
|
3740
|
+
* Returns whether this node can be resized horizontally.
|
|
3741
|
+
* @public
|
|
3742
|
+
*/
|
|
3743
|
+
getResizableX() {
|
|
3744
|
+
const resizableX = this.type.resizableX;
|
|
3745
|
+
if (resizableX === exports.ResizableMode.OnlyWhenSelected) {
|
|
3746
|
+
return this.selected;
|
|
3747
|
+
}
|
|
3748
|
+
return resizableX;
|
|
3749
|
+
}
|
|
3750
|
+
/**
|
|
3751
|
+
* Returns whether this node can be resized vertically.
|
|
3752
|
+
* @public
|
|
3753
|
+
*/
|
|
3754
|
+
getResizableY() {
|
|
3755
|
+
const resizableY = this.type.resizableY;
|
|
3756
|
+
if (resizableY === exports.ResizableMode.OnlyWhenSelected) {
|
|
3757
|
+
return this.selected;
|
|
3758
|
+
}
|
|
3759
|
+
return resizableY;
|
|
3760
|
+
}
|
|
3714
3761
|
/**
|
|
3715
3762
|
* Get the port of this node which is closest to the given coordinates.
|
|
3716
3763
|
* @param coords A point in the diagram.
|
|
@@ -4733,17 +4780,19 @@ class DiagramPort extends DiagramElement {
|
|
|
4733
4780
|
var _a;
|
|
4734
4781
|
(_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updatePortsInView(this.id);
|
|
4735
4782
|
}
|
|
4736
|
-
raise() {
|
|
4783
|
+
raise(raiseConnections = true) {
|
|
4737
4784
|
var _a;
|
|
4738
4785
|
(_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
|
|
4739
4786
|
if (this.label) {
|
|
4740
4787
|
this.label.raise();
|
|
4741
4788
|
}
|
|
4742
|
-
|
|
4743
|
-
connection.
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
connection.
|
|
4789
|
+
if (raiseConnections) {
|
|
4790
|
+
for (const connection of this.incomingConnections) {
|
|
4791
|
+
connection.raise();
|
|
4792
|
+
}
|
|
4793
|
+
for (const connection of this.outgoingConnections) {
|
|
4794
|
+
connection.raise();
|
|
4795
|
+
}
|
|
4747
4796
|
}
|
|
4748
4797
|
}
|
|
4749
4798
|
/**
|
|
@@ -6665,8 +6714,8 @@ const isSecondaryButton = event => {
|
|
|
6665
6714
|
* @private
|
|
6666
6715
|
* @see linePath
|
|
6667
6716
|
*/
|
|
6668
|
-
const getConnectionPath = (shape, startCoords, endCoords, startDirection, endDirection, width, startMarkerWidth, endMarkerWidth) => {
|
|
6669
|
-
return linePath(shape, [startCoords, endCoords], startDirection, endDirection, Math.max(
|
|
6717
|
+
const getConnectionPath = (shape, startCoords, endCoords, startDirection, endDirection, points, width, startMarkerWidth, endMarkerWidth) => {
|
|
6718
|
+
return linePath(shape, [startCoords, ...points, endCoords], startDirection, endDirection, Math.max(
|
|
6670
6719
|
// reasonable value for the minimumDistanceBeforeTurn relative to the line width
|
|
6671
6720
|
10, startMarkerWidth || 0, endMarkerWidth || 0) * width);
|
|
6672
6721
|
};
|
|
@@ -6686,6 +6735,34 @@ const getRelatedNodeOrItself = element => {
|
|
|
6686
6735
|
}
|
|
6687
6736
|
return element.rootElement instanceof DiagramNode || element.rootElement instanceof DiagramSection || element.rootElement instanceof DiagramPort ? getRelatedNodeOrItself(element.rootElement) : element;
|
|
6688
6737
|
};
|
|
6738
|
+
const needsResizerX = element => {
|
|
6739
|
+
if (element instanceof DiagramNode) {
|
|
6740
|
+
return element.type.resizableX !== false;
|
|
6741
|
+
}
|
|
6742
|
+
if (element instanceof DiagramSection) {
|
|
6743
|
+
if (element.type !== undefined) {
|
|
6744
|
+
return element.type.resizableX !== false;
|
|
6745
|
+
}
|
|
6746
|
+
if (element.node !== undefined) {
|
|
6747
|
+
return needsResizerX(element.node);
|
|
6748
|
+
}
|
|
6749
|
+
}
|
|
6750
|
+
return false;
|
|
6751
|
+
};
|
|
6752
|
+
const needsResizerY = element => {
|
|
6753
|
+
if (element instanceof DiagramNode) {
|
|
6754
|
+
return element.type.resizableY !== false;
|
|
6755
|
+
}
|
|
6756
|
+
if (element instanceof DiagramSection) {
|
|
6757
|
+
if (element.type !== undefined) {
|
|
6758
|
+
return element.type.resizableY !== false;
|
|
6759
|
+
}
|
|
6760
|
+
if (element.node !== undefined) {
|
|
6761
|
+
return needsResizerY(element.node);
|
|
6762
|
+
}
|
|
6763
|
+
}
|
|
6764
|
+
return false;
|
|
6765
|
+
};
|
|
6689
6766
|
const initializeLook = selection => {
|
|
6690
6767
|
selection.filter('.shaped-look').append('path');
|
|
6691
6768
|
selection.filter('.image-look').append('image').attr('preserveAspectRatio', 'none');
|
|
@@ -7451,7 +7528,7 @@ class DiagramCanvas {
|
|
|
7451
7528
|
* @param config The configuration object used to set the parameters of this canvas.
|
|
7452
7529
|
*/
|
|
7453
7530
|
constructor(parentComponent, config) {
|
|
7454
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
7531
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8;
|
|
7455
7532
|
this.backgroundPatternId = `daga-background-pattern-id-${DiagramCanvas.canvasCount++}`;
|
|
7456
7533
|
this.zoomTransform = d3__namespace.zoomIdentity;
|
|
7457
7534
|
// used to distinguish drags from clicks when dragging elements and during multiple selection
|
|
@@ -7479,12 +7556,13 @@ class DiagramCanvas {
|
|
|
7479
7556
|
this.panRate = ((_z = config.canvas) === null || _z === void 0 ? void 0 : _z.panRate) || 100;
|
|
7480
7557
|
this.inferConnectionType = ((_0 = config.connectionSettings) === null || _0 === void 0 ? void 0 : _0.inferConnectionType) || false;
|
|
7481
7558
|
this.autoTightenConnections = ((_1 = config.connectionSettings) === null || _1 === void 0 ? void 0 : _1.autoTighten) !== false;
|
|
7482
|
-
this.
|
|
7483
|
-
this.
|
|
7484
|
-
this.
|
|
7485
|
-
this.
|
|
7559
|
+
this.tightenConnectionsAcrossPortTypes = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.tightenAcrossPortTypes) || false;
|
|
7560
|
+
this.allowConnectionLoops = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.allowLoops) || false;
|
|
7561
|
+
this.allowSharingPorts = ((_4 = config.connectionSettings) === null || _4 === void 0 ? void 0 : _4.sharePorts) !== false;
|
|
7562
|
+
this.allowSharingBothPorts = ((_5 = config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.shareBothPorts) || false;
|
|
7563
|
+
this.portHighlightRadius = ((_6 = config.connectionSettings) === null || _6 === void 0 ? void 0 : _6.portHighlightRadius) || 100;
|
|
7486
7564
|
this.multipleSelectionOn = false;
|
|
7487
|
-
this.priorityThresholds = ((
|
|
7565
|
+
this.priorityThresholds = ((_7 = config.canvas) === null || _7 === void 0 ? void 0 : _7.priorityThresholds) || [];
|
|
7488
7566
|
this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
|
|
7489
7567
|
this.layoutFormat = config.layoutFormat;
|
|
7490
7568
|
this.userActions = config.userActions || {};
|
|
@@ -7511,7 +7589,7 @@ class DiagramCanvas {
|
|
|
7511
7589
|
const connectionType = new DiagramConnectionType(Object.assign(Object.assign({}, config.connectionTypeDefaults), connectionTypeConfig));
|
|
7512
7590
|
this.model.connections.types.add(connectionType);
|
|
7513
7591
|
}
|
|
7514
|
-
this._connectionType = ((
|
|
7592
|
+
this._connectionType = ((_8 = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _8 === void 0 ? void 0 : _8.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined;
|
|
7515
7593
|
}
|
|
7516
7594
|
}
|
|
7517
7595
|
addValidator(validator) {
|
|
@@ -7771,7 +7849,14 @@ class DiagramCanvas {
|
|
|
7771
7849
|
}
|
|
7772
7850
|
}
|
|
7773
7851
|
getViewCoordinates() {
|
|
7774
|
-
|
|
7852
|
+
var _a, _b, _c;
|
|
7853
|
+
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();
|
|
7854
|
+
/*
|
|
7855
|
+
transform the coordinates of the zoomTransform to the coordinates
|
|
7856
|
+
needed to point the zoomTransfrom to the center of the screen to
|
|
7857
|
+
ensure that canvas.translateTo(getViewCoordinates()) has no effect
|
|
7858
|
+
*/
|
|
7859
|
+
return [((canvasViewBoundingBox.width + canvasViewBoundingBox.x) / 2 - this.zoomTransform.x) / this.zoomTransform.k, ((canvasViewBoundingBox.height + canvasViewBoundingBox.y) / 2 - this.zoomTransform.y) / this.zoomTransform.k];
|
|
7775
7860
|
}
|
|
7776
7861
|
translateBy(x, y) {
|
|
7777
7862
|
if (!isNaN(x) && !isNaN(y)) {
|
|
@@ -7783,12 +7868,42 @@ class DiagramCanvas {
|
|
|
7783
7868
|
this.zoomBehavior.translateTo(this.selectCanvasView(), x, y);
|
|
7784
7869
|
}
|
|
7785
7870
|
}
|
|
7786
|
-
|
|
7871
|
+
zoomAndPanTo(x, y, z, duration) {
|
|
7872
|
+
if (!duration || duration <= 0) {
|
|
7873
|
+
this.zoomBehavior.scaleTo(this.selectCanvasView(), z);
|
|
7874
|
+
this.zoomBehavior.translateTo(this.selectCanvasView(), x, y);
|
|
7875
|
+
return;
|
|
7876
|
+
}
|
|
7877
|
+
this.zoomBehavior.interpolate(d3__namespace.interpolate);
|
|
7878
|
+
const [startingX, startingY] = this.getViewCoordinates();
|
|
7879
|
+
const startingZoom = this.getZoomLevel();
|
|
7880
|
+
const targetX = x,
|
|
7881
|
+
targetY = y,
|
|
7882
|
+
targetZoom = z;
|
|
7883
|
+
this.selectCanvasElements().transition().duration(duration).ease(d3__namespace.easeCubicInOut).tween('progress', () => {
|
|
7884
|
+
let animationInterrupted = false;
|
|
7885
|
+
return value => {
|
|
7886
|
+
try {
|
|
7887
|
+
if (!animationInterrupted) {
|
|
7888
|
+
const currentX = value * (targetX - startingX) + startingX;
|
|
7889
|
+
const currentY = value * (targetY - startingY) + startingY;
|
|
7890
|
+
const currentZoom = value * (targetZoom - startingZoom) + startingZoom;
|
|
7891
|
+
this.zoomBehavior.scaleTo(this.selectCanvasView(), currentZoom);
|
|
7892
|
+
this.zoomBehavior.translateTo(this.selectCanvasView(), currentX, currentY);
|
|
7893
|
+
}
|
|
7894
|
+
} catch (e) {
|
|
7895
|
+
console.warn('Animation has been interrupted');
|
|
7896
|
+
animationInterrupted = true;
|
|
7897
|
+
}
|
|
7898
|
+
};
|
|
7899
|
+
});
|
|
7900
|
+
}
|
|
7901
|
+
center(nodeIds, maxZoomLevel, duration) {
|
|
7787
7902
|
var _a;
|
|
7788
7903
|
// if there are no nodes, we have nothing to do here
|
|
7789
7904
|
if (this.model.nodes.length > 0) {
|
|
7790
7905
|
const canvasViewBoundingBox = (_a = this.selectCanvasView().select('rect').node()) === null || _a === void 0 ? void 0 : _a.getBBox();
|
|
7791
|
-
const nonRemovedNodes = this.model.nodes.all();
|
|
7906
|
+
const nonRemovedNodes = (nodeIds === null || nodeIds === void 0 ? void 0 : nodeIds.map(i => this.model.nodes.get(i)).filter(n => !!n)) || this.model.nodes.all();
|
|
7792
7907
|
const minimumX = Math.min(...nonRemovedNodes.map(n => n.coords[0]));
|
|
7793
7908
|
const maximumX = Math.max(...nonRemovedNodes.map(n => n.coords[0] + n.width));
|
|
7794
7909
|
const averageX = (minimumX + maximumX) / 2;
|
|
@@ -7803,12 +7918,12 @@ class DiagramCanvas {
|
|
|
7803
7918
|
* (windowRangeX / rangeX) is the zoom level to fit everything horizontally
|
|
7804
7919
|
* (windowRangeY / rangeY) is the zoom level to fit everything vertically
|
|
7805
7920
|
* the minimum between them is the zoom to fit everything in the screen both horizontally and vertically
|
|
7806
|
-
* we also add
|
|
7921
|
+
* we also add maxZoomLevel to the list so that if the zoom exceeds maxZoomLevel it is set to maxZoomLevel
|
|
7922
|
+
* or 1 if maxZoomLevel is undefined
|
|
7807
7923
|
* a zoom bigger than 1 means zooming in instead of out, and we don't want to zoom in if it's not necessary
|
|
7808
7924
|
*/
|
|
7809
|
-
const zoom = Math.min(windowRangeX / rangeX, windowRangeY / rangeY, 1);
|
|
7810
|
-
this.
|
|
7811
|
-
this.zoomTo(zoom);
|
|
7925
|
+
const zoom = Math.min(windowRangeX / rangeX, windowRangeY / rangeY, maxZoomLevel !== undefined ? maxZoomLevel : 1);
|
|
7926
|
+
this.zoomAndPanTo(averageX, averageY, zoom, duration);
|
|
7812
7927
|
}
|
|
7813
7928
|
}
|
|
7814
7929
|
getClosestGridPoint(point) {
|
|
@@ -7864,7 +7979,7 @@ class DiagramCanvas {
|
|
|
7864
7979
|
updateNodesInView(...ids) {
|
|
7865
7980
|
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);
|
|
7866
7981
|
const exitSelection = updateSelection.exit();
|
|
7867
|
-
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-node${d
|
|
7982
|
+
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}`);
|
|
7868
7983
|
if (ids && ids.length > 0) {
|
|
7869
7984
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
7870
7985
|
}
|
|
@@ -7928,27 +8043,27 @@ class DiagramCanvas {
|
|
|
7928
8043
|
}));
|
|
7929
8044
|
initializeLook(enterSelection);
|
|
7930
8045
|
enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(exports.Events.MouseOver, (_event, d) => {
|
|
7931
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8046
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
7932
8047
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
7933
8048
|
}
|
|
7934
8049
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
7935
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8050
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
7936
8051
|
setCursorStyle();
|
|
7937
8052
|
}
|
|
7938
8053
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
7939
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8054
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
7940
8055
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
7941
8056
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
|
|
7942
8057
|
} else {
|
|
7943
8058
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
7944
8059
|
}
|
|
7945
8060
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
7946
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8061
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
7947
8062
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7948
8063
|
d.stretch(exports.Side.Left, d.coords[0] - pointerCoords[0]);
|
|
7949
8064
|
}
|
|
7950
8065
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
7951
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8066
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
|
|
7952
8067
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7953
8068
|
if (this.snapToGrid) {
|
|
7954
8069
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -7964,27 +8079,27 @@ class DiagramCanvas {
|
|
|
7964
8079
|
setCursorStyle();
|
|
7965
8080
|
}));
|
|
7966
8081
|
enterSelection.filter('.resizable-y').append('line').attr('class', 'top-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(exports.Events.MouseOver, (_event, d) => {
|
|
7967
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8082
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
7968
8083
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
7969
8084
|
}
|
|
7970
8085
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
7971
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8086
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
7972
8087
|
setCursorStyle();
|
|
7973
8088
|
}
|
|
7974
8089
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
7975
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8090
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
7976
8091
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
7977
8092
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
|
|
7978
8093
|
} else {
|
|
7979
8094
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
7980
8095
|
}
|
|
7981
8096
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
7982
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8097
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
7983
8098
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7984
8099
|
d.stretch(exports.Side.Top, d.coords[1] - pointerCoords[1]);
|
|
7985
8100
|
}
|
|
7986
8101
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
7987
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8102
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
|
|
7988
8103
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
7989
8104
|
if (this.snapToGrid) {
|
|
7990
8105
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
|
|
@@ -8000,27 +8115,27 @@ class DiagramCanvas {
|
|
|
8000
8115
|
setCursorStyle();
|
|
8001
8116
|
}));
|
|
8002
8117
|
enterSelection.filter('.resizable-x').append('line').attr('class', 'right-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(exports.Events.MouseOver, (_event, d) => {
|
|
8003
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8118
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
8004
8119
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
8005
8120
|
}
|
|
8006
8121
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
8007
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8122
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
8008
8123
|
setCursorStyle();
|
|
8009
8124
|
}
|
|
8010
8125
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8011
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8126
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
8012
8127
|
setCursorStyle(exports.CursorStyle.EWResize);
|
|
8013
8128
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
|
|
8014
8129
|
} else {
|
|
8015
8130
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8016
8131
|
}
|
|
8017
8132
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
8018
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8133
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
|
|
8019
8134
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8020
8135
|
d.stretch(exports.Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
|
|
8021
8136
|
}
|
|
8022
8137
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8023
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8138
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
|
|
8024
8139
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8025
8140
|
if (this.snapToGrid) {
|
|
8026
8141
|
pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
|
|
@@ -8036,27 +8151,27 @@ class DiagramCanvas {
|
|
|
8036
8151
|
setCursorStyle();
|
|
8037
8152
|
}));
|
|
8038
8153
|
enterSelection.filter('.resizable-y').append('line').attr('class', 'bottom-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(exports.Events.MouseOver, (_event, d) => {
|
|
8039
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8154
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
8040
8155
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
8041
8156
|
}
|
|
8042
8157
|
}).on(exports.Events.MouseOut, (_event, d) => {
|
|
8043
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8158
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
8044
8159
|
setCursorStyle();
|
|
8045
8160
|
}
|
|
8046
8161
|
}).call(d3__namespace.drag().on(exports.DragEvents.Start, (_event, d) => {
|
|
8047
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8162
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
8048
8163
|
setCursorStyle(exports.CursorStyle.NSResize);
|
|
8049
8164
|
this.currentAction = new SetGeometryAction(this, exports.DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
|
|
8050
8165
|
} else {
|
|
8051
8166
|
setCursorStyle(exports.CursorStyle.NotAllowed);
|
|
8052
8167
|
}
|
|
8053
8168
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
8054
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8169
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
|
|
8055
8170
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8056
8171
|
d.stretch(exports.Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
|
|
8057
8172
|
}
|
|
8058
8173
|
}).on(exports.DragEvents.End, (event, d) => {
|
|
8059
|
-
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.
|
|
8174
|
+
if (this.canUserPerformAction(exports.DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === exports.DiagramActions.StretchNode) {
|
|
8060
8175
|
let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
8061
8176
|
if (this.snapToGrid) {
|
|
8062
8177
|
if (this.snapToGrid) {
|
|
@@ -8075,17 +8190,17 @@ class DiagramCanvas {
|
|
|
8075
8190
|
}));
|
|
8076
8191
|
mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
|
|
8077
8192
|
updateLook(mergeSelection);
|
|
8078
|
-
mergeSelection.filter('.resizable-x').select('line.left-resizer').attr('x1', RESIZER_THICKNESS / 2).attr('x2', RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
|
|
8079
|
-
mergeSelection.filter('.resizable-y').select('line.top-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', RESIZER_THICKNESS / 2).attr('y2', RESIZER_THICKNESS / 2);
|
|
8080
|
-
mergeSelection.filter('.resizable-x').select('line.right-resizer').attr('x1', d => d.width - RESIZER_THICKNESS / 2).attr('x2', d => d.width - RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
|
|
8081
|
-
mergeSelection.filter('.resizable-y').select('line.bottom-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', d => d.height - RESIZER_THICKNESS / 2).attr('y2', d => d.height - RESIZER_THICKNESS / 2);
|
|
8193
|
+
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);
|
|
8194
|
+
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);
|
|
8195
|
+
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);
|
|
8196
|
+
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);
|
|
8082
8197
|
}
|
|
8083
8198
|
updateSectionsInView(...ids) {
|
|
8084
8199
|
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);
|
|
8085
8200
|
const exitSelection = updateSelection.exit();
|
|
8086
8201
|
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
|
|
8087
8202
|
var _a;
|
|
8088
|
-
return `diagram-section${d
|
|
8203
|
+
return `diagram-section${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''} ${(_a = d.look) === null || _a === void 0 ? void 0 : _a.lookType}`;
|
|
8089
8204
|
});
|
|
8090
8205
|
if (ids && ids.length > 0) {
|
|
8091
8206
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
@@ -8304,10 +8419,10 @@ class DiagramCanvas {
|
|
|
8304
8419
|
}));
|
|
8305
8420
|
mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
|
|
8306
8421
|
updateLook(mergeSelection);
|
|
8307
|
-
mergeSelection.filter('.resizable-x').select('line.left-resizer').attr('x1', RESIZER_THICKNESS / 2).attr('x2', RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
|
|
8308
|
-
mergeSelection.filter('.resizable-y').select('line.top-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', RESIZER_THICKNESS / 2).attr('y2', RESIZER_THICKNESS / 2);
|
|
8309
|
-
mergeSelection.filter('.resizable-x').select('line.right-resizer').attr('x1', d => d.width - RESIZER_THICKNESS / 2).attr('x2', d => d.width - RESIZER_THICKNESS / 2).attr('y1', 0).attr('y2', d => d.height);
|
|
8310
|
-
mergeSelection.filter('.resizable-y').select('line.bottom-resizer').attr('x1', 0).attr('x2', d => d.width).attr('y1', d => d.height - RESIZER_THICKNESS / 2).attr('y2', d => d.height - RESIZER_THICKNESS / 2);
|
|
8422
|
+
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);
|
|
8423
|
+
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);
|
|
8424
|
+
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);
|
|
8425
|
+
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);
|
|
8311
8426
|
}
|
|
8312
8427
|
updatePortsInView(...ids) {
|
|
8313
8428
|
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);
|
|
@@ -8392,14 +8507,14 @@ class DiagramCanvas {
|
|
|
8392
8507
|
}
|
|
8393
8508
|
}
|
|
8394
8509
|
}).on(exports.DragEvents.Drag, (event, d) => {
|
|
8395
|
-
var _a, _b, _c, _d;
|
|
8510
|
+
var _a, _b, _c, _d, _e;
|
|
8396
8511
|
if (this.multipleSelectionOn || this.secondaryButton) {
|
|
8397
8512
|
this.continueMultipleSelection(event);
|
|
8398
8513
|
} else {
|
|
8399
8514
|
if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
|
|
8400
8515
|
if (this.unfinishedConnection !== undefined) {
|
|
8401
8516
|
const endCoords = [event.x, event.y];
|
|
8402
|
-
(_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.attr('d', getConnectionPath(this.unfinishedConnection.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_b = this.unfinishedConnection.type.defaultStartMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = this.unfinishedConnection.type.defaultEndMarkerLook) === null || _c === void 0 ? void 0 : _c.width));
|
|
8517
|
+
(_a = this.unfinishedConnectionTracer) === null || _a === void 0 ? void 0 : _a.attr('d', getConnectionPath(this.unfinishedConnection.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, this.unfinishedConnection.startCoords, endCoords, this.unfinishedConnection.startDirection, this.unfinishedConnection.endDirection, this.unfinishedConnection.points, this.unfinishedConnection.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_b = this.unfinishedConnection.type.defaultStartMarkerLook) === null || _b === void 0 ? void 0 : _b.width, (_c = this.unfinishedConnection.type.defaultEndMarkerLook) === null || _c === void 0 ? void 0 : _c.width));
|
|
8403
8518
|
const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === void 0 ? void 0 : _d.node();
|
|
8404
8519
|
if (unfinishedConnectionGhostNode) {
|
|
8405
8520
|
let margin = 2;
|
|
@@ -8414,6 +8529,7 @@ class DiagramCanvas {
|
|
|
8414
8529
|
this.unfinishedConnection.endCoords = endCoords;
|
|
8415
8530
|
}
|
|
8416
8531
|
this.updateConnectionsInView(UNFINISHED_CONNECTION_ID);
|
|
8532
|
+
(_e = this.unfinishedConnectionPort) === null || _e === void 0 ? void 0 : _e.raise(false);
|
|
8417
8533
|
// highlight closest target port
|
|
8418
8534
|
if (this.model.ports.length > 0) {
|
|
8419
8535
|
const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
|
|
@@ -8547,11 +8663,11 @@ class DiagramCanvas {
|
|
|
8547
8663
|
enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
|
|
8548
8664
|
mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
|
|
8549
8665
|
var _a, _b;
|
|
8550
|
-
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_a = d.type.defaultStartMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.type.defaultEndMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8666
|
+
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.points, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_a = d.type.defaultStartMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.type.defaultEndMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8551
8667
|
}).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.look.color || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.color).attr('stroke-width', d => `${d.look.thickness}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
|
|
8552
8668
|
mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
|
|
8553
8669
|
var _a, _b;
|
|
8554
|
-
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_a = d.type.defaultStartMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.type.defaultEndMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8670
|
+
return getConnectionPath(d.look.shape || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.shape, d.startCoords, d.endCoords, d.startDirection, d.endDirection, d.points, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness, (_a = d.type.defaultStartMarkerLook) === null || _a === void 0 ? void 0 : _a.width, (_b = d.type.defaultEndMarkerLook) === null || _b === void 0 ? void 0 : _b.width);
|
|
8555
8671
|
}).attr('stroke', 'transparent')
|
|
8556
8672
|
// allow generating pointer events even when it is transparent
|
|
8557
8673
|
.attr('pointer-events', 'stroke').attr('stroke-width', d => `${(d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness) + CONNECTION_PATH_BOX_THICKNESS}px`).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
|
|
@@ -9107,6 +9223,7 @@ class DiagramCanvas {
|
|
|
9107
9223
|
if (port.allowsOutgoing || port.allowsIncoming) {
|
|
9108
9224
|
if (this.connectionType && (this.connectionType.canStartFromType(((_b = (_a = port.getNode()) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.id) || '') && port.allowsOutgoing || this.connectionType.canFinishOnType(((_d = (_c = port.getNode()) === null || _c === void 0 ? void 0 : _c.type) === null || _d === void 0 ? void 0 : _d.id) || '') && port.allowsIncoming)) {
|
|
9109
9225
|
this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
9226
|
+
this.unfinishedConnectionPort = port;
|
|
9110
9227
|
} else {
|
|
9111
9228
|
if (this.inferConnectionType) {
|
|
9112
9229
|
let differentConnectionType = this.model.connections.types.all().find(t => {
|
|
@@ -9121,6 +9238,7 @@ class DiagramCanvas {
|
|
|
9121
9238
|
}
|
|
9122
9239
|
if (differentConnectionType !== undefined) {
|
|
9123
9240
|
this.unfinishedConnection = new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID);
|
|
9241
|
+
this.unfinishedConnectionPort = port;
|
|
9124
9242
|
}
|
|
9125
9243
|
}
|
|
9126
9244
|
}
|
|
@@ -9194,6 +9312,7 @@ class DiagramCanvas {
|
|
|
9194
9312
|
(_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.setEnd(undefined);
|
|
9195
9313
|
(_d = (_c = this.unfinishedConnection) === null || _c === void 0 ? void 0 : _c.select()) === null || _d === void 0 ? void 0 : _d.remove();
|
|
9196
9314
|
this.unfinishedConnection = undefined;
|
|
9315
|
+
this.unfinishedConnectionPort = undefined;
|
|
9197
9316
|
}
|
|
9198
9317
|
cancelAllUserActions() {
|
|
9199
9318
|
this.currentAction = undefined;
|