bpmn-js 18.15.0 → 18.16.1

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.
Files changed (34) hide show
  1. package/dist/bpmn-modeler.development.js +253 -137
  2. package/dist/bpmn-modeler.production.min.js +33 -33
  3. package/dist/bpmn-navigated-viewer.development.js +163 -121
  4. package/dist/bpmn-navigated-viewer.production.min.js +4 -4
  5. package/dist/bpmn-viewer.development.js +163 -121
  6. package/dist/bpmn-viewer.production.min.js +4 -4
  7. package/lib/BaseModeler.d.ts +0 -1
  8. package/lib/BaseViewer.d.ts +39 -1
  9. package/lib/BaseViewer.js +25 -6
  10. package/lib/Modeler.d.ts +0 -1
  11. package/lib/NavigatedViewer.d.ts +0 -1
  12. package/lib/Viewer.d.ts +0 -1
  13. package/lib/draw/BpmnRenderer.js +9 -8
  14. package/lib/draw/TextRenderer.d.ts +9 -0
  15. package/lib/draw/TextRenderer.js +42 -15
  16. package/lib/features/label-editing/LabelEditingProvider.js +31 -25
  17. package/lib/features/modeling/ElementFactory.d.ts +18 -19
  18. package/lib/features/modeling/ElementFactory.js +1 -1
  19. package/lib/features/modeling/Modeling.d.ts +0 -1
  20. package/lib/features/modeling/behavior/AdaptiveLabelPositioningBehavior.js +6 -1
  21. package/lib/features/modeling/behavior/ArtifactBehavior.d.ts +1 -3
  22. package/lib/features/modeling/behavior/ArtifactBehavior.js +3 -7
  23. package/lib/features/modeling/behavior/LabelBehavior.js +39 -11
  24. package/lib/features/modeling/behavior/ResizeBehavior.d.ts +0 -27
  25. package/lib/features/modeling/behavior/ResizeBehavior.js +1 -1
  26. package/lib/features/modeling/behavior/TextAnnotationBehavior.d.ts +2 -1
  27. package/lib/features/modeling/behavior/TextAnnotationBehavior.js +33 -2
  28. package/lib/features/outline/OutlineUtil.d.ts +0 -9
  29. package/lib/features/replace/ReplaceOptions.d.ts +0 -51
  30. package/lib/features/rules/BpmnRules.d.ts +3 -1
  31. package/lib/features/rules/BpmnRules.js +18 -5
  32. package/lib/util/AnnotationUtil.d.ts +1 -0
  33. package/lib/util/AnnotationUtil.js +2 -0
  34. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v18.15.0
2
+ * bpmn-js - bpmn-modeler v18.16.1
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2026-04-22
11
+ * Date: 2026-05-05
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -17584,6 +17584,27 @@
17584
17584
  remove$2(this._container);
17585
17585
  };
17586
17586
 
17587
+ /**
17588
+ * @overlord
17589
+ *
17590
+ * Register an event listener for events with the given name.
17591
+ *
17592
+ * The callback will be invoked with `event, ...additionalArguments`
17593
+ * that have been passed to {@link EventBus#fire}.
17594
+ *
17595
+ * Returning false from a listener will prevent the events default action
17596
+ * (if any is specified). To stop an event from being processed further in
17597
+ * other listeners execute {@link Event#stopPropagation}.
17598
+ *
17599
+ * Returning anything but `undefined` from a listener will stop the listener propagation.
17600
+ *
17601
+ * @template {keyof EventMap<ServiceMap>} EventName
17602
+ *
17603
+ * @param {EventName} events to subscribe to
17604
+ * @param {number} [priority=1000] listen priority
17605
+ * @param {EventBusEventCallback<(EventMap<ServiceMap>)[EventName]>} callback
17606
+ * @param {any} [that] callback context
17607
+ */
17587
17608
  /**
17588
17609
  * @overlord
17589
17610
  *
@@ -17617,12 +17638,10 @@
17617
17638
  *
17618
17639
  * Returning anything but `undefined` from a listener will stop the listener propagation.
17619
17640
  *
17620
- * @template {keyof EventMap<ServiceMap>} EventName
17621
- *
17622
- * @param {EventName} events to subscribe to
17623
- * @param {number} [priority=1000] listen priority
17624
- * @param {EventBusEventCallback<(EventMap<ServiceMap>)[EventName]>} callback
17625
- * @param {any} [that] callback context
17641
+ * @param {string|string[]} events The event(s) to listen to.
17642
+ * @param {number} [priority] The priority with which to listen.
17643
+ * @param {Function} callback The callback.
17644
+ * @param {any} [that] Value of `this` the callback will be called with.
17626
17645
  */
17627
17646
  BaseViewer.prototype.on = function(events, priority, callback, that) {
17628
17647
  return this.get('eventBus').on(events, priority, callback, that);
@@ -18324,6 +18343,60 @@
18324
18343
  return isLabel(element) && isLabelExternal(element.labelTarget);
18325
18344
  }
18326
18345
 
18346
+ var TEXT_ANNOTATION_PADDING = 7;
18347
+
18348
+ /**
18349
+ * @typedef { import('../model/Types').Element } Element
18350
+ */
18351
+
18352
+ /**
18353
+ * Get text annotations connected to the given element.
18354
+ *
18355
+ * @param {Element} element
18356
+ *
18357
+ * @return { { annotation: Element, association: Element }[] }
18358
+ */
18359
+ function getElementAnnotations(element) {
18360
+ let result = [];
18361
+
18362
+ forEach(element.incoming, (connection) => {
18363
+ if (is(connection, 'bpmn:Association') && is(connection.source, 'bpmn:TextAnnotation')) {
18364
+ result.push({ annotation: connection.source, association: connection });
18365
+ }
18366
+ });
18367
+
18368
+ forEach(element.outgoing, (connection) => {
18369
+ if (is(connection, 'bpmn:Association') && is(connection.target, 'bpmn:TextAnnotation')) {
18370
+ result.push({ annotation: connection.target, association: connection });
18371
+ }
18372
+ });
18373
+
18374
+ return result;
18375
+ }
18376
+
18377
+ /**
18378
+ * Recursively collect text annotations connected to the given elements and their descendants.
18379
+ * De-duplicates by annotation, collecting all associations per annotation.
18380
+ *
18381
+ * @param {Element[]} elements
18382
+ *
18383
+ * @return { { annotation: Element, associations: Element[] }[] }
18384
+ */
18385
+ function collectElementsAnnotations(elements) {
18386
+ const result = new Map();
18387
+
18388
+ forEach(selfAndChildren(elements, true), (element) => {
18389
+ forEach(getElementAnnotations(element), (entry) => {
18390
+ if (!result.has(entry.annotation)) {
18391
+ result.set(entry.annotation, { annotation: entry.annotation, associations: [] });
18392
+ }
18393
+ result.get(entry.annotation).associations.push(entry.association);
18394
+ });
18395
+ });
18396
+
18397
+ return [ ...result.values() ];
18398
+ }
18399
+
18327
18400
  var black = 'hsl(225, 10%, 15%)';
18328
18401
  var white = 'white';
18329
18402
 
@@ -19561,15 +19634,14 @@
19561
19634
 
19562
19635
  function renderExternalLabel(parentGfx, element, attrs = {}) {
19563
19636
  var box = {
19564
- width: 90,
19565
- height: 30,
19637
+ width: element.width,
19638
+ height: element.height,
19566
19639
  x: element.width / 2 + element.x,
19567
19640
  y: element.height / 2 + element.y
19568
19641
  };
19569
19642
 
19570
19643
  return renderLabel(parentGfx, getLabel(element), {
19571
19644
  box: box,
19572
- fitBox: true,
19573
19645
  style: assign$1(
19574
19646
  {},
19575
19647
  textRenderer.getExternalStyle(),
@@ -19986,7 +20058,7 @@
19986
20058
 
19987
20059
  drawPath(parentGfx, arrowPathData, {
19988
20060
  strokeWidth: 1,
19989
- fill: getFillColor(element, defaultFillColor, attrs.fill),
20061
+ fill: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke),
19990
20062
  stroke: getStrokeColor$1(element, defaultStrokeColor, attrs.stroke)
19991
20063
  });
19992
20064
 
@@ -20653,9 +20725,7 @@
20653
20725
  'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
20654
20726
  attrs = pickAttrs(attrs, [
20655
20727
  'fill',
20656
- 'stroke',
20657
- 'width',
20658
- 'height'
20728
+ 'stroke'
20659
20729
  ]);
20660
20730
 
20661
20731
  var {
@@ -20689,7 +20759,7 @@
20689
20759
  renderLabel(parentGfx, text, {
20690
20760
  align: 'left-top',
20691
20761
  box: getBounds$1(element, attrs),
20692
- padding: 7,
20762
+ padding: TEXT_ANNOTATION_PADDING,
20693
20763
  style: {
20694
20764
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
20695
20765
  }
@@ -21363,7 +21433,7 @@
21363
21433
  var DEFAULT_FONT_SIZE = 12;
21364
21434
  var LINE_HEIGHT_RATIO = 1.2;
21365
21435
 
21366
- var MIN_TEXT_ANNOTATION_HEIGHT = 30;
21436
+ var MIN_TEXT_ANNOTATION_HEIGHT = 40;
21367
21437
 
21368
21438
  /**
21369
21439
  * @typedef { {
@@ -21419,20 +21489,20 @@
21419
21489
  */
21420
21490
  this.getExternalLabelBounds = function(bounds, text) {
21421
21491
 
21422
- var layoutedDimensions = textUtil.getDimensions(text, {
21423
- box: {
21424
- width: 90,
21425
- height: 30
21426
- },
21492
+ var box = {
21493
+ width: Math.max(bounds.width, DEFAULT_LABEL_SIZE$1.width),
21494
+ height: 30
21495
+ };
21496
+
21497
+ var dimensions = getTextboxDimensions(text, box, {
21427
21498
  style: externalStyle
21428
21499
  });
21429
21500
 
21430
- // resize label shape to fit label text
21431
21501
  return {
21432
- x: Math.round(bounds.x + bounds.width / 2 - layoutedDimensions.width / 2),
21433
- y: Math.round(bounds.y),
21434
- width: Math.ceil(layoutedDimensions.width),
21435
- height: Math.ceil(layoutedDimensions.height)
21502
+ x: Math.round(bounds.x + bounds.width / 2 - dimensions.width / 2),
21503
+ y: bounds.y,
21504
+ width: Math.ceil(dimensions.width),
21505
+ height: Math.ceil(dimensions.height)
21436
21506
  };
21437
21507
 
21438
21508
  };
@@ -21447,21 +21517,45 @@
21447
21517
  */
21448
21518
  this.getTextAnnotationBounds = function(bounds, text) {
21449
21519
 
21450
- var layoutedDimensions = textUtil.getDimensions(text, {
21451
- box: bounds,
21520
+ var dimensions = getTextboxDimensions(text, bounds, {
21452
21521
  style: defaultStyle,
21453
21522
  align: 'left-top',
21454
- padding: 5
21523
+ padding: TEXT_ANNOTATION_PADDING
21455
21524
  });
21456
21525
 
21457
21526
  return {
21458
21527
  x: bounds.x,
21459
21528
  y: bounds.y,
21460
21529
  width: bounds.width,
21461
- height: Math.max(MIN_TEXT_ANNOTATION_HEIGHT, Math.round(layoutedDimensions.height))
21530
+ height: Math.max(MIN_TEXT_ANNOTATION_HEIGHT, Math.round(dimensions.height))
21462
21531
  };
21463
21532
  };
21464
21533
 
21534
+ /**
21535
+ * Get the dimensions of a text element.
21536
+ *
21537
+ * @param {string} text
21538
+ * @param {TextLayoutConfig} [options]
21539
+ *
21540
+ * @return {import('diagram-js/lib/util/Types').Dimensions}
21541
+ */
21542
+ this.getDimensions = function(text, options) {
21543
+ return textUtil.getDimensions(text, options || {});
21544
+ };
21545
+
21546
+ /**
21547
+ * Compute dimension of text fitted inside a box.
21548
+ *
21549
+ * @param {string} text
21550
+ * @param {Rect} box
21551
+ * @param {TextLayoutConfig} layoutOptions
21552
+ *
21553
+ * @return {import('diagram-js/lib/util/Types').Dimensions}
21554
+ */
21555
+ function getTextboxDimensions(text, box, layoutOptions) {
21556
+ return textUtil.getDimensions(text, assign$1({ box: box }, layoutOptions));
21557
+ }
21558
+
21465
21559
  /**
21466
21560
  * Create a layouted text element.
21467
21561
  *
@@ -35032,7 +35126,12 @@
35032
35126
 
35033
35127
  // NOTHING TO DO; label already aligned a.O.K.
35034
35128
  if (freeAlignments.indexOf(labelOrientation) !== -1) {
35035
- return;
35129
+
35130
+ if (getOrientation(element.label, element) !== 'intersect') {
35131
+ return;
35132
+ }
35133
+
35134
+ return labelOrientation;
35036
35135
  }
35037
35136
 
35038
35137
  return freeAlignments[0];
@@ -35087,7 +35186,6 @@
35087
35186
  /**
35088
35187
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
35089
35188
  * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
35090
- * @typedef {import('../Modeling').default} Modeling
35091
35189
  * @typedef {import('didi').Injector} Injector
35092
35190
  *
35093
35191
  * @typedef {import('../../../model/Types').Element} Element
@@ -35105,13 +35203,11 @@
35105
35203
  * @param {Injector} injector
35106
35204
  * @param {EventBus} eventBus
35107
35205
  * @param {Canvas} canvas
35108
- * @param {Modeling} modeling
35109
35206
  */
35110
35207
  function ArtifactBehavior(
35111
35208
  injector,
35112
35209
  eventBus,
35113
- canvas,
35114
- modeling
35210
+ canvas
35115
35211
  ) {
35116
35212
  injector.invoke(CommandInterceptor, this);
35117
35213
 
@@ -35123,7 +35219,7 @@
35123
35219
  var enclosedArtifacts = getEnclosedArtifacts(elements);
35124
35220
 
35125
35221
  if (enclosedArtifacts.length) {
35126
- modeling.removeElements(enclosedArtifacts);
35222
+ context.elements = elements.concat(enclosedArtifacts);
35127
35223
  }
35128
35224
  });
35129
35225
 
@@ -35188,8 +35284,7 @@
35188
35284
  ArtifactBehavior.$inject = [
35189
35285
  'injector',
35190
35286
  'eventBus',
35191
- 'canvas',
35192
- 'modeling'
35287
+ 'canvas'
35193
35288
  ];
35194
35289
 
35195
35290
  /**
@@ -38751,28 +38846,56 @@
38751
38846
  });
38752
38847
 
38753
38848
 
38849
+ // snap label height to text content, preserving user-chosen width
38850
+ this.preExecute('shape.resize', function(event) {
38851
+ var context = event.context,
38852
+ shape = context.shape,
38853
+ hints = context.hints || {};
38854
+
38855
+ if (!isLabel(shape) || hints.autoResize) {
38856
+ return;
38857
+ }
38858
+
38859
+ var newBounds = context.newBounds;
38860
+ var dimensions = textRenderer.getDimensions(getLabel(shape) || '', {
38861
+ box: newBounds,
38862
+ style: textRenderer.getExternalStyle()
38863
+ });
38864
+ var height = Math.ceil(dimensions.height);
38865
+
38866
+ // anchor to bottom edge if the top edge was moved, otherwise anchor to top
38867
+ var topEdgeMoved = newBounds.y !== shape.y;
38868
+ var bottom = shape.y + shape.height;
38869
+
38870
+ context.newBounds = {
38871
+ width: newBounds.width,
38872
+ height: height,
38873
+ x: newBounds.x,
38874
+ y: topEdgeMoved ? bottom - height : newBounds.y
38875
+ };
38876
+ });
38877
+
38754
38878
  // move external label after resizing
38755
38879
  this.postExecute('shape.resize', function(event) {
38756
-
38757
38880
  var context = event.context,
38758
38881
  shape = context.shape,
38759
38882
  newBounds = context.newBounds,
38760
38883
  oldBounds = context.oldBounds;
38761
38884
 
38762
- if (hasExternalLabel(shape)) {
38885
+ if (!hasExternalLabel(shape)) {
38886
+ return;
38887
+ }
38763
38888
 
38764
- var label = shape.label,
38765
- labelMid = getMid(label),
38766
- edges = asEdges(oldBounds);
38889
+ var label = shape.label,
38890
+ labelMid = getMid(label),
38891
+ edges = asEdges(oldBounds);
38767
38892
 
38768
- // get nearest border point to label as reference point
38769
- var referencePoint = getReferencePoint$1(labelMid, edges);
38893
+ // get nearest border point to label as reference point
38894
+ var referencePoint = getReferencePoint$1(labelMid, edges);
38770
38895
 
38771
- var delta = getReferencePointDelta(referencePoint, oldBounds, newBounds);
38896
+ var delta = getReferencePointDelta(referencePoint, oldBounds, newBounds);
38772
38897
 
38773
- modeling.moveShape(label, delta);
38774
-
38775
- }
38898
+ modeling.moveShape(label, delta);
38776
38899
 
38777
38900
  });
38778
38901
 
@@ -39839,7 +39962,7 @@
39839
39962
  /**
39840
39963
  * @type {Dimensions}
39841
39964
  */
39842
- var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 50, height: 30 };
39965
+ var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 100, height: 40 };
39843
39966
 
39844
39967
  /**
39845
39968
  * Set minimum bounds/resize constraints on resize.
@@ -40480,58 +40603,6 @@
40480
40603
  }
40481
40604
  }
40482
40605
 
40483
- /**
40484
- * @typedef { import('../model/Types').Element } Element
40485
- */
40486
-
40487
- /**
40488
- * Get text annotations connected to the given element.
40489
- *
40490
- * @param {Element} element
40491
- *
40492
- * @return { { annotation: Element, association: Element }[] }
40493
- */
40494
- function getElementAnnotations(element) {
40495
- let result = [];
40496
-
40497
- forEach(element.incoming, (connection) => {
40498
- if (is(connection, 'bpmn:Association') && is(connection.source, 'bpmn:TextAnnotation')) {
40499
- result.push({ annotation: connection.source, association: connection });
40500
- }
40501
- });
40502
-
40503
- forEach(element.outgoing, (connection) => {
40504
- if (is(connection, 'bpmn:Association') && is(connection.target, 'bpmn:TextAnnotation')) {
40505
- result.push({ annotation: connection.target, association: connection });
40506
- }
40507
- });
40508
-
40509
- return result;
40510
- }
40511
-
40512
- /**
40513
- * Recursively collect text annotations connected to the given elements and their descendants.
40514
- * De-duplicates by annotation, collecting all associations per annotation.
40515
- *
40516
- * @param {Element[]} elements
40517
- *
40518
- * @return { { annotation: Element, associations: Element[] }[] }
40519
- */
40520
- function collectElementsAnnotations(elements) {
40521
- const result = new Map();
40522
-
40523
- forEach(selfAndChildren(elements, true), (element) => {
40524
- forEach(getElementAnnotations(element), (entry) => {
40525
- if (!result.has(entry.annotation)) {
40526
- result.set(entry.annotation, { annotation: entry.annotation, associations: [] });
40527
- }
40528
- result.get(entry.annotation).associations.push(entry.association);
40529
- });
40530
- });
40531
-
40532
- return [ ...result.values() ];
40533
- }
40534
-
40535
40606
  /**
40536
40607
  * @typedef {import('diagram-js/lib/core/Canvas').default} Canvas
40537
40608
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
@@ -41255,9 +41326,10 @@
41255
41326
 
41256
41327
  /**
41257
41328
  * @typedef {import('diagram-js/lib/core/EventBus').default} EventBus
41329
+ * @typedef {import('../../../draw/TextRenderer').default} TextRenderer
41258
41330
  */
41259
41331
 
41260
- function TextAnnotationBehavior(eventBus) {
41332
+ function TextAnnotationBehavior(eventBus, textRenderer) {
41261
41333
 
41262
41334
  CommandInterceptor.call(this, eventBus);
41263
41335
 
@@ -41283,12 +41355,40 @@
41283
41355
  context.hints.autoResize = false;
41284
41356
  }
41285
41357
  }, true);
41358
+
41359
+ // snap annotation height to text content, preserving user-chosen width
41360
+ this.preExecute('shape.resize', function(event) {
41361
+ var context = event.context,
41362
+ shape = context.shape,
41363
+ hints = context.hints || {};
41364
+
41365
+ if (!is(shape, 'bpmn:TextAnnotation') || hints.autoResize) {
41366
+ return;
41367
+ }
41368
+
41369
+ var newBounds = context.newBounds;
41370
+ var resizeBounds = textRenderer.getTextAnnotationBounds(newBounds, getLabel(shape) || '');
41371
+
41372
+ // anchor to bottom edge only when the top edge moved AND the bottom edge stayed
41373
+ // (i.e. a user drag from the top handle), not for programmatic repositioning
41374
+ var topEdgeMoved = newBounds.y !== shape.y &&
41375
+ Math.abs((newBounds.y + newBounds.height) - (shape.y + shape.height)) <= 1;
41376
+ var bottom = shape.y + shape.height;
41377
+
41378
+ context.newBounds = {
41379
+ width: newBounds.width,
41380
+ height: resizeBounds.height,
41381
+ x: newBounds.x,
41382
+ y: topEdgeMoved ? bottom - resizeBounds.height : newBounds.y
41383
+ };
41384
+ });
41286
41385
  }
41287
41386
 
41288
41387
  e$2(TextAnnotationBehavior, CommandInterceptor);
41289
41388
 
41290
41389
  TextAnnotationBehavior.$inject = [
41291
- 'eventBus'
41390
+ 'eventBus',
41391
+ 'textRenderer'
41292
41392
  ];
41293
41393
 
41294
41394
  /**
@@ -41957,6 +42057,7 @@
41957
42057
  * @typedef {import('../../model/Types').Shape} Shape
41958
42058
  * @typedef {import('../../model/Types').ModdleElement} ModdleElement
41959
42059
  *
42060
+ * @typedef {import('diagram-js/lib/util/Types').Direction} Direction
41960
42061
  * @typedef {import('diagram-js/lib/util/Types').Point} Point
41961
42062
  * @typedef {import('diagram-js/lib/util/Types').Rect} Rect
41962
42063
  *
@@ -42041,9 +42142,10 @@
42041
42142
  this.addRule('shape.resize', function(context) {
42042
42143
 
42043
42144
  var shape = context.shape,
42044
- newBounds = context.newBounds;
42145
+ newBounds = context.newBounds,
42146
+ direction = context.direction;
42045
42147
 
42046
- return canResize(shape, newBounds);
42148
+ return canResize(shape, newBounds, direction);
42047
42149
  });
42048
42150
 
42049
42151
  this.addRule('elements.create', function(context) {
@@ -42879,11 +42981,12 @@
42879
42981
 
42880
42982
  /**
42881
42983
  * @param {Shape} shape
42882
- * @param {Rect} newBounds
42984
+ * @param {Rect} [newBounds]
42985
+ * @param {Direction} [direction]
42883
42986
  *
42884
42987
  * @return {boolean}
42885
42988
  */
42886
- function canResize(shape, newBounds) {
42989
+ function canResize(shape, newBounds, direction) {
42887
42990
  if (is(shape, 'bpmn:SubProcess')) {
42888
42991
  return (
42889
42992
  isExpanded(shape) && (
@@ -42901,6 +43004,9 @@
42901
43004
  }
42902
43005
 
42903
43006
  if (isTextAnnotation(shape)) {
43007
+ if (direction) {
43008
+ return direction === 'e' || direction === 'w';
43009
+ }
42904
43010
  return true;
42905
43011
  }
42906
43012
 
@@ -42908,11 +43014,18 @@
42908
43014
  return true;
42909
43015
  }
42910
43016
 
43017
+ if (isLabel(shape)) {
43018
+ if (direction) {
43019
+ return direction === 'e' || direction === 'w';
43020
+ }
43021
+ return true;
43022
+ }
43023
+
42911
43024
  return false;
42912
43025
  }
42913
43026
 
42914
43027
  /**
42915
- * Check whether one of of the elements to be connected is a text annotation.
43028
+ * Check whether one of the elements to be connected is a text annotation.
42916
43029
  *
42917
43030
  * @param {Element} source
42918
43031
  * @param {Element} target
@@ -49327,7 +49440,7 @@
49327
49440
  }
49328
49441
 
49329
49442
  if (is(bo, 'bpmn:TextAnnotation')) {
49330
- return { width: 100, height: 30 };
49443
+ return { width: 100, height: 40 };
49331
49444
  }
49332
49445
 
49333
49446
  if (is(bo, 'bpmn:Group')) {
@@ -61255,12 +61368,14 @@
61255
61368
  ResizeHandles.prototype.addResizer = function(element) {
61256
61369
  var self = this;
61257
61370
 
61258
- if (isConnection(element) || !this._resize.canResize({ shape: element })) {
61371
+ if (isConnection(element)) {
61259
61372
  return;
61260
61373
  }
61261
61374
 
61262
61375
  forEach(directions, function(direction) {
61263
- self.createResizer(element, direction);
61376
+ if (self._resize.canResize({ shape: element, direction: direction })) {
61377
+ self.createResizer(element, direction);
61378
+ }
61264
61379
  });
61265
61380
  };
61266
61381
 
@@ -61529,7 +61644,8 @@
61529
61644
  // external labels
61530
61645
  if (isLabelExternal(element)) {
61531
61646
  assign$1(options, {
61532
- autoResize: true
61647
+ resizable: true,
61648
+ autoResize: true,
61533
61649
  });
61534
61650
 
61535
61651
  // keep background and border for external labels
@@ -61694,24 +61810,23 @@
61694
61810
  });
61695
61811
  }
61696
61812
 
61697
- var width = 90 * zoom,
61698
- paddingTop = 7 * zoom,
61699
- paddingBottom = 4 * zoom;
61813
+ // making sure that editing box is correct
61814
+ var BORDER_WIDTH = 1;
61815
+
61816
+ var width = bbox.width + 2 * BORDER_WIDTH;
61700
61817
 
61701
61818
  // external labels for events, data elements, gateways, groups and connections
61702
61819
  if (target.labelTarget) {
61703
61820
  assign$1(bounds, {
61704
61821
  width: width,
61705
- height: bbox.height + paddingTop + paddingBottom,
61706
- x: mid.x - width / 2,
61707
- y: bbox.y - paddingTop
61822
+ height: bbox.height + 2 * BORDER_WIDTH,
61823
+ x: bbox.x - BORDER_WIDTH,
61824
+ y: bbox.y - BORDER_WIDTH
61708
61825
  });
61709
61826
 
61710
61827
  assign$1(style, {
61711
61828
  fontSize: externalFontSize + 'px',
61712
- lineHeight: externalLineHeight,
61713
- paddingTop: paddingTop + 'px',
61714
- paddingBottom: paddingBottom + 'px'
61829
+ lineHeight: externalLineHeight
61715
61830
  });
61716
61831
  }
61717
61832
 
@@ -61729,38 +61844,39 @@
61729
61844
  height: 0
61730
61845
  });
61731
61846
 
61732
- var height = externalFontSize + paddingTop + paddingBottom;
61847
+ var height = externalFontSize;
61848
+ var newLabelWidth = DEFAULT_LABEL_SIZE$1.width * zoom + 2 * BORDER_WIDTH;
61733
61849
 
61734
61850
  assign$1(bounds, {
61735
- width: width,
61736
- height: height,
61737
- x: absoluteBBox.x - width / 2,
61738
- y: absoluteBBox.y - height / 2
61851
+ width: newLabelWidth,
61852
+ height: height + 2 * BORDER_WIDTH,
61853
+ x: absoluteBBox.x - newLabelWidth / 2,
61854
+ y: absoluteBBox.y - height / 2 - BORDER_WIDTH
61739
61855
  });
61740
61856
 
61741
61857
  assign$1(style, {
61742
61858
  fontSize: externalFontSize + 'px',
61743
- lineHeight: externalLineHeight,
61744
- paddingTop: paddingTop + 'px',
61745
- paddingBottom: paddingBottom + 'px'
61859
+ lineHeight: externalLineHeight
61746
61860
  });
61747
61861
  }
61748
61862
 
61749
61863
  // text annotations
61750
61864
  if (is(element, 'bpmn:TextAnnotation')) {
61751
61865
  assign$1(bounds, {
61752
- width: bbox.width,
61753
- height: bbox.height,
61866
+ width: bbox.width + 2 * BORDER_WIDTH,
61867
+ height: bbox.height + 2 * BORDER_WIDTH,
61868
+ x: bbox.x - BORDER_WIDTH,
61869
+ y: bbox.y - BORDER_WIDTH,
61754
61870
  minWidth: 30 * zoom,
61755
61871
  minHeight: 10 * zoom
61756
61872
  });
61757
61873
 
61758
61874
  assign$1(style, {
61759
61875
  textAlign: 'left',
61760
- paddingTop: (5 * zoom) + 'px',
61761
- paddingBottom: (7 * zoom) + 'px',
61762
- paddingLeft: (7 * zoom) + 'px',
61763
- paddingRight: (5 * zoom) + 'px',
61876
+ paddingTop: (TEXT_ANNOTATION_PADDING * zoom) + 'px',
61877
+ paddingBottom: (TEXT_ANNOTATION_PADDING * zoom) + 'px',
61878
+ paddingLeft: (TEXT_ANNOTATION_PADDING * zoom) + 'px',
61879
+ paddingRight: (TEXT_ANNOTATION_PADDING * zoom) + 'px',
61764
61880
  fontSize: defaultFontSize + 'px',
61765
61881
  lineHeight: defaultLineHeight
61766
61882
  });