bpmn-js 18.31.0 → 18.31.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.
@@ -181,12 +181,21 @@ BpmnCreateMoveSnapping.prototype.addSnapTargetPoints = function(snapPoints, shap
181
181
  * @return {Shape[]}
182
182
  */
183
183
  BpmnCreateMoveSnapping.prototype.getSnapTargets = function(shape, target) {
184
- return CreateMoveSnapping.prototype.getSnapTargets.call(this, shape, target)
185
- .filter(function(snapTarget) {
184
+ var snapTargets = CreateMoveSnapping.prototype.getSnapTargets.call(this, shape, target);
186
185
 
187
- // do not snap to lanes
188
- return !is(snapTarget, 'bpmn:Lane');
189
- });
186
+ if (shape.labelTarget && shape.labelTarget.parent && shape.labelTarget.parent !== target) {
187
+
188
+ // labels stay at root, so include their target's peers
189
+ snapTargets = snapTargets.concat(
190
+ CreateMoveSnapping.prototype.getSnapTargets.call(this, shape, shape.labelTarget.parent)
191
+ );
192
+ }
193
+
194
+ return snapTargets.filter(function(snapTarget, index) {
195
+
196
+ // do not snap to lanes
197
+ return !is(snapTarget, 'bpmn:Lane') && snapTargets.indexOf(snapTarget) === index;
198
+ });
190
199
  };
191
200
 
192
201
  // helpers //////////
@@ -269,7 +269,18 @@ BpmnImporter.prototype.addLabel = function(semantic, di, element) {
269
269
 
270
270
  text = getLabel(element);
271
271
 
272
- if (text) {
272
+ if (text && di.label && di.label.bounds && bounds.width > 0) {
273
+
274
+ // keep the persisted width, it may have been set by the user
275
+ var dimensions = this._textRenderer.getDimensions(text, {
276
+ box: bounds,
277
+ style: this._textRenderer.getExternalStyle()
278
+ });
279
+
280
+ bounds = assign({}, bounds, {
281
+ height: Math.ceil(dimensions.height)
282
+ });
283
+ } else if (text) {
273
284
 
274
285
  // get corrected bounds from actual layouted text
275
286
  bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
@@ -153,7 +153,7 @@ export function getExternalLabelBounds(di, element) {
153
153
  bounds = label.bounds;
154
154
 
155
155
  size = {
156
- width: Math.max(DEFAULT_LABEL_SIZE.width, bounds.width),
156
+ width: bounds.width,
157
157
  height: bounds.height
158
158
  };
159
159
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bpmn-js",
3
- "version": "18.31.0",
3
+ "version": "18.31.1",
4
4
  "description": "A bpmn 2.0 toolkit and web modeler",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -82,8 +82,8 @@
82
82
  "chai-match": "^1.1.1",
83
83
  "cpy": "^13.2.3",
84
84
  "cross-env": "^10.1.0",
85
- "del": "^8.0.0",
86
- "del-cli": "^7.0.0",
85
+ "del": "^9.0.0",
86
+ "del-cli": "^8.0.0",
87
87
  "eslint": "^9.39.5",
88
88
  "eslint-plugin-bpmn-io": "^2.4.0",
89
89
  "execa": "^10.0.1",