@metadev/daga 4.2.14 → 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 CHANGED
@@ -6,6 +6,14 @@ 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
+
9
17
  ## v. 4.2.14
10
18
 
11
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)
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 passes through.
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
- if (((_d = this.start) === null || _d === void 0 ? void 0 : _d.rootElement) && this.end) {
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 (((_e = this.end) === null || _e === void 0 ? void 0 : _e.rootElement) && this.start) {
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) {
@@ -4766,17 +4780,19 @@ class DiagramPort extends DiagramElement {
4766
4780
  var _a;
4767
4781
  (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updatePortsInView(this.id);
4768
4782
  }
4769
- raise() {
4783
+ raise(raiseConnections = true) {
4770
4784
  var _a;
4771
4785
  (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
4772
4786
  if (this.label) {
4773
4787
  this.label.raise();
4774
4788
  }
4775
- for (const connection of this.incomingConnections) {
4776
- connection.raise();
4777
- }
4778
- for (const connection of this.outgoingConnections) {
4779
- connection.raise();
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
+ }
4780
4796
  }
4781
4797
  }
4782
4798
  /**
@@ -6698,8 +6714,8 @@ const isSecondaryButton = event => {
6698
6714
  * @private
6699
6715
  * @see linePath
6700
6716
  */
6701
- const getConnectionPath = (shape, startCoords, endCoords, startDirection, endDirection, width, startMarkerWidth, endMarkerWidth) => {
6702
- 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(
6703
6719
  // reasonable value for the minimumDistanceBeforeTurn relative to the line width
6704
6720
  10, startMarkerWidth || 0, endMarkerWidth || 0) * width);
6705
6721
  };
@@ -7512,7 +7528,7 @@ class DiagramCanvas {
7512
7528
  * @param config The configuration object used to set the parameters of this canvas.
7513
7529
  */
7514
7530
  constructor(parentComponent, config) {
7515
- 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;
7516
7532
  this.backgroundPatternId = `daga-background-pattern-id-${DiagramCanvas.canvasCount++}`;
7517
7533
  this.zoomTransform = d3__namespace.zoomIdentity;
7518
7534
  // used to distinguish drags from clicks when dragging elements and during multiple selection
@@ -7540,12 +7556,13 @@ class DiagramCanvas {
7540
7556
  this.panRate = ((_z = config.canvas) === null || _z === void 0 ? void 0 : _z.panRate) || 100;
7541
7557
  this.inferConnectionType = ((_0 = config.connectionSettings) === null || _0 === void 0 ? void 0 : _0.inferConnectionType) || false;
7542
7558
  this.autoTightenConnections = ((_1 = config.connectionSettings) === null || _1 === void 0 ? void 0 : _1.autoTighten) !== false;
7543
- this.allowConnectionLoops = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.allowLoops) || false;
7544
- this.allowSharingPorts = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.sharePorts) !== false;
7545
- this.allowSharingBothPorts = ((_4 = config.connectionSettings) === null || _4 === void 0 ? void 0 : _4.shareBothPorts) || false;
7546
- this.portHighlightRadius = ((_5 = config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.portHighlightRadius) || 100;
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;
7547
7564
  this.multipleSelectionOn = false;
7548
- this.priorityThresholds = ((_6 = config.canvas) === null || _6 === void 0 ? void 0 : _6.priorityThresholds) || [];
7565
+ this.priorityThresholds = ((_7 = config.canvas) === null || _7 === void 0 ? void 0 : _7.priorityThresholds) || [];
7549
7566
  this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
7550
7567
  this.layoutFormat = config.layoutFormat;
7551
7568
  this.userActions = config.userActions || {};
@@ -7572,7 +7589,7 @@ class DiagramCanvas {
7572
7589
  const connectionType = new DiagramConnectionType(Object.assign(Object.assign({}, config.connectionTypeDefaults), connectionTypeConfig));
7573
7590
  this.model.connections.types.add(connectionType);
7574
7591
  }
7575
- this._connectionType = ((_7 = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _7 === void 0 ? void 0 : _7.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined;
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;
7576
7593
  }
7577
7594
  }
7578
7595
  addValidator(validator) {
@@ -7864,12 +7881,20 @@ class DiagramCanvas {
7864
7881
  targetY = y,
7865
7882
  targetZoom = z;
7866
7883
  this.selectCanvasElements().transition().duration(duration).ease(d3__namespace.easeCubicInOut).tween('progress', () => {
7884
+ let animationInterrupted = false;
7867
7885
  return value => {
7868
- const currentX = value * (targetX - startingX) + startingX;
7869
- const currentY = value * (targetY - startingY) + startingY;
7870
- const currentZoom = value * (targetZoom - startingZoom) + startingZoom;
7871
- this.zoomBehavior.scaleTo(this.selectCanvasView(), currentZoom);
7872
- this.zoomBehavior.translateTo(this.selectCanvasView(), currentX, currentY);
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
+ }
7873
7898
  };
7874
7899
  });
7875
7900
  }
@@ -8482,14 +8507,14 @@ class DiagramCanvas {
8482
8507
  }
8483
8508
  }
8484
8509
  }).on(exports.DragEvents.Drag, (event, d) => {
8485
- var _a, _b, _c, _d;
8510
+ var _a, _b, _c, _d, _e;
8486
8511
  if (this.multipleSelectionOn || this.secondaryButton) {
8487
8512
  this.continueMultipleSelection(event);
8488
8513
  } else {
8489
8514
  if (this.canUserPerformAction(exports.DiagramActions.AddConnection) && !d.removed) {
8490
8515
  if (this.unfinishedConnection !== undefined) {
8491
8516
  const endCoords = [event.x, event.y];
8492
- (_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));
8493
8518
  const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === void 0 ? void 0 : _d.node();
8494
8519
  if (unfinishedConnectionGhostNode) {
8495
8520
  let margin = 2;
@@ -8504,6 +8529,7 @@ class DiagramCanvas {
8504
8529
  this.unfinishedConnection.endCoords = endCoords;
8505
8530
  }
8506
8531
  this.updateConnectionsInView(UNFINISHED_CONNECTION_ID);
8532
+ (_e = this.unfinishedConnectionPort) === null || _e === void 0 ? void 0 : _e.raise(false);
8507
8533
  // highlight closest target port
8508
8534
  if (this.model.ports.length > 0) {
8509
8535
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
@@ -8637,11 +8663,11 @@ class DiagramCanvas {
8637
8663
  enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
8638
8664
  mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
8639
8665
  var _a, _b;
8640
- 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);
8641
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');
8642
8668
  mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
8643
8669
  var _a, _b;
8644
- 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);
8645
8671
  }).attr('stroke', 'transparent')
8646
8672
  // allow generating pointer events even when it is transparent
8647
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');
@@ -9197,6 +9223,7 @@ class DiagramCanvas {
9197
9223
  if (port.allowsOutgoing || port.allowsIncoming) {
9198
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)) {
9199
9225
  this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
9226
+ this.unfinishedConnectionPort = port;
9200
9227
  } else {
9201
9228
  if (this.inferConnectionType) {
9202
9229
  let differentConnectionType = this.model.connections.types.all().find(t => {
@@ -9211,6 +9238,7 @@ class DiagramCanvas {
9211
9238
  }
9212
9239
  if (differentConnectionType !== undefined) {
9213
9240
  this.unfinishedConnection = new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID);
9241
+ this.unfinishedConnectionPort = port;
9214
9242
  }
9215
9243
  }
9216
9244
  }
@@ -9284,6 +9312,7 @@ class DiagramCanvas {
9284
9312
  (_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.setEnd(undefined);
9285
9313
  (_d = (_c = this.unfinishedConnection) === null || _c === void 0 ? void 0 : _c.select()) === null || _d === void 0 ? void 0 : _d.remove();
9286
9314
  this.unfinishedConnection = undefined;
9315
+ this.unfinishedConnectionPort = undefined;
9287
9316
  }
9288
9317
  cancelAllUserActions() {
9289
9318
  this.currentAction = undefined;
package/index.esm.js CHANGED
@@ -2420,7 +2420,7 @@ class DiagramConnection extends DiagramElement {
2420
2420
  */
2421
2421
  this.endLabel = '';
2422
2422
  /**
2423
- * Points that this connection passes through.
2423
+ * Points that this connection must pass through in its route from its start point to its end point, in order.
2424
2424
  * @public
2425
2425
  */
2426
2426
  this.points = [];
@@ -2438,8 +2438,10 @@ class DiagramConnection extends DiagramElement {
2438
2438
  (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateConnectionsInView(this.id);
2439
2439
  }
2440
2440
  raise() {
2441
- var _a;
2441
+ var _a, _b, _c;
2442
2442
  (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
2443
+ (_b = this.start) === null || _b === void 0 ? void 0 : _b.raise(false);
2444
+ (_c = this.end) === null || _c === void 0 ? void 0 : _c.raise(false);
2443
2445
  }
2444
2446
  /**
2445
2447
  * Set the start of this connection to the given port or reset this connection's starting port if `undefined`.
@@ -2493,11 +2495,12 @@ class DiagramConnection extends DiagramElement {
2493
2495
  * @public
2494
2496
  */
2495
2497
  tighten() {
2496
- var _a, _b, _c, _d, _e;
2498
+ var _a, _b, _c, _d, _e, _f;
2497
2499
  const allowConnectionLoops = ((_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.allowConnectionLoops) || false;
2498
2500
  const allowSharingPorts = ((_b = this.model.canvas) === null || _b === void 0 ? void 0 : _b.allowSharingPorts) !== false;
2499
2501
  const allowSharingBothPorts = ((_c = this.model.canvas) === null || _c === void 0 ? void 0 : _c.allowSharingBothPorts) || false;
2500
- if (((_d = this.start) === null || _d === void 0 ? void 0 : _d.rootElement) && this.end) {
2502
+ const tightenConnectionsAcrossPortTypes = ((_d = this.model.canvas) === null || _d === void 0 ? void 0 : _d.tightenConnectionsAcrossPortTypes) || false;
2503
+ if (((_e = this.start) === null || _e === void 0 ? void 0 : _e.rootElement) && this.end) {
2501
2504
  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]);
2502
2505
  checkAlternativeStartPorts: for (const alternativeStartPort of alternativeStartPortsSortedByDistanceAscending) {
2503
2506
  if (!allowConnectionLoops && alternativeStartPort === this.end) {
@@ -2508,6 +2511,10 @@ class DiagramConnection extends DiagramElement {
2508
2511
  // alternative start port not valid, it doesn't allow outgoing connections
2509
2512
  continue checkAlternativeStartPorts;
2510
2513
  }
2514
+ if (!tightenConnectionsAcrossPortTypes && alternativeStartPort.type !== this.start.type) {
2515
+ // alternative start port not valid, the port type is different
2516
+ continue checkAlternativeStartPorts;
2517
+ }
2511
2518
  if (!allowSharingPorts && (alternativeStartPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeStartPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
2512
2519
  // alternative start port not valid, it already has other connections
2513
2520
  continue checkAlternativeStartPorts;
@@ -2535,7 +2542,7 @@ class DiagramConnection extends DiagramElement {
2535
2542
  }
2536
2543
  }
2537
2544
  }
2538
- if (((_e = this.end) === null || _e === void 0 ? void 0 : _e.rootElement) && this.start) {
2545
+ if (((_f = this.end) === null || _f === void 0 ? void 0 : _f.rootElement) && this.start) {
2539
2546
  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]);
2540
2547
  checkAlternativeEndPorts: for (const alternativeEndPort of alternativeEndPortsSortedByDistanceAscending) {
2541
2548
  if (!allowConnectionLoops && alternativeEndPort === this.start) {
@@ -2546,6 +2553,10 @@ class DiagramConnection extends DiagramElement {
2546
2553
  // alternative end port not valid, it doesn't allow incoming connections
2547
2554
  continue checkAlternativeEndPorts;
2548
2555
  }
2556
+ if (!tightenConnectionsAcrossPortTypes && alternativeEndPort.type !== this.end.type) {
2557
+ // alternative end port not valid, the port type is different
2558
+ continue checkAlternativeEndPorts;
2559
+ }
2549
2560
  if (!allowSharingPorts && (alternativeEndPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeEndPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
2550
2561
  // alternative end port not valid, it already has other connections
2551
2562
  continue checkAlternativeEndPorts;
@@ -2614,6 +2625,7 @@ class DiagramConnectionSet extends DiagramElementSet {
2614
2625
  * @returns The instanced connection.
2615
2626
  */
2616
2627
  new(type, start, end, id) {
2628
+ var _a, _b;
2617
2629
  let connectionType;
2618
2630
  if (type instanceof DiagramConnectionType) {
2619
2631
  connectionType = type;
@@ -2628,6 +2640,8 @@ class DiagramConnectionSet extends DiagramElementSet {
2628
2640
  super.add(connection);
2629
2641
  connection.updateInView();
2630
2642
  connection.valueSet.resetValues();
2643
+ (_a = connection.start) === null || _a === void 0 ? void 0 : _a.raise(false);
2644
+ (_b = connection.end) === null || _b === void 0 ? void 0 : _b.raise(false);
2631
2645
  return connection;
2632
2646
  }
2633
2647
  remove(id) {
@@ -4745,17 +4759,19 @@ class DiagramPort extends DiagramElement {
4745
4759
  var _a;
4746
4760
  (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updatePortsInView(this.id);
4747
4761
  }
4748
- raise() {
4762
+ raise(raiseConnections = true) {
4749
4763
  var _a;
4750
4764
  (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
4751
4765
  if (this.label) {
4752
4766
  this.label.raise();
4753
4767
  }
4754
- for (const connection of this.incomingConnections) {
4755
- connection.raise();
4756
- }
4757
- for (const connection of this.outgoingConnections) {
4758
- connection.raise();
4768
+ if (raiseConnections) {
4769
+ for (const connection of this.incomingConnections) {
4770
+ connection.raise();
4771
+ }
4772
+ for (const connection of this.outgoingConnections) {
4773
+ connection.raise();
4774
+ }
4759
4775
  }
4760
4776
  }
4761
4777
  /**
@@ -6677,8 +6693,8 @@ const isSecondaryButton = event => {
6677
6693
  * @private
6678
6694
  * @see linePath
6679
6695
  */
6680
- const getConnectionPath = (shape, startCoords, endCoords, startDirection, endDirection, width, startMarkerWidth, endMarkerWidth) => {
6681
- return linePath(shape, [startCoords, endCoords], startDirection, endDirection, Math.max(
6696
+ const getConnectionPath = (shape, startCoords, endCoords, startDirection, endDirection, points, width, startMarkerWidth, endMarkerWidth) => {
6697
+ return linePath(shape, [startCoords, ...points, endCoords], startDirection, endDirection, Math.max(
6682
6698
  // reasonable value for the minimumDistanceBeforeTurn relative to the line width
6683
6699
  10, startMarkerWidth || 0, endMarkerWidth || 0) * width);
6684
6700
  };
@@ -7491,7 +7507,7 @@ class DiagramCanvas {
7491
7507
  * @param config The configuration object used to set the parameters of this canvas.
7492
7508
  */
7493
7509
  constructor(parentComponent, config) {
7494
- 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;
7510
+ 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;
7495
7511
  this.backgroundPatternId = `daga-background-pattern-id-${DiagramCanvas.canvasCount++}`;
7496
7512
  this.zoomTransform = d3.zoomIdentity;
7497
7513
  // used to distinguish drags from clicks when dragging elements and during multiple selection
@@ -7519,12 +7535,13 @@ class DiagramCanvas {
7519
7535
  this.panRate = ((_z = config.canvas) === null || _z === void 0 ? void 0 : _z.panRate) || 100;
7520
7536
  this.inferConnectionType = ((_0 = config.connectionSettings) === null || _0 === void 0 ? void 0 : _0.inferConnectionType) || false;
7521
7537
  this.autoTightenConnections = ((_1 = config.connectionSettings) === null || _1 === void 0 ? void 0 : _1.autoTighten) !== false;
7522
- this.allowConnectionLoops = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.allowLoops) || false;
7523
- this.allowSharingPorts = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.sharePorts) !== false;
7524
- this.allowSharingBothPorts = ((_4 = config.connectionSettings) === null || _4 === void 0 ? void 0 : _4.shareBothPorts) || false;
7525
- this.portHighlightRadius = ((_5 = config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.portHighlightRadius) || 100;
7538
+ this.tightenConnectionsAcrossPortTypes = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.tightenAcrossPortTypes) || false;
7539
+ this.allowConnectionLoops = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.allowLoops) || false;
7540
+ this.allowSharingPorts = ((_4 = config.connectionSettings) === null || _4 === void 0 ? void 0 : _4.sharePorts) !== false;
7541
+ this.allowSharingBothPorts = ((_5 = config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.shareBothPorts) || false;
7542
+ this.portHighlightRadius = ((_6 = config.connectionSettings) === null || _6 === void 0 ? void 0 : _6.portHighlightRadius) || 100;
7526
7543
  this.multipleSelectionOn = false;
7527
- this.priorityThresholds = ((_6 = config.canvas) === null || _6 === void 0 ? void 0 : _6.priorityThresholds) || [];
7544
+ this.priorityThresholds = ((_7 = config.canvas) === null || _7 === void 0 ? void 0 : _7.priorityThresholds) || [];
7528
7545
  this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
7529
7546
  this.layoutFormat = config.layoutFormat;
7530
7547
  this.userActions = config.userActions || {};
@@ -7551,7 +7568,7 @@ class DiagramCanvas {
7551
7568
  const connectionType = new DiagramConnectionType(Object.assign(Object.assign({}, config.connectionTypeDefaults), connectionTypeConfig));
7552
7569
  this.model.connections.types.add(connectionType);
7553
7570
  }
7554
- this._connectionType = ((_7 = config === null || config === void 0 ? void 0 : config.connectionSettings) === null || _7 === void 0 ? void 0 : _7.defaultConnection) !== undefined ? this.model.connections.types.get(config.connectionSettings.defaultConnection) : undefined;
7571
+ 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;
7555
7572
  }
7556
7573
  }
7557
7574
  addValidator(validator) {
@@ -7843,12 +7860,20 @@ class DiagramCanvas {
7843
7860
  targetY = y,
7844
7861
  targetZoom = z;
7845
7862
  this.selectCanvasElements().transition().duration(duration).ease(d3.easeCubicInOut).tween('progress', () => {
7863
+ let animationInterrupted = false;
7846
7864
  return value => {
7847
- const currentX = value * (targetX - startingX) + startingX;
7848
- const currentY = value * (targetY - startingY) + startingY;
7849
- const currentZoom = value * (targetZoom - startingZoom) + startingZoom;
7850
- this.zoomBehavior.scaleTo(this.selectCanvasView(), currentZoom);
7851
- this.zoomBehavior.translateTo(this.selectCanvasView(), currentX, currentY);
7865
+ try {
7866
+ if (!animationInterrupted) {
7867
+ const currentX = value * (targetX - startingX) + startingX;
7868
+ const currentY = value * (targetY - startingY) + startingY;
7869
+ const currentZoom = value * (targetZoom - startingZoom) + startingZoom;
7870
+ this.zoomBehavior.scaleTo(this.selectCanvasView(), currentZoom);
7871
+ this.zoomBehavior.translateTo(this.selectCanvasView(), currentX, currentY);
7872
+ }
7873
+ } catch (e) {
7874
+ console.warn('Animation has been interrupted');
7875
+ animationInterrupted = true;
7876
+ }
7852
7877
  };
7853
7878
  });
7854
7879
  }
@@ -8461,14 +8486,14 @@ class DiagramCanvas {
8461
8486
  }
8462
8487
  }
8463
8488
  }).on(DragEvents.Drag, (event, d) => {
8464
- var _a, _b, _c, _d;
8489
+ var _a, _b, _c, _d, _e;
8465
8490
  if (this.multipleSelectionOn || this.secondaryButton) {
8466
8491
  this.continueMultipleSelection(event);
8467
8492
  } else {
8468
8493
  if (this.canUserPerformAction(DiagramActions.AddConnection) && !d.removed) {
8469
8494
  if (this.unfinishedConnection !== undefined) {
8470
8495
  const endCoords = [event.x, event.y];
8471
- (_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));
8496
+ (_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));
8472
8497
  const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === void 0 ? void 0 : _d.node();
8473
8498
  if (unfinishedConnectionGhostNode) {
8474
8499
  let margin = 2;
@@ -8483,6 +8508,7 @@ class DiagramCanvas {
8483
8508
  this.unfinishedConnection.endCoords = endCoords;
8484
8509
  }
8485
8510
  this.updateConnectionsInView(UNFINISHED_CONNECTION_ID);
8511
+ (_e = this.unfinishedConnectionPort) === null || _e === void 0 ? void 0 : _e.raise(false);
8486
8512
  // highlight closest target port
8487
8513
  if (this.model.ports.length > 0) {
8488
8514
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
@@ -8616,11 +8642,11 @@ class DiagramCanvas {
8616
8642
  enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
8617
8643
  mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
8618
8644
  var _a, _b;
8619
- 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);
8645
+ 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);
8620
8646
  }).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');
8621
8647
  mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
8622
8648
  var _a, _b;
8623
- 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);
8649
+ 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);
8624
8650
  }).attr('stroke', 'transparent')
8625
8651
  // allow generating pointer events even when it is transparent
8626
8652
  .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');
@@ -9176,6 +9202,7 @@ class DiagramCanvas {
9176
9202
  if (port.allowsOutgoing || port.allowsIncoming) {
9177
9203
  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)) {
9178
9204
  this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
9205
+ this.unfinishedConnectionPort = port;
9179
9206
  } else {
9180
9207
  if (this.inferConnectionType) {
9181
9208
  let differentConnectionType = this.model.connections.types.all().find(t => {
@@ -9190,6 +9217,7 @@ class DiagramCanvas {
9190
9217
  }
9191
9218
  if (differentConnectionType !== undefined) {
9192
9219
  this.unfinishedConnection = new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID);
9220
+ this.unfinishedConnectionPort = port;
9193
9221
  }
9194
9222
  }
9195
9223
  }
@@ -9263,6 +9291,7 @@ class DiagramCanvas {
9263
9291
  (_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.setEnd(undefined);
9264
9292
  (_d = (_c = this.unfinishedConnection) === null || _c === void 0 ? void 0 : _c.select()) === null || _d === void 0 ? void 0 : _d.remove();
9265
9293
  this.unfinishedConnection = undefined;
9294
+ this.unfinishedConnectionPort = undefined;
9266
9295
  }
9267
9296
  cancelAllUserActions() {
9268
9297
  this.currentAction = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metadev/daga",
3
- "version": "4.2.14",
3
+ "version": "4.2.15",
4
4
  "dependencies": {},
5
5
  "peerDependencies": {
6
6
  "d3": "^7.9.0",
@@ -20,7 +20,7 @@ export declare const isSecondaryButton: (event: MouseEvent) => boolean;
20
20
  * @private
21
21
  * @see linePath
22
22
  */
23
- export declare const getConnectionPath: (shape: LineShape | LineFunction, startCoords: Point, endCoords: Point, startDirection: Side | undefined, endDirection: Side | undefined, width: number, startMarkerWidth: number | undefined, endMarkerWidth: number | undefined) => string;
23
+ export declare const getConnectionPath: (shape: LineShape | LineFunction, startCoords: Point, endCoords: Point, startDirection: Side | undefined, endDirection: Side | undefined, points: Point[], width: number, startMarkerWidth: number | undefined, endMarkerWidth: number | undefined) => string;
24
24
  export declare const setCursorStyle: (style?: CursorStyle) => void;
25
25
  export declare const getRelatedNodeOrItself: (element: DiagramNode | DiagramSection | DiagramPort | DiagramField) => DiagramNode | DiagramSection | DiagramPort | DiagramField;
26
26
  export declare const needsResizerX: (element: DiagramNode | DiagramSection) => boolean;
@@ -53,6 +53,7 @@ export declare class DiagramCanvas implements Canvas {
53
53
  get connectionType(): DiagramConnectionType | undefined;
54
54
  set connectionType(value: DiagramConnectionType | undefined);
55
55
  autoTightenConnections: boolean;
56
+ tightenConnectionsAcrossPortTypes: boolean;
56
57
  allowConnectionLoops: boolean;
57
58
  allowSharingPorts: boolean;
58
59
  allowSharingBothPorts: boolean;
@@ -73,6 +74,7 @@ export declare class DiagramCanvas implements Canvas {
73
74
  * Invisible path followed by an unfinished connection. Used for making unfinished connections stop before the cursor rather than stopping right at the cursor.
74
75
  */
75
76
  private unfinishedConnectionTracer?;
77
+ private unfinishedConnectionPort?;
76
78
  private inputFieldContainer?;
77
79
  private multipleSelectionContainer?;
78
80
  private draggingFrom;
@@ -52,6 +52,11 @@ export interface ButtonsComponentConfig {
52
52
  * @default 'top'
53
53
  */
54
54
  direction?: Side;
55
+ /**
56
+ * Duration of the center animation when pressing the center button. May be set to `0` or `undefined` to make it instant without animation.
57
+ * @default undefined
58
+ */
59
+ centerAnimationDuration?: number;
55
60
  /**
56
61
  * Whether to enable the user action (undo, redo) buttons in this component.
57
62
  * @default true
@@ -103,6 +103,11 @@ export interface ConnectionSettingsConfig {
103
103
  * @default true
104
104
  */
105
105
  autoTighten?: boolean;
106
+ /**
107
+ * When tightening a connection allow changing the start and end ports to ports of a different type.
108
+ * @default false
109
+ */
110
+ tightenAcrossPortTypes?: boolean;
106
111
  /**
107
112
  * Whether a connection can use the same port as start and end.
108
113
  * @default false
@@ -138,7 +138,7 @@ export declare class DiagramConnection extends DiagramElement {
138
138
  */
139
139
  endLabel: string;
140
140
  /**
141
- * Points that this connection passes through.
141
+ * Points that this connection must pass through in its route from its start point to its end point, in order.
142
142
  * @public
143
143
  */
144
144
  points: Point[];
@@ -173,7 +173,7 @@ export declare class DiagramPort extends DiagramElement implements LabeledElemen
173
173
  constructor(model: DiagramModel, type: DiagramPortType | undefined, rootElement: DiagramNode | DiagramSection | undefined, coords: Point, connectionPoint: Point | undefined, direction: Side, id: string, anchorPointX?: AnchorPoint, anchorPointY?: AnchorPoint);
174
174
  get removed(): boolean;
175
175
  updateInView(): void;
176
- raise(): void;
176
+ raise(raiseConnections?: boolean): void;
177
177
  /**
178
178
  * Add a connection to this port's list of outgoing connections.
179
179
  * @public
@@ -108,6 +108,11 @@ export interface Canvas {
108
108
  * @public
109
109
  */
110
110
  autoTightenConnections: boolean;
111
+ /**
112
+ * Whether a connection can be tightened to use ports of a different type.
113
+ * @public
114
+ */
115
+ tightenConnectionsAcrossPortTypes: boolean;
111
116
  /**
112
117
  * Whether a connection can use the same port as start and end.
113
118
  * @public