@metadev/daga 5.0.3 → 5.0.4

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.esm.js CHANGED
@@ -1170,6 +1170,9 @@ const numberOfRows = s => {
1170
1170
  * @private
1171
1171
  */
1172
1172
  const clone = o => {
1173
+ if (o === null) {
1174
+ return o;
1175
+ }
1173
1176
  if (typeof o !== 'object') {
1174
1177
  return o;
1175
1178
  }
@@ -2424,7 +2427,7 @@ class DiagramConnection extends DiagramElement {
2424
2427
  */
2425
2428
  this.endLabel = '';
2426
2429
  /**
2427
- * Points that this connection passes through.
2430
+ * Points that this connection must pass through in its route from its start point to its end point, in order.
2428
2431
  * @public
2429
2432
  */
2430
2433
  this.points = [];
@@ -2442,8 +2445,10 @@ class DiagramConnection extends DiagramElement {
2442
2445
  (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updateConnectionsInView(this.id);
2443
2446
  }
2444
2447
  raise() {
2445
- var _a;
2448
+ var _a, _b, _c;
2446
2449
  (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
2450
+ (_b = this.start) === null || _b === void 0 ? void 0 : _b.raise(false);
2451
+ (_c = this.end) === null || _c === void 0 ? void 0 : _c.raise(false);
2447
2452
  }
2448
2453
  /**
2449
2454
  * Set the start of this connection to the given port or reset this connection's starting port if `undefined`.
@@ -2497,11 +2502,12 @@ class DiagramConnection extends DiagramElement {
2497
2502
  * @public
2498
2503
  */
2499
2504
  tighten() {
2500
- var _a, _b, _c, _d, _e;
2505
+ var _a, _b, _c, _d, _e, _f;
2501
2506
  const allowConnectionLoops = ((_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.allowConnectionLoops) || false;
2502
2507
  const allowSharingPorts = ((_b = this.model.canvas) === null || _b === void 0 ? void 0 : _b.allowSharingPorts) !== false;
2503
2508
  const allowSharingBothPorts = ((_c = this.model.canvas) === null || _c === void 0 ? void 0 : _c.allowSharingBothPorts) || false;
2504
- if (((_d = this.start) === null || _d === void 0 ? void 0 : _d.rootElement) && this.end) {
2509
+ const tightenConnectionsAcrossPortTypes = ((_d = this.model.canvas) === null || _d === void 0 ? void 0 : _d.tightenConnectionsAcrossPortTypes) || false;
2510
+ if (((_e = this.start) === null || _e === void 0 ? void 0 : _e.rootElement) && this.end) {
2505
2511
  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]);
2506
2512
  checkAlternativeStartPorts: for (const alternativeStartPort of alternativeStartPortsSortedByDistanceAscending) {
2507
2513
  if (!allowConnectionLoops && alternativeStartPort === this.end) {
@@ -2512,6 +2518,10 @@ class DiagramConnection extends DiagramElement {
2512
2518
  // alternative start port not valid, it doesn't allow outgoing connections
2513
2519
  continue checkAlternativeStartPorts;
2514
2520
  }
2521
+ if (!tightenConnectionsAcrossPortTypes && alternativeStartPort.type !== this.start.type) {
2522
+ // alternative start port not valid, the port type is different
2523
+ continue checkAlternativeStartPorts;
2524
+ }
2515
2525
  if (!allowSharingPorts && (alternativeStartPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeStartPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
2516
2526
  // alternative start port not valid, it already has other connections
2517
2527
  continue checkAlternativeStartPorts;
@@ -2539,7 +2549,7 @@ class DiagramConnection extends DiagramElement {
2539
2549
  }
2540
2550
  }
2541
2551
  }
2542
- if (((_e = this.end) === null || _e === void 0 ? void 0 : _e.rootElement) && this.start) {
2552
+ if (((_f = this.end) === null || _f === void 0 ? void 0 : _f.rootElement) && this.start) {
2543
2553
  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]);
2544
2554
  checkAlternativeEndPorts: for (const alternativeEndPort of alternativeEndPortsSortedByDistanceAscending) {
2545
2555
  if (!allowConnectionLoops && alternativeEndPort === this.start) {
@@ -2550,6 +2560,10 @@ class DiagramConnection extends DiagramElement {
2550
2560
  // alternative end port not valid, it doesn't allow incoming connections
2551
2561
  continue checkAlternativeEndPorts;
2552
2562
  }
2563
+ if (!tightenConnectionsAcrossPortTypes && alternativeEndPort.type !== this.end.type) {
2564
+ // alternative end port not valid, the port type is different
2565
+ continue checkAlternativeEndPorts;
2566
+ }
2553
2567
  if (!allowSharingPorts && (alternativeEndPort.incomingConnections.filter(c => !c.removed && c !== this).length > 0 || alternativeEndPort.outgoingConnections.filter(c => !c.removed && c !== this).length > 0)) {
2554
2568
  // alternative end port not valid, it already has other connections
2555
2569
  continue checkAlternativeEndPorts;
@@ -2618,6 +2632,7 @@ class DiagramConnectionSet extends DiagramElementSet {
2618
2632
  * @returns The instanced connection.
2619
2633
  */
2620
2634
  new(type, start, end, id) {
2635
+ var _a, _b;
2621
2636
  let connectionType;
2622
2637
  if (type instanceof DiagramConnectionType) {
2623
2638
  connectionType = type;
@@ -2632,6 +2647,8 @@ class DiagramConnectionSet extends DiagramElementSet {
2632
2647
  super.add(connection);
2633
2648
  connection.updateInView();
2634
2649
  connection.valueSet.resetValues();
2650
+ (_a = connection.start) === null || _a === void 0 ? void 0 : _a.raise(false);
2651
+ (_b = connection.end) === null || _b === void 0 ? void 0 : _b.raise(false);
2635
2652
  return connection;
2636
2653
  }
2637
2654
  remove(id) {
@@ -2666,6 +2683,7 @@ const DIAGRAM_FIELD_DEFAULTS = {
2666
2683
  horizontalAlign: HorizontalAlign.Center,
2667
2684
  verticalAlign: VerticalAlign.Center,
2668
2685
  orientation: Side.Top,
2686
+ multiline: false,
2669
2687
  fit: false,
2670
2688
  shrink: true
2671
2689
  };
@@ -2695,7 +2713,7 @@ class DiagramField extends DiagramElement {
2695
2713
  (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.fitFieldRootInView(this.id, this.shrink);
2696
2714
  }
2697
2715
  }
2698
- constructor(model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, orientation, text, editable, fit, shrink) {
2716
+ constructor(model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, orientation, multiline, text, editable, fit, shrink) {
2699
2717
  const id = `${rootElement === null || rootElement === void 0 ? void 0 : rootElement.id}_field`;
2700
2718
  if (model.fields.get(id) !== undefined) {
2701
2719
  throw new Error('DiagramField for rootElement already exists');
@@ -2736,6 +2754,7 @@ class DiagramField extends DiagramElement {
2736
2754
  this.orientation = 0;
2737
2755
  }
2738
2756
  }
2757
+ this.multiline = multiline;
2739
2758
  this.defaultText = text;
2740
2759
  this._text = text;
2741
2760
  this.editable = editable;
@@ -2780,8 +2799,8 @@ class DiagramFieldSet extends DiagramElementSet {
2780
2799
  * Instance a new field and add it to this set. This method is normally called when instancing an element with a field and it is rarely called by itself.
2781
2800
  * @private
2782
2801
  */
2783
- new(rootElement, coords, fontSize, fontFamily, color, selectedColor, width, height, horizontalAlign, verticalAlign, orientation, text, editable, fit, shrink) {
2784
- const field = new DiagramField(this.model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, orientation, text, editable, fit, shrink);
2802
+ new(rootElement, coords, fontSize, fontFamily, color, selectedColor, width, height, horizontalAlign, verticalAlign, orientation, multiline, text, editable, fit, shrink) {
2803
+ const field = new DiagramField(this.model, rootElement, coords, width, height, fontSize, fontFamily, color, selectedColor, horizontalAlign, verticalAlign, orientation, multiline, text, editable, fit, shrink);
2785
2804
  super.add(field);
2786
2805
  field.updateInView();
2787
2806
  // add this field to its root element
@@ -2960,6 +2979,11 @@ const getTopPadding$1 = config => {
2960
2979
  }
2961
2980
  };
2962
2981
 
2982
+ var ResizableMode;
2983
+ (function (ResizableMode) {
2984
+ ResizableMode[ResizableMode["OnlyWhenSelected"] = 0] = "OnlyWhenSelected";
2985
+ })(ResizableMode || (ResizableMode = {}));
2986
+
2963
2987
  /**
2964
2988
  * Default value of the default width of a diagram section.
2965
2989
  * @private
@@ -3164,12 +3188,15 @@ class DiagramSection extends DiagramElement {
3164
3188
  * @public
3165
3189
  */
3166
3190
  getResizableX() {
3167
- var _a, _b;
3191
+ var _a;
3168
3192
  const sectionType = this.type;
3169
3193
  if ((sectionType === null || sectionType === void 0 ? void 0 : sectionType.resizableX) !== undefined) {
3194
+ if (sectionType.resizableX === ResizableMode.OnlyWhenSelected) {
3195
+ return this.selected;
3196
+ }
3170
3197
  return sectionType.resizableX;
3171
3198
  }
3172
- return ((_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableX) || false;
3199
+ return ((_a = this.node) === null || _a === void 0 ? void 0 : _a.getResizableX()) || false;
3173
3200
  }
3174
3201
  /**
3175
3202
  * Returns whether this section can be resized vertically.
@@ -3178,12 +3205,15 @@ class DiagramSection extends DiagramElement {
3178
3205
  * @public
3179
3206
  */
3180
3207
  getResizableY() {
3181
- var _a, _b;
3208
+ var _a;
3182
3209
  const sectionType = this.type;
3183
3210
  if ((sectionType === null || sectionType === void 0 ? void 0 : sectionType.resizableY) !== undefined) {
3211
+ if (sectionType.resizableY === ResizableMode.OnlyWhenSelected) {
3212
+ return this.selected;
3213
+ }
3184
3214
  return sectionType.resizableY;
3185
3215
  }
3186
- return ((_b = (_a = this.node) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.resizableY) || false;
3216
+ return ((_a = this.node) === null || _a === void 0 ? void 0 : _a.getResizableY()) || false;
3187
3217
  }
3188
3218
  /**
3189
3219
  * Get the port of this section which is closest to the given coordinates.
@@ -3409,7 +3439,7 @@ class DiagramSectionSet extends DiagramElementSet {
3409
3439
  default:
3410
3440
  labelCoords = port.coords;
3411
3441
  }
3412
- this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
3442
+ this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
3413
3443
  }
3414
3444
  }
3415
3445
  }
@@ -3417,7 +3447,7 @@ class DiagramSectionSet extends DiagramElementSet {
3417
3447
  const sectionLabel = (_k = (_j = (_h = (_g = node.type.sectionGrid) === null || _g === void 0 ? void 0 : _g.sections) === null || _h === void 0 ? void 0 : _h[indexYInNode]) === null || _j === void 0 ? void 0 : _j[indexXInNode]) === null || _k === void 0 ? void 0 : _k.label;
3418
3448
  if (sectionLabel) {
3419
3449
  const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), sectionLabel);
3420
- this.model.fields.new(section, [section.coords[0] + getLeftMargin(labelConfiguration), section.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, section.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), section.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
3450
+ this.model.fields.new(section, [section.coords[0] + getLeftMargin(labelConfiguration), section.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, section.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), section.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
3421
3451
  }
3422
3452
  return section;
3423
3453
  }
@@ -3694,6 +3724,28 @@ class DiagramNode extends DiagramElement {
3694
3724
  getPriority() {
3695
3725
  return this.type.priority;
3696
3726
  }
3727
+ /**
3728
+ * Returns whether this node can be resized horizontally.
3729
+ * @public
3730
+ */
3731
+ getResizableX() {
3732
+ const resizableX = this.type.resizableX;
3733
+ if (resizableX === ResizableMode.OnlyWhenSelected) {
3734
+ return this.selected;
3735
+ }
3736
+ return resizableX;
3737
+ }
3738
+ /**
3739
+ * Returns whether this node can be resized vertically.
3740
+ * @public
3741
+ */
3742
+ getResizableY() {
3743
+ const resizableY = this.type.resizableY;
3744
+ if (resizableY === ResizableMode.OnlyWhenSelected) {
3745
+ return this.selected;
3746
+ }
3747
+ return resizableY;
3748
+ }
3697
3749
  /**
3698
3750
  * Get the port of this node which is closest to the given coordinates.
3699
3751
  * @param coords A point in the diagram.
@@ -4315,14 +4367,14 @@ class DiagramNodeSet extends DiagramElementSet {
4315
4367
  default:
4316
4368
  labelCoords = port.coords;
4317
4369
  }
4318
- this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4370
+ this.model.fields.new(port, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelWidth, labelHeight, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4319
4371
  }
4320
4372
  }
4321
4373
  }
4322
4374
  // add node label
4323
4375
  if (nodeType.label) {
4324
4376
  const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), nodeType.label);
4325
- this.model.fields.new(node, [node.coords[0] + getLeftMargin(labelConfiguration), node.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, node.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), node.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4377
+ this.model.fields.new(node, [node.coords[0] + getLeftMargin(labelConfiguration), node.coords[1] + getTopMargin(labelConfiguration)], labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, node.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), node.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4326
4378
  }
4327
4379
  // add node decorators
4328
4380
  if (nodeType.decorators.length > 0) {
@@ -4716,17 +4768,19 @@ class DiagramPort extends DiagramElement {
4716
4768
  var _a;
4717
4769
  (_a = this.model.canvas) === null || _a === void 0 ? void 0 : _a.updatePortsInView(this.id);
4718
4770
  }
4719
- raise() {
4771
+ raise(raiseConnections = true) {
4720
4772
  var _a;
4721
4773
  (_a = this.select()) === null || _a === void 0 ? void 0 : _a.raise();
4722
4774
  if (this.label) {
4723
4775
  this.label.raise();
4724
4776
  }
4725
- for (const connection of this.incomingConnections) {
4726
- connection.raise();
4727
- }
4728
- for (const connection of this.outgoingConnections) {
4729
- connection.raise();
4777
+ if (raiseConnections) {
4778
+ for (const connection of this.incomingConnections) {
4779
+ connection.raise();
4780
+ }
4781
+ for (const connection of this.outgoingConnections) {
4782
+ connection.raise();
4783
+ }
4730
4784
  }
4731
4785
  }
4732
4786
  /**
@@ -4880,23 +4934,21 @@ class DagaImporter {
4880
4934
  model.nodes.add(newNode);
4881
4935
  newNode.width = node.width;
4882
4936
  newNode.height = node.height;
4883
- if (node.label) {
4884
- // add node decorators
4885
- if (newNodeType.decorators) {
4886
- for (let i = 0; i < newNodeType.decorators.length; ++i) {
4887
- const decoratorConfig = newNodeType.decorators[i];
4888
- model.decorators.new(newNode, [newNode.coords[0] + decoratorConfig.coords[0], newNode.coords[1] + decoratorConfig.coords[1]], decoratorConfig.width, decoratorConfig.height, newNode.getPriority(), decoratorConfig.html, `${newNode.id}_decorator_${i}`);
4889
- }
4890
- }
4891
- // add node label
4892
- if (newNodeType.label) {
4893
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newNodeType.label);
4894
- const newField = new DiagramField(model, newNode, [newNode.coords[0] + getLeftMargin(labelConfiguration), newNode.coords[1] + getTopMargin(labelConfiguration)], newNode.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newNode.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4895
- newField.text = node.label;
4896
- newNode.label = newField;
4897
- model.fields.add(newField);
4898
- newField.updateInView();
4899
- }
4937
+ // add node decorators
4938
+ if (newNodeType.decorators) {
4939
+ for (let i = 0; i < newNodeType.decorators.length; ++i) {
4940
+ const decoratorConfig = newNodeType.decorators[i];
4941
+ model.decorators.new(newNode, [newNode.coords[0] + decoratorConfig.coords[0], newNode.coords[1] + decoratorConfig.coords[1]], decoratorConfig.width, decoratorConfig.height, newNode.getPriority(), decoratorConfig.html, `${newNode.id}_decorator_${i}`);
4942
+ }
4943
+ }
4944
+ // add node label
4945
+ if (newNodeType.label) {
4946
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), newNodeType.label);
4947
+ const newField = new DiagramField(model, newNode, [newNode.coords[0] + getLeftMargin(labelConfiguration), newNode.coords[1] + getTopMargin(labelConfiguration)], newNode.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newNode.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4948
+ newField.text = node.label;
4949
+ newNode.label = newField;
4950
+ model.fields.add(newField);
4951
+ newField.updateInView();
4900
4952
  }
4901
4953
  for (const child of node.children || []) {
4902
4954
  const newChild = this.importNode(model, child);
@@ -4909,16 +4961,14 @@ class DagaImporter {
4909
4961
  const newSection = new DiagramSection(model, newNode, section.indexXInNode, section.indexYInNode, section.coords, section.width, section.height, section.id);
4910
4962
  (_b = newNode.sections) === null || _b === void 0 ? void 0 : _b.push(newSection);
4911
4963
  model.sections.add(newSection);
4912
- if (section.label) {
4913
- // add section label
4914
- if ((_f = (_e = (_d = (_c = newNodeType.sectionGrid) === null || _c === void 0 ? void 0 : _c.sections) === null || _d === void 0 ? void 0 : _d[section.indexYInNode]) === null || _e === void 0 ? void 0 : _e[section.indexXInNode]) === null || _f === void 0 ? void 0 : _f.label) {
4915
- const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_k = (_j = (_h = (_g = newNodeType.sectionGrid) === null || _g === void 0 ? void 0 : _g.sections) === null || _h === void 0 ? void 0 : _h[section.indexYInNode]) === null || _j === void 0 ? void 0 : _j[section.indexXInNode]) === null || _k === void 0 ? void 0 : _k.label);
4916
- const newField = new DiagramField(model, newSection, [newSection.coords[0] + getLeftMargin(labelConfiguration), newSection.coords[1] + getTopMargin(labelConfiguration)], newSection.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newSection.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4917
- newField.text = section.label;
4918
- newSection.label = newField;
4919
- model.fields.add(newField);
4920
- newField.updateInView();
4921
- }
4964
+ // add section label
4965
+ if ((_f = (_e = (_d = (_c = newNodeType.sectionGrid) === null || _c === void 0 ? void 0 : _c.sections) === null || _d === void 0 ? void 0 : _d[section.indexYInNode]) === null || _e === void 0 ? void 0 : _e[section.indexXInNode]) === null || _f === void 0 ? void 0 : _f.label) {
4966
+ const labelConfiguration = Object.assign(Object.assign({}, DIAGRAM_FIELD_DEFAULTS), (_k = (_j = (_h = (_g = newNodeType.sectionGrid) === null || _g === void 0 ? void 0 : _g.sections) === null || _h === void 0 ? void 0 : _h[section.indexYInNode]) === null || _j === void 0 ? void 0 : _j[section.indexXInNode]) === null || _k === void 0 ? void 0 : _k.label);
4967
+ const newField = new DiagramField(model, newSection, [newSection.coords[0] + getLeftMargin(labelConfiguration), newSection.coords[1] + getTopMargin(labelConfiguration)], newSection.width - getLeftMargin(labelConfiguration) - getRightMargin(labelConfiguration), newSection.height - getTopMargin(labelConfiguration) - getBottomMargin(labelConfiguration), labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4968
+ newField.text = section.label;
4969
+ newSection.label = newField;
4970
+ model.fields.add(newField);
4971
+ newField.updateInView();
4922
4972
  }
4923
4973
  let portCounter = 0;
4924
4974
  for (const port of section.ports || []) {
@@ -4945,7 +4995,7 @@ class DagaImporter {
4945
4995
  default:
4946
4996
  labelCoords = newPort.coords;
4947
4997
  }
4948
- const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4998
+ const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4949
4999
  newField.text = port.label;
4950
5000
  newPort.label = newField;
4951
5001
  model.fields.add(newField);
@@ -4992,7 +5042,7 @@ class DagaImporter {
4992
5042
  default:
4993
5043
  labelCoords = newPort.coords;
4994
5044
  }
4995
- const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
5045
+ const newField = new DiagramField(model, newPort, labelCoords, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontSize, labelConfiguration.fontFamily, labelConfiguration.color, labelConfiguration.selectedColor, labelConfiguration.horizontalAlign, labelConfiguration.verticalAlign, labelConfiguration.orientation, labelConfiguration.multiline, '', labelConfiguration.editable, labelConfiguration.fit, labelConfiguration.shrink);
4996
5046
  newField.text = port.label;
4997
5047
  newPort.label = newField;
4998
5048
  model.fields.add(newField);
@@ -6289,6 +6339,7 @@ var DiagramEvents;
6289
6339
  DiagramEvents[DiagramEvents["SecondaryClick"] = 2] = "SecondaryClick";
6290
6340
  DiagramEvents[DiagramEvents["Selection"] = 3] = "Selection";
6291
6341
  DiagramEvents[DiagramEvents["Highlight"] = 4] = "Highlight";
6342
+ DiagramEvents[DiagramEvents["DraggingNode"] = 5] = "DraggingNode";
6292
6343
  })(DiagramEvents || (DiagramEvents = {}));
6293
6344
  /**
6294
6345
  * Diagram event which consists of the user zooming or panning.
@@ -6372,6 +6423,20 @@ class DiagramHighlightedEvent extends DiagramEvent {
6372
6423
  this.target = target;
6373
6424
  }
6374
6425
  }
6426
+ /**
6427
+ * Diagram event which consists of the user dragging a diagram node.
6428
+ */
6429
+ class DiagramDraggingNodeEvent extends DiagramEvent {
6430
+ /**
6431
+ * Create a diagram dragging node event.
6432
+ *
6433
+ * @param target Diagram node which is targeted by the event.
6434
+ */
6435
+ constructor(target) {
6436
+ super(DiagramEvents.DraggingNode);
6437
+ this.target = target;
6438
+ }
6439
+ }
6375
6440
 
6376
6441
  /**
6377
6442
  * A foreign object which is inserted with arbitrary html into a diagram.
@@ -6648,8 +6713,8 @@ const isSecondaryButton = event => {
6648
6713
  * @private
6649
6714
  * @see linePath
6650
6715
  */
6651
- const getConnectionPath = (shape, startCoords, endCoords, startDirection, endDirection, width, startMarkerWidth, endMarkerWidth) => {
6652
- return linePath(shape, [startCoords, endCoords], startDirection, endDirection, Math.max(
6716
+ const getConnectionPath = (shape, startCoords, endCoords, startDirection, endDirection, points, width, startMarkerWidth, endMarkerWidth) => {
6717
+ return linePath(shape, [startCoords, ...points, endCoords], startDirection, endDirection, Math.max(
6653
6718
  // reasonable value for the minimumDistanceBeforeTurn relative to the line width
6654
6719
  10, startMarkerWidth || 0, endMarkerWidth || 0) * width);
6655
6720
  };
@@ -6669,6 +6734,34 @@ const getRelatedNodeOrItself = element => {
6669
6734
  }
6670
6735
  return element.rootElement instanceof DiagramNode || element.rootElement instanceof DiagramSection || element.rootElement instanceof DiagramPort ? getRelatedNodeOrItself(element.rootElement) : element;
6671
6736
  };
6737
+ const needsResizerX = element => {
6738
+ if (element instanceof DiagramNode) {
6739
+ return element.type.resizableX !== false;
6740
+ }
6741
+ if (element instanceof DiagramSection) {
6742
+ if (element.type !== undefined) {
6743
+ return element.type.resizableX !== false;
6744
+ }
6745
+ if (element.node !== undefined) {
6746
+ return needsResizerX(element.node);
6747
+ }
6748
+ }
6749
+ return false;
6750
+ };
6751
+ const needsResizerY = element => {
6752
+ if (element instanceof DiagramNode) {
6753
+ return element.type.resizableY !== false;
6754
+ }
6755
+ if (element instanceof DiagramSection) {
6756
+ if (element.type !== undefined) {
6757
+ return element.type.resizableY !== false;
6758
+ }
6759
+ if (element.node !== undefined) {
6760
+ return needsResizerY(element.node);
6761
+ }
6762
+ }
6763
+ return false;
6764
+ };
6672
6765
  const initializeLook = selection => {
6673
6766
  selection.filter('.shaped-look').append('path');
6674
6767
  selection.filter('.image-look').append('image').attr('preserveAspectRatio', 'none');
@@ -7143,6 +7236,7 @@ class DiagramUserSelection extends DiagramElementSet {
7143
7236
  constructor(canvas, diagramPropertiesText) {
7144
7237
  super();
7145
7238
  this.canvas = canvas;
7239
+ // TODO: would be a good idea to be able to configure how often this fires, or whether at all
7146
7240
  this.canvas.propertyEditorChanges$.pipe(debounceTime(2000)).subscribe(() => {
7147
7241
  this.makeUpdateValuesAction();
7148
7242
  });
@@ -7377,29 +7471,6 @@ class DiagramUserSelection extends DiagramElementSet {
7377
7471
  }
7378
7472
  }
7379
7473
 
7380
- const degreesToRadians = theta => theta * Math.PI / 180;
7381
- /**
7382
- * Calculates the original size of the a rectangle that has been rotated by the given number of degrees resulting in a bounding box of the given size.
7383
- *
7384
- * @param width The width of a bounding box.
7385
- * @param height The height of a bounding box.
7386
- * @param orientation A rotation in degrees.
7387
- * @returns The size of the original rectangle.
7388
- */
7389
- const unrotate = (width, height, orientation) => {
7390
- // TODO: this method fails under certain edge cases
7391
- // like for example, when angle is 45 degrees so sin(theta) == cos(theta)
7392
- const theta = degreesToRadians(orientation);
7393
- const orientationSine = Math.sin(theta);
7394
- const orientationCosine = Math.cos(theta);
7395
- const oldWidth = (Math.abs(width * orientationCosine) - Math.abs(height * orientationSine)) / (orientationCosine * orientationCosine - orientationSine * orientationSine);
7396
- const oldHeight = (Math.abs(width * orientationSine) - Math.abs(height * orientationCosine)) / (orientationSine * orientationSine - orientationCosine * orientationCosine);
7397
- return [oldWidth, oldHeight];
7398
- };
7399
-
7400
- var _a;
7401
- const isWebkit = ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.indexOf('AppleWebKit')) >= 0;
7402
-
7403
7474
  /**
7404
7475
  * Thickness of the invisible path around a connection used to make it easier to click on, in diagram units.
7405
7476
  * @private
@@ -7434,7 +7505,7 @@ class DiagramCanvas {
7434
7505
  * @param config The configuration object used to set the parameters of this canvas.
7435
7506
  */
7436
7507
  constructor(parentComponent, config) {
7437
- 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;
7508
+ 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;
7438
7509
  this.backgroundPatternId = `daga-background-pattern-id-${DiagramCanvas.canvasCount++}`;
7439
7510
  this.zoomTransform = d3.zoomIdentity;
7440
7511
  // used to distinguish drags from clicks when dragging elements and during multiple selection
@@ -7462,12 +7533,13 @@ class DiagramCanvas {
7462
7533
  this.panRate = ((_z = config.canvas) === null || _z === void 0 ? void 0 : _z.panRate) || 100;
7463
7534
  this.inferConnectionType = ((_0 = config.connectionSettings) === null || _0 === void 0 ? void 0 : _0.inferConnectionType) || false;
7464
7535
  this.autoTightenConnections = ((_1 = config.connectionSettings) === null || _1 === void 0 ? void 0 : _1.autoTighten) !== false;
7465
- this.allowConnectionLoops = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.allowLoops) || false;
7466
- this.allowSharingPorts = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.sharePorts) !== false;
7467
- this.allowSharingBothPorts = ((_4 = config.connectionSettings) === null || _4 === void 0 ? void 0 : _4.shareBothPorts) || false;
7468
- this.portHighlightRadius = ((_5 = config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.portHighlightRadius) || 100;
7536
+ this.tightenConnectionsAcrossPortTypes = ((_2 = config.connectionSettings) === null || _2 === void 0 ? void 0 : _2.tightenAcrossPortTypes) || false;
7537
+ this.allowConnectionLoops = ((_3 = config.connectionSettings) === null || _3 === void 0 ? void 0 : _3.allowLoops) || false;
7538
+ this.allowSharingPorts = ((_4 = config.connectionSettings) === null || _4 === void 0 ? void 0 : _4.sharePorts) !== false;
7539
+ this.allowSharingBothPorts = ((_5 = config.connectionSettings) === null || _5 === void 0 ? void 0 : _5.shareBothPorts) || false;
7540
+ this.portHighlightRadius = ((_6 = config.connectionSettings) === null || _6 === void 0 ? void 0 : _6.portHighlightRadius) || 100;
7469
7541
  this.multipleSelectionOn = false;
7470
- this.priorityThresholds = ((_6 = config.canvas) === null || _6 === void 0 ? void 0 : _6.priorityThresholds) || [];
7542
+ this.priorityThresholds = ((_7 = config.canvas) === null || _7 === void 0 ? void 0 : _7.priorityThresholds) || [];
7471
7543
  this.priorityThreshold = this.priorityThresholds ? this.priorityThresholds[0] : undefined;
7472
7544
  this.layoutFormat = config.layoutFormat;
7473
7545
  this.userActions = config.userActions || {};
@@ -7494,7 +7566,7 @@ class DiagramCanvas {
7494
7566
  const connectionType = new DiagramConnectionType(Object.assign(Object.assign({}, config.connectionTypeDefaults), connectionTypeConfig));
7495
7567
  this.model.connections.types.add(connectionType);
7496
7568
  }
7497
- 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;
7569
+ 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;
7498
7570
  }
7499
7571
  }
7500
7572
  addValidator(validator) {
@@ -7697,10 +7769,6 @@ class DiagramCanvas {
7697
7769
  const transformAttribute = event.transform.toString();
7698
7770
  this.selectCanvasElements().attr('transform', transformAttribute);
7699
7771
  d3.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
7700
- if (isWebkit) {
7701
- // force update fields to compensate for a rendering bug in webkit
7702
- this.updateFieldsInView();
7703
- }
7704
7772
  this.contextMenu.close();
7705
7773
  this.diagramEvent$.next(new DiagramZoomEvent([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
7706
7774
  }).on(ZoomEvents.End, () => {
@@ -7754,7 +7822,14 @@ class DiagramCanvas {
7754
7822
  }
7755
7823
  }
7756
7824
  getViewCoordinates() {
7757
- return [this.zoomTransform.x, this.zoomTransform.y];
7825
+ var _a, _b, _c;
7826
+ 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();
7827
+ /*
7828
+ transform the coordinates of the zoomTransform to the coordinates
7829
+ needed to point the zoomTransfrom to the center of the screen to
7830
+ ensure that canvas.translateTo(getViewCoordinates()) has no effect
7831
+ */
7832
+ return [((canvasViewBoundingBox.width + canvasViewBoundingBox.x) / 2 - this.zoomTransform.x) / this.zoomTransform.k, ((canvasViewBoundingBox.height + canvasViewBoundingBox.y) / 2 - this.zoomTransform.y) / this.zoomTransform.k];
7758
7833
  }
7759
7834
  translateBy(x, y) {
7760
7835
  if (!isNaN(x) && !isNaN(y)) {
@@ -7766,12 +7841,42 @@ class DiagramCanvas {
7766
7841
  this.zoomBehavior.translateTo(this.selectCanvasView(), x, y);
7767
7842
  }
7768
7843
  }
7769
- center() {
7844
+ zoomAndPanTo(x, y, z, duration) {
7845
+ if (!duration || duration <= 0) {
7846
+ this.zoomBehavior.scaleTo(this.selectCanvasView(), z);
7847
+ this.zoomBehavior.translateTo(this.selectCanvasView(), x, y);
7848
+ return;
7849
+ }
7850
+ this.zoomBehavior.interpolate(d3.interpolate);
7851
+ const [startingX, startingY] = this.getViewCoordinates();
7852
+ const startingZoom = this.getZoomLevel();
7853
+ const targetX = x,
7854
+ targetY = y,
7855
+ targetZoom = z;
7856
+ this.selectCanvasElements().transition().duration(duration).ease(d3.easeCubicInOut).tween('progress', () => {
7857
+ let animationInterrupted = false;
7858
+ return value => {
7859
+ try {
7860
+ if (!animationInterrupted) {
7861
+ const currentX = value * (targetX - startingX) + startingX;
7862
+ const currentY = value * (targetY - startingY) + startingY;
7863
+ const currentZoom = value * (targetZoom - startingZoom) + startingZoom;
7864
+ this.zoomBehavior.scaleTo(this.selectCanvasView(), currentZoom);
7865
+ this.zoomBehavior.translateTo(this.selectCanvasView(), currentX, currentY);
7866
+ }
7867
+ } catch (e) {
7868
+ console.warn('Animation has been interrupted');
7869
+ animationInterrupted = true;
7870
+ }
7871
+ };
7872
+ });
7873
+ }
7874
+ center(nodeIds, maxZoomLevel, duration) {
7770
7875
  var _a;
7771
7876
  // if there are no nodes, we have nothing to do here
7772
7877
  if (this.model.nodes.length > 0) {
7773
7878
  const canvasViewBoundingBox = (_a = this.selectCanvasView().select('rect').node()) === null || _a === void 0 ? void 0 : _a.getBBox();
7774
- const nonRemovedNodes = this.model.nodes.all();
7879
+ const nonRemovedNodes = (nodeIds === null || nodeIds === void 0 ? void 0 : nodeIds.map(i => this.model.nodes.get(i)).filter(n => !!n)) || this.model.nodes.all();
7775
7880
  const minimumX = Math.min(...nonRemovedNodes.map(n => n.coords[0]));
7776
7881
  const maximumX = Math.max(...nonRemovedNodes.map(n => n.coords[0] + n.width));
7777
7882
  const averageX = (minimumX + maximumX) / 2;
@@ -7786,12 +7891,12 @@ class DiagramCanvas {
7786
7891
  * (windowRangeX / rangeX) is the zoom level to fit everything horizontally
7787
7892
  * (windowRangeY / rangeY) is the zoom level to fit everything vertically
7788
7893
  * the minimum between them is the zoom to fit everything in the screen both horizontally and vertically
7789
- * we also add 1 to the list so that if the zoom exceeds 1 it is set to 1
7894
+ * we also add maxZoomLevel to the list so that if the zoom exceeds maxZoomLevel it is set to maxZoomLevel
7895
+ * or 1 if maxZoomLevel is undefined
7790
7896
  * a zoom bigger than 1 means zooming in instead of out, and we don't want to zoom in if it's not necessary
7791
7897
  */
7792
- const zoom = Math.min(windowRangeX / rangeX, windowRangeY / rangeY, 1);
7793
- this.translateTo(averageX, averageY);
7794
- this.zoomTo(zoom);
7898
+ const zoom = Math.min(windowRangeX / rangeX, windowRangeY / rangeY, maxZoomLevel !== undefined ? maxZoomLevel : 1);
7899
+ this.zoomAndPanTo(averageX, averageY, zoom, duration);
7795
7900
  }
7796
7901
  }
7797
7902
  getClosestGridPoint(point) {
@@ -7847,7 +7952,7 @@ class DiagramCanvas {
7847
7952
  updateNodesInView(...ids) {
7848
7953
  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);
7849
7954
  const exitSelection = updateSelection.exit();
7850
- const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => `diagram-node${d.type.resizableX ? ' resizable-x' : ''}${d.type.resizableY ? ' resizable-y' : ''} ${d.type.defaultLook.lookType}`);
7955
+ 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}`);
7851
7956
  if (ids && ids.length > 0) {
7852
7957
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
7853
7958
  }
@@ -7910,28 +8015,28 @@ class DiagramCanvas {
7910
8015
  this.secondaryButton = false;
7911
8016
  }));
7912
8017
  initializeLook(enterSelection);
7913
- enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
7914
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableX && !d.removed) {
8018
+ enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(Events.MouseOver, (_event, d) => {
8019
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
7915
8020
  setCursorStyle(CursorStyle.EWResize);
7916
8021
  }
7917
8022
  }).on(Events.MouseOut, (_event, d) => {
7918
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableX && !d.removed) {
8023
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
7919
8024
  setCursorStyle();
7920
8025
  }
7921
8026
  }).call(d3.drag().on(DragEvents.Start, (_event, d) => {
7922
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableX && !d.removed) {
8027
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
7923
8028
  setCursorStyle(CursorStyle.EWResize);
7924
8029
  this.currentAction = new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
7925
8030
  } else {
7926
8031
  setCursorStyle(CursorStyle.NotAllowed);
7927
8032
  }
7928
8033
  }).on(DragEvents.Drag, (event, d) => {
7929
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableX && !d.removed) {
8034
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
7930
8035
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7931
8036
  d.stretch(Side.Left, d.coords[0] - pointerCoords[0]);
7932
8037
  }
7933
8038
  }).on(DragEvents.End, (event, d) => {
7934
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableX && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchNode) {
8039
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchNode) {
7935
8040
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7936
8041
  if (this.snapToGrid) {
7937
8042
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
@@ -7946,28 +8051,28 @@ class DiagramCanvas {
7946
8051
  }
7947
8052
  setCursorStyle();
7948
8053
  }));
7949
- enterSelection.filter('.resizable-y').append('line').attr('class', 'top-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
7950
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableY && !d.removed) {
8054
+ enterSelection.filter('.resizable-y').append('line').attr('class', 'top-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(Events.MouseOver, (_event, d) => {
8055
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
7951
8056
  setCursorStyle(CursorStyle.NSResize);
7952
8057
  }
7953
8058
  }).on(Events.MouseOut, (_event, d) => {
7954
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableY && !d.removed) {
8059
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
7955
8060
  setCursorStyle();
7956
8061
  }
7957
8062
  }).call(d3.drag().on(DragEvents.Start, (_event, d) => {
7958
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableY && !d.removed) {
8063
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
7959
8064
  setCursorStyle(CursorStyle.NSResize);
7960
8065
  this.currentAction = new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
7961
8066
  } else {
7962
8067
  setCursorStyle(CursorStyle.NotAllowed);
7963
8068
  }
7964
8069
  }).on(DragEvents.Drag, (event, d) => {
7965
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableY && !d.removed) {
8070
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
7966
8071
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7967
8072
  d.stretch(Side.Top, d.coords[1] - pointerCoords[1]);
7968
8073
  }
7969
8074
  }).on(DragEvents.End, (event, d) => {
7970
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableY && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchNode) {
8075
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchNode) {
7971
8076
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
7972
8077
  if (this.snapToGrid) {
7973
8078
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[0], pointerCoords[1] - d.type.snapToGridOffset[1]]);
@@ -7982,28 +8087,28 @@ class DiagramCanvas {
7982
8087
  }
7983
8088
  setCursorStyle();
7984
8089
  }));
7985
- enterSelection.filter('.resizable-x').append('line').attr('class', 'right-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
7986
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableX && !d.removed) {
8090
+ enterSelection.filter('.resizable-x').append('line').attr('class', 'right-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(Events.MouseOver, (_event, d) => {
8091
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
7987
8092
  setCursorStyle(CursorStyle.EWResize);
7988
8093
  }
7989
8094
  }).on(Events.MouseOut, (_event, d) => {
7990
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableX && !d.removed) {
8095
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
7991
8096
  setCursorStyle();
7992
8097
  }
7993
8098
  }).call(d3.drag().on(DragEvents.Start, (_event, d) => {
7994
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableX && !d.removed) {
8099
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
7995
8100
  setCursorStyle(CursorStyle.EWResize);
7996
8101
  this.currentAction = new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
7997
8102
  } else {
7998
8103
  setCursorStyle(CursorStyle.NotAllowed);
7999
8104
  }
8000
8105
  }).on(DragEvents.Drag, (event, d) => {
8001
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableX && !d.removed) {
8106
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed) {
8002
8107
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8003
8108
  d.stretch(Side.Right, pointerCoords[0] - (d.coords[0] + d.width));
8004
8109
  }
8005
8110
  }).on(DragEvents.End, (event, d) => {
8006
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableX && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchNode) {
8111
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableX() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchNode) {
8007
8112
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8008
8113
  if (this.snapToGrid) {
8009
8114
  pointerCoords = this.getClosestGridPoint([pointerCoords[0] - d.type.snapToGridOffset[2], pointerCoords[1] - d.type.snapToGridOffset[3]]);
@@ -8018,28 +8123,28 @@ class DiagramCanvas {
8018
8123
  }
8019
8124
  setCursorStyle();
8020
8125
  }));
8021
- enterSelection.filter('.resizable-y').append('line').attr('class', 'bottom-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
8022
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableY && !d.removed) {
8126
+ enterSelection.filter('.resizable-y').append('line').attr('class', 'bottom-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(Events.MouseOver, (_event, d) => {
8127
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8023
8128
  setCursorStyle(CursorStyle.NSResize);
8024
8129
  }
8025
8130
  }).on(Events.MouseOut, (_event, d) => {
8026
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableY && !d.removed) {
8131
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8027
8132
  setCursorStyle();
8028
8133
  }
8029
8134
  }).call(d3.drag().on(DragEvents.Start, (_event, d) => {
8030
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableY && !d.removed) {
8135
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8031
8136
  setCursorStyle(CursorStyle.NSResize);
8032
8137
  this.currentAction = new SetGeometryAction(this, DiagramActions.StretchNode, d.id, d.getGeometry(), d.getGeometry());
8033
8138
  } else {
8034
8139
  setCursorStyle(CursorStyle.NotAllowed);
8035
8140
  }
8036
8141
  }).on(DragEvents.Drag, (event, d) => {
8037
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableY && !d.removed) {
8142
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed) {
8038
8143
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8039
8144
  d.stretch(Side.Bottom, pointerCoords[1] - (d.coords[1] + d.height));
8040
8145
  }
8041
8146
  }).on(DragEvents.End, (event, d) => {
8042
- if (this.canUserPerformAction(DiagramActions.StretchNode) && d.type.resizableY && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchNode) {
8147
+ if (this.canUserPerformAction(DiagramActions.StretchNode) && d.getResizableY() && !d.removed && this.currentAction instanceof SetGeometryAction && this.currentAction.intent === DiagramActions.StretchNode) {
8043
8148
  let pointerCoords = this.getPointerLocationRelativeToCanvas(event);
8044
8149
  if (this.snapToGrid) {
8045
8150
  if (this.snapToGrid) {
@@ -8058,17 +8163,17 @@ class DiagramCanvas {
8058
8163
  }));
8059
8164
  mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
8060
8165
  updateLook(mergeSelection);
8061
- 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);
8062
- 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);
8063
- 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);
8064
- 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);
8166
+ 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);
8167
+ 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);
8168
+ 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);
8169
+ 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);
8065
8170
  }
8066
8171
  updateSectionsInView(...ids) {
8067
8172
  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);
8068
8173
  const exitSelection = updateSelection.exit();
8069
8174
  const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', d => {
8070
8175
  var _a;
8071
- return `diagram-section${d.getResizableX() ? ' resizable-x' : ''}${d.getResizableY() ? ' resizable-y' : ''} ${(_a = d.look) === null || _a === void 0 ? void 0 : _a.lookType}`;
8176
+ return `diagram-section${needsResizerX(d) ? ' resizable-x' : ''}${needsResizerY(d) ? ' resizable-y' : ''} ${(_a = d.look) === null || _a === void 0 ? void 0 : _a.lookType}`;
8072
8177
  });
8073
8178
  if (ids && ids.length > 0) {
8074
8179
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
@@ -8149,7 +8254,7 @@ class DiagramCanvas {
8149
8254
  this.secondaryButton = false;
8150
8255
  }));
8151
8256
  initializeLook(enterSelection);
8152
- enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
8257
+ enterSelection.filter('.resizable-x').append('line').attr('class', 'left-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(Events.MouseOver, (_event, d) => {
8153
8258
  if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableX() && !d.removed) {
8154
8259
  setCursorStyle(CursorStyle.EWResize);
8155
8260
  }
@@ -8183,7 +8288,7 @@ class DiagramCanvas {
8183
8288
  }
8184
8289
  setCursorStyle();
8185
8290
  }));
8186
- enterSelection.filter('.resizable-y').append('line').attr('class', 'top-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
8291
+ enterSelection.filter('.resizable-y').append('line').attr('class', 'top-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(Events.MouseOver, (_event, d) => {
8187
8292
  if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableY() && !d.removed) {
8188
8293
  setCursorStyle(CursorStyle.NSResize);
8189
8294
  }
@@ -8217,7 +8322,7 @@ class DiagramCanvas {
8217
8322
  }
8218
8323
  setCursorStyle();
8219
8324
  }));
8220
- enterSelection.filter('.resizable-x').append('line').attr('class', 'right-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
8325
+ enterSelection.filter('.resizable-x').append('line').attr('class', 'right-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(Events.MouseOver, (_event, d) => {
8221
8326
  if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableX() && !d.removed) {
8222
8327
  setCursorStyle(CursorStyle.EWResize);
8223
8328
  }
@@ -8251,7 +8356,7 @@ class DiagramCanvas {
8251
8356
  }
8252
8357
  setCursorStyle();
8253
8358
  }));
8254
- enterSelection.filter('.resizable-y').append('line').attr('class', 'bottom-resizer').attr('stroke', 'transparent').attr('stroke-width', `${RESIZER_THICKNESS}px`).on(Events.MouseOver, (_event, d) => {
8359
+ enterSelection.filter('.resizable-y').append('line').attr('class', 'bottom-resizer').attr('stroke', 'transparent').attr('stroke-width', RESIZER_THICKNESS).on(Events.MouseOver, (_event, d) => {
8255
8360
  if (this.canUserPerformAction(DiagramActions.StretchSection) && d.getResizableY() && !d.removed) {
8256
8361
  setCursorStyle(CursorStyle.NSResize);
8257
8362
  }
@@ -8287,10 +8392,10 @@ class DiagramCanvas {
8287
8392
  }));
8288
8393
  mergeSelection.attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1);
8289
8394
  updateLook(mergeSelection);
8290
- 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);
8291
- 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);
8292
- 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);
8293
- 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);
8395
+ 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);
8396
+ 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);
8397
+ 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);
8398
+ 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);
8294
8399
  }
8295
8400
  updatePortsInView(...ids) {
8296
8401
  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);
@@ -8375,14 +8480,14 @@ class DiagramCanvas {
8375
8480
  }
8376
8481
  }
8377
8482
  }).on(DragEvents.Drag, (event, d) => {
8378
- var _a, _b, _c, _d;
8483
+ var _a, _b, _c, _d, _e;
8379
8484
  if (this.multipleSelectionOn || this.secondaryButton) {
8380
8485
  this.continueMultipleSelection(event);
8381
8486
  } else {
8382
8487
  if (this.canUserPerformAction(DiagramActions.AddConnection) && !d.removed) {
8383
8488
  if (this.unfinishedConnection !== undefined) {
8384
8489
  const endCoords = [event.x, event.y];
8385
- (_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));
8490
+ (_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));
8386
8491
  const unfinishedConnectionGhostNode = (_d = this.unfinishedConnectionTracer) === null || _d === void 0 ? void 0 : _d.node();
8387
8492
  if (unfinishedConnectionGhostNode) {
8388
8493
  let margin = 2;
@@ -8397,6 +8502,7 @@ class DiagramCanvas {
8397
8502
  this.unfinishedConnection.endCoords = endCoords;
8398
8503
  }
8399
8504
  this.updateConnectionsInView(UNFINISHED_CONNECTION_ID);
8505
+ (_e = this.unfinishedConnectionPort) === null || _e === void 0 ? void 0 : _e.raise(false);
8400
8506
  // highlight closest target port
8401
8507
  if (this.model.ports.length > 0) {
8402
8508
  const pointerCoords = this.getPointerLocationRelativeToCanvas(event);
@@ -8530,29 +8636,29 @@ class DiagramCanvas {
8530
8636
  enterSelection.select('g.diagram-connection-end-label').append('text').style('user-select', 'none');
8531
8637
  mergeSelection.attr('opacity', d => d.removed ? 0.5 : 1).select('path.diagram-connection-path').attr('d', d => {
8532
8638
  var _a, _b;
8533
- 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);
8534
- }).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');
8639
+ 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);
8640
+ }).attr('marker-start', d => `url(#${d.id}-start-marker)`).attr('marker-end', d => `url(#${d.id}-end-marker)`).attr('stroke', d => d.look.color || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.color).attr('stroke-width', d => d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
8535
8641
  mergeSelection.select('path.diagram-connection-path-box').attr('d', d => {
8536
8642
  var _a, _b;
8537
- 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);
8643
+ 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);
8538
8644
  }).attr('stroke', 'transparent')
8539
8645
  // allow generating pointer events even when it is transparent
8540
- .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');
8646
+ .attr('pointer-events', 'stroke').attr('stroke-width', d => (d.look.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness) + CONNECTION_PATH_BOX_THICKNESS).attr('stroke-dasharray', d => lineStyleDasharray(d.look.style || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.style, d.type.defaultLook.thickness || DIAGRAM_CONNECTION_TYPE_DEFAULTS.look.thickness)).attr('fill', 'none');
8541
8647
  mergeSelection.data().forEach(connection => {
8542
8648
  this.updateConnectionLabelsInView(connection);
8543
8649
  this.updateConnectionMarkersInView(connection);
8544
8650
  });
8545
8651
  }
8546
8652
  updateFieldsInView(...ids) {
8547
- let updateSelection = this.selectCanvasElements().selectAll('foreignObject.diagram-field').data(this.model.fields.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
8653
+ let updateSelection = this.selectCanvasElements().selectAll('g.diagram-field').data(this.model.fields.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
8548
8654
  const exitSelection = updateSelection.exit();
8549
- const enterSelection = updateSelection.enter().append('foreignObject').attr('id', d => d.id).attr('class', 'diagram-field');
8655
+ const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-field');
8550
8656
  if (ids && ids.length > 0) {
8551
8657
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
8552
8658
  }
8553
8659
  const mergeSelection = enterSelection.merge(updateSelection);
8554
8660
  exitSelection.remove();
8555
- enterSelection.style('box-sizing', 'border-box').on(Events.MouseOver, (_event, d) => {
8661
+ enterSelection.on(Events.MouseOver, (_event, d) => {
8556
8662
  if (!this.dragging) {
8557
8663
  this.userHighlight.focusOn(d);
8558
8664
  this.diagramEvent$.next(new DiagramHighlightedEvent(d));
@@ -8589,22 +8695,7 @@ class DiagramCanvas {
8589
8695
  this.diagramEvent$.next(diagramEvent);
8590
8696
  if (!diagramEvent.defaultPrevented && this.canUserPerformAction(DiagramActions.EditField) && d.editable && !d.removed) {
8591
8697
  this.currentAction = new EditFieldAction(this, d.id, d.text, '');
8592
- this.createInputField(d.text, d.coords, d.width, d.height, d.fontSize, d.fontFamily || DIAGRAM_FIELD_DEFAULTS.fontFamily, d.orientation, () => {
8593
- // (_text)
8594
- /*
8595
- Empty for now
8596
- We should create a better function to stretch the root element as the text expands
8597
- Bear in mind that DiagramNode.setGeometry() calls DiagramNode.raise(), which breaks the input field
8598
- */
8599
- }, text => {
8600
- d.text = text;
8601
- if (this.currentAction instanceof EditFieldAction) {
8602
- this.currentAction.to = text;
8603
- this.currentAction.do();
8604
- this.actionStack.add(this.currentAction);
8605
- this.currentAction = undefined;
8606
- }
8607
- });
8698
+ this.openTextInput(d.id);
8608
8699
  }
8609
8700
  }).call(d3.drag().filter(event => {
8610
8701
  this.secondaryButton = isSecondaryButton(event);
@@ -8658,12 +8749,15 @@ class DiagramCanvas {
8658
8749
  }
8659
8750
  }
8660
8751
  this.secondaryButton = false;
8661
- })).append('xhtml:div').style('width', '100%').style('height', '100%').style('display', 'flex').append('xhtml:p').style('box-sizing', 'border-box').style('outline', 0).style('margin', 0).style('border', 0).style('padding', 0).style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
8662
- mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('div').style('justify-content', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === VerticalAlign.Center ? 'center' : d.verticalAlign === VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[0]}px`).style('max-height', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[1]}px`).style('overflow', d => d.fit ? 'default' : 'clip').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'end' : 'start').style('transform', d => `rotate(${d.orientation}deg)`).style('font-size', d => `${d.fontSize}px`).style('font-family', d => d.fontFamily || "'Wonder Unit Sans', sans-serif").style('font-weight', d => d.highlighted ? 600 : 400).style('color', d => d.selected ? d.selectedColor || '#000000' : d.color || '#000000').html(d => d.text.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, '<br/>'));
8663
- if (isWebkit) {
8664
- const zoomFactor = this.zoomTransform.k;
8665
- mergeSelection.attr('width', d => `${d.width * zoomFactor}px`).attr('height', d => `${d.height * zoomFactor}px`).select('div').style('position', 'absolute').style('left', d => `${d.coords[0] * zoomFactor + this.zoomTransform.x}px`).style('top', d => `${d.coords[1] * zoomFactor + this.zoomTransform.y}px`).select('p').style('font-size', d => `${d.fontSize * zoomFactor}px`);
8666
- }
8752
+ }));
8753
+ enterSelection.append('text');
8754
+ enterSelection.append('rect');
8755
+ mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]}) rotate(${d.orientation} ${d.width / 2} ${d.height / 2})`).attr('opacity', d => d.removed ? 0.5 : 1).select('text').attr('x', d => d.horizontalAlign === HorizontalAlign.Center ? d.width / 2 : d.horizontalAlign === HorizontalAlign.Right ? d.width : 0).attr('text-anchor', d => d.horizontalAlign === HorizontalAlign.Center ? 'middle' : d.horizontalAlign === HorizontalAlign.Right ? 'end' : 'start').attr('y', d => d.verticalAlign === VerticalAlign.Center ? d.height / 2 : d.verticalAlign === VerticalAlign.Bottom ? d.height : 0).attr('dominant-baseline', d => d.verticalAlign === VerticalAlign.Center ? 'middle' : d.verticalAlign === VerticalAlign.Bottom ? 'auto' : 'hanging').attr('font-size', d => d.fontSize).attr('font-family', d => d.fontFamily || "'Wonder Unit Sans', sans-serif").attr('font-weight', d => d.highlighted ? 600 : 400).attr('fill', d => d.selected ? d.selectedColor || '#000000' : d.color || '#000000').each(d => {
8756
+ this.setFieldTextAndWrap(d);
8757
+ });
8758
+ mergeSelection
8759
+ // add a transparent rectangle to capture pointer events on the text
8760
+ .select('rect').attr('x', 0).attr('y', 0).attr('width', d => d.width).attr('height', d => d.height).attr('fill', 'transparent');
8667
8761
  }
8668
8762
  updateObjectsInView(...ids) {
8669
8763
  let updateSelection = this.selectCanvasElements().selectAll('g.diagram-object').data(this.model.objects.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
@@ -8673,7 +8767,7 @@ class DiagramCanvas {
8673
8767
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
8674
8768
  }
8675
8769
  const mergeSelection = enterSelection.merge(updateSelection);
8676
- mergeSelection.attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.html);
8770
+ mergeSelection.attr('width', d => d.width).attr('height', d => d.height).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.html);
8677
8771
  exitSelection.remove();
8678
8772
  enterSelection.on(Events.ContextMenu, (event, d) => {
8679
8773
  if (this.dragging) {
@@ -8716,7 +8810,7 @@ class DiagramCanvas {
8716
8810
  updateSelection = updateSelection.filter(d => ids.includes(d.id));
8717
8811
  }
8718
8812
  const mergeSelection = enterSelection.merge(updateSelection);
8719
- mergeSelection.attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.html);
8813
+ mergeSelection.attr('width', d => d.width).attr('height', d => d.height).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).html(d => d.html);
8720
8814
  exitSelection.remove();
8721
8815
  enterSelection.on(Events.MouseOver, (_event, d) => {
8722
8816
  if (!this.dragging) {
@@ -8895,10 +8989,10 @@ class DiagramCanvas {
8895
8989
  pathStartLabelPoint = pathNode.getPointAtLength(getLeftMargin(labelConfiguration) + boundingWidth / 2);
8896
8990
  break;
8897
8991
  case Side.Top:
8898
- pathStartLabelPoint = pathNode.getPointAtLength(getBottomMargin(labelConfiguration) + boundingWidth / 2);
8992
+ pathStartLabelPoint = pathNode.getPointAtLength(getBottomMargin(labelConfiguration) + boundingHeight / 2);
8899
8993
  break;
8900
8994
  case Side.Bottom:
8901
- pathStartLabelPoint = pathNode.getPointAtLength(getTopMargin(labelConfiguration) + boundingWidth / 2);
8995
+ pathStartLabelPoint = pathNode.getPointAtLength(getTopMargin(labelConfiguration) + boundingHeight / 2);
8902
8996
  break;
8903
8997
  default:
8904
8998
  pathStartLabelPoint = pathNode.getPointAtLength(Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
@@ -8933,10 +9027,10 @@ class DiagramCanvas {
8933
9027
  pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getLeftMargin(labelConfiguration) + boundingWidth / 2));
8934
9028
  break;
8935
9029
  case Side.Top:
8936
- pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getBottomMargin(labelConfiguration) + boundingWidth / 2));
9030
+ pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getBottomMargin(labelConfiguration) + boundingHeight / 2));
8937
9031
  break;
8938
9032
  case Side.Bottom:
8939
- pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getTopMargin(labelConfiguration) + boundingWidth / 2));
9033
+ pathEndLabelPoint = pathNode.getPointAtLength(pathLength - (getTopMargin(labelConfiguration) + boundingHeight / 2));
8940
9034
  break;
8941
9035
  default:
8942
9036
  pathEndLabelPoint = pathNode.getPointAtLength(pathLength - Math.max(getLeftMargin(labelConfiguration) + boundingWidth / 2, getRightMargin(labelConfiguration) + boundingWidth / 2, getTopMargin(labelConfiguration) + boundingHeight / 2, getBottomMargin(labelConfiguration) + boundingHeight / 2));
@@ -9091,6 +9185,7 @@ class DiagramCanvas {
9091
9185
  if (port.allowsOutgoing || port.allowsIncoming) {
9092
9186
  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)) {
9093
9187
  this.unfinishedConnection = new DiagramConnection(this.model, this.connectionType, port, undefined, UNFINISHED_CONNECTION_ID);
9188
+ this.unfinishedConnectionPort = port;
9094
9189
  } else {
9095
9190
  if (this.inferConnectionType) {
9096
9191
  let differentConnectionType = this.model.connections.types.all().find(t => {
@@ -9105,6 +9200,7 @@ class DiagramCanvas {
9105
9200
  }
9106
9201
  if (differentConnectionType !== undefined) {
9107
9202
  this.unfinishedConnection = new DiagramConnection(this.model, differentConnectionType, port, undefined, UNFINISHED_CONNECTION_ID);
9203
+ this.unfinishedConnectionPort = port;
9108
9204
  }
9109
9205
  }
9110
9206
  }
@@ -9178,6 +9274,7 @@ class DiagramCanvas {
9178
9274
  (_b = this.unfinishedConnection) === null || _b === void 0 ? void 0 : _b.setEnd(undefined);
9179
9275
  (_d = (_c = this.unfinishedConnection) === null || _c === void 0 ? void 0 : _c.select()) === null || _d === void 0 ? void 0 : _d.remove();
9180
9276
  this.unfinishedConnection = undefined;
9277
+ this.unfinishedConnectionPort = undefined;
9181
9278
  }
9182
9279
  cancelAllUserActions() {
9183
9280
  this.currentAction = undefined;
@@ -9189,7 +9286,28 @@ class DiagramCanvas {
9189
9286
  canUserPerformAction(action) {
9190
9287
  return this.userActions[action] !== false;
9191
9288
  }
9192
- createInputField(text, coords, width, height, fontSize, fontFamily, orientation, changeCallback, finishCallback) {
9289
+ openTextInput(id) {
9290
+ const field = this.model.fields.get(id);
9291
+ if (field) {
9292
+ this.createInputField(field.text, field.coords, field.width, field.height, field.fontSize, field.fontFamily || DIAGRAM_FIELD_DEFAULTS.fontFamily, field.orientation, field.multiline, () => {
9293
+ // (_text)
9294
+ /*
9295
+ Empty for now
9296
+ We should create a better function to stretch the root element as the text expands
9297
+ Bear in mind that DiagramNode.setGeometry() calls DiagramNode.raise(), which breaks the input field
9298
+ */
9299
+ }, text => {
9300
+ field.text = text;
9301
+ if (this.currentAction instanceof EditFieldAction) {
9302
+ this.currentAction.to = text;
9303
+ this.currentAction.do();
9304
+ this.actionStack.add(this.currentAction);
9305
+ this.currentAction = undefined;
9306
+ }
9307
+ });
9308
+ }
9309
+ }
9310
+ createInputField(text, coords, width, height, fontSize, fontFamily, orientation, multiline, changeCallback, finishCallback) {
9193
9311
  // if we have a text input open, close it before creating a new one
9194
9312
  this.removeInputField();
9195
9313
  const inputFieldContainer = this.selectCanvasElements().append('foreignObject').attr('x', `${coords[0]}px`).attr('y', `${coords[1]}px`).attr('width', `${width}px`).attr('height', `${height}px`).style('box-sizing', 'border-box').style('border', '1px solid');
@@ -9199,16 +9317,16 @@ class DiagramCanvas {
9199
9317
  let inputFieldHeight;
9200
9318
  inputField.text(text).style('box-sizing', 'border-box').style('width', `${width}px`).style('height', `${height}px`).style('font-size', `${fontSize}px`).style('font-family', fontFamily).style('resize', 'none').style('outline', 0).style('border', 0).style('margin', 0).style('padding', 0).on(Events.KeyDown, event => {
9201
9319
  event.stopPropagation();
9202
- }).on(Events.KeyUp, event => {
9203
- event.stopPropagation();
9204
- if (event.key === Keys.Escape) {
9205
- const value = inputField.property('value');
9320
+ if (event.key === Keys.Escape || event.key === Keys.Enter && !multiline) {
9321
+ const value = inputField.property('value') || '';
9206
9322
  this.removeInputField();
9207
9323
  if (finishCallback) {
9208
9324
  finishCallback(value);
9209
9325
  }
9210
9326
  }
9211
- }).on(Events.Input, () => {
9327
+ }).on(Events.KeyUp, event => {
9328
+ event.stopPropagation();
9329
+ }).on(Events.Input, event => {
9212
9330
  const value = inputField.property('value');
9213
9331
  inputField.attr('cols', numberOfColumns(value) + 1);
9214
9332
  inputField.attr('rows', numberOfRows(value) + 1);
@@ -9251,13 +9369,54 @@ class DiagramCanvas {
9251
9369
  }
9252
9370
  minimumSizeOfField(field) {
9253
9371
  var _a, _b;
9254
- const pNode = (_b = (_a = field.select()) === null || _a === void 0 ? void 0 : _a.select('p')) === null || _b === void 0 ? void 0 : _b.node();
9255
- if (!pNode) {
9372
+ const textNode = (_b = (_a = field.select()) === null || _a === void 0 ? void 0 : _a.select('text')) === null || _b === void 0 ? void 0 : _b.node();
9373
+ if (!textNode) {
9256
9374
  // happens when a field has been created but not updated in view yet
9257
9375
  return [0, 0];
9258
9376
  }
9259
- const pBoundingBox = pNode.getBoundingClientRect();
9260
- return [pBoundingBox.width / this.zoomTransform.k, pBoundingBox.height / this.zoomTransform.k];
9377
+ const textBoundingBox = textNode.getBoundingClientRect();
9378
+ return [textBoundingBox.width / this.zoomTransform.k, textBoundingBox.height / this.zoomTransform.k];
9379
+ }
9380
+ setFieldTextAndWrap(field) {
9381
+ var _a, _b, _c, _d;
9382
+ const textSelection = (_a = field.select()) === null || _a === void 0 ? void 0 : _a.select('text');
9383
+ const textNode = textSelection === null || textSelection === void 0 ? void 0 : textSelection.node();
9384
+ if (textSelection && textNode) {
9385
+ this.setFieldText(field, textSelection, field.text);
9386
+ } else {
9387
+ // can happen if a field has been created but not updated in view yet
9388
+ // not sure if this still happens but should check just in case
9389
+ return;
9390
+ }
9391
+ if (field.fit) {
9392
+ // no need to wrap
9393
+ return;
9394
+ }
9395
+ let minimumSize = this.minimumSizeOfField(field);
9396
+ while (minimumSize[0] > field.width || minimumSize[1] > field.height) {
9397
+ const textString = ((_d = (_c = (_b = textSelection === null || textSelection === void 0 ? void 0 : textSelection.html()) === null || _b === void 0 ? void 0 : _b.replace(/<\/tspan>/g, '\n')) === null || _c === void 0 ? void 0 : _c.replace(/<tspan[^>]*>/g, '')) === null || _d === void 0 ? void 0 : _d.slice(0, -1)) || '';
9398
+ let newTextString = '...';
9399
+ if (textString.endsWith('...')) {
9400
+ newTextString = textString.slice(0, -4) + '...';
9401
+ } else {
9402
+ newTextString = textString.slice(0, -1) + '...';
9403
+ }
9404
+ if (textSelection) {
9405
+ this.setFieldText(field, textSelection, newTextString);
9406
+ }
9407
+ if (newTextString === '...') {
9408
+ // if no more characters can be removed and the new text is a bare ellipsis, stop the execution
9409
+ return;
9410
+ }
9411
+ minimumSize = this.minimumSizeOfField(field);
9412
+ }
9413
+ }
9414
+ setFieldText(field, textSelection, text) {
9415
+ const lines = text.split('\n');
9416
+ textSelection.html('');
9417
+ for (let i = 0; i < lines.length; ++i) {
9418
+ textSelection.append('tspan').attr('x', field.horizontalAlign === HorizontalAlign.Center ? field.width / 2 : field.horizontalAlign === HorizontalAlign.Right ? field.width : 0).attr('y', field.verticalAlign === VerticalAlign.Center ? (i + 0.5 - lines.length / 2) * field.fontSize + field.height / 2 : field.verticalAlign === VerticalAlign.Bottom ? field.height - (lines.length - i - 1) * field.fontSize : i * field.fontSize).text(lines[i]);
9419
+ }
9261
9420
  }
9262
9421
  /**
9263
9422
  * Method to call to start the moving of a node triggered by a user drag event.
@@ -9289,6 +9448,7 @@ class DiagramCanvas {
9289
9448
  }
9290
9449
  this.userHighlight.clear();
9291
9450
  this.dragging = true;
9451
+ this.diagramEvent$.next(new DiagramDraggingNodeEvent(d));
9292
9452
  }
9293
9453
  }
9294
9454
  /**
@@ -10294,4 +10454,4 @@ const getLocationsOfNodes = model => {
10294
10454
  return locations;
10295
10455
  };
10296
10456
 
10297
- export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramHighlightedEvent, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramPortType, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramSelectionEvent, DiagramUserHighlight, DiagramUserSelection, DiagramZoomEvent, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };
10457
+ export { ACTION_STACK_SIZE, ActionStack, AddConnectionAction, AddNodeAction, AdjacencyLayout, ApplyLayoutAction, BreadthAdjacencyLayout, BreadthLayout, ClosedShape, CollabClient, Corner, CursorStyle, DIAGRAM_FIELD_DEFAULTS, DagaExporter, DagaImporter, DiagramActionMethod, DiagramActions, DiagramCanvas, DiagramConnection, DiagramConnectionSet, DiagramConnectionType, DiagramContextMenu, DiagramDecorator, DiagramDecoratorSet, DiagramDoubleClickEvent, DiagramDraggingNodeEvent, DiagramElement, DiagramElementSet, DiagramEntitySet, DiagramEvent, DiagramEvents, DiagramField, DiagramFieldSet, DiagramHighlightedEvent, DiagramModel, DiagramNode, DiagramNodeSet, DiagramNodeType, DiagramObject, DiagramObjectSet, DiagramPort, DiagramPortSet, DiagramPortType, DiagramSecondaryClickEvent, DiagramSection, DiagramSectionSet, DiagramSelectionEvent, DiagramUserHighlight, DiagramUserSelection, DiagramZoomEvent, DragEvents, EditFieldAction, Events, ForceLayout, HorizontalAlign, HorizontalLayout, Keys, LineShape, LineStyle, MoveAction, PasteAction, PriorityLayout, Property, PropertySet, RemoveAction, ResizableMode, SetGeometryAction, SetParentAction, Side, TreeLayout, Type, UpdateValuesAction, ValueSet, VerticalAlign, VerticalLayout, ZoomEvents, addIfNotExists, diff, equals, filterByOnlyAncestors, filterByOnlyDescendants, generalClosedPath, getBottomMargin, getBottomPadding$1 as getBottomPadding, getLeftMargin, getLeftPadding$1 as getLeftPadding, getLocationsOfNodes, getRightMargin, getRightPadding$1 as getRightPadding, getTopMargin, getTopPadding$1 as getTopPadding, isObject, layouts, linePath, lineStyleDasharray, removeIfExists, setCursorStyle };