bpmn-js 9.3.2 → 9.4.0

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 (42) hide show
  1. package/CHANGELOG.md +18 -2
  2. package/dist/bpmn-modeler.development.js +3416 -3170
  3. package/dist/bpmn-modeler.production.min.js +8 -8
  4. package/dist/bpmn-navigated-viewer.development.js +350 -279
  5. package/dist/bpmn-navigated-viewer.production.min.js +6 -6
  6. package/dist/bpmn-viewer.development.js +316 -265
  7. package/dist/bpmn-viewer.production.min.js +6 -6
  8. package/lib/draw/BpmnRenderUtil.js +25 -25
  9. package/lib/draw/BpmnRenderer.js +4 -4
  10. package/lib/draw/PathMap.js +42 -42
  11. package/lib/features/align-elements/index.js +1 -1
  12. package/lib/features/copy-paste/BpmnCopyPaste.js +75 -69
  13. package/lib/features/copy-paste/ModdleCopy.js +26 -13
  14. package/lib/features/drilldown/DrilldownOverlayBehavior.js +2 -2
  15. package/lib/features/drilldown/SubprocessCompatibility.js +1 -1
  16. package/lib/features/drilldown/index.js +1 -1
  17. package/lib/features/grid-snapping/behavior/{AutoPlaceBehavior.js → GridSnappingAutoPlaceBehavior.js} +2 -2
  18. package/lib/features/grid-snapping/behavior/{LayoutConnectionBehavior.js → GridSnappingLayoutConnectionBehavior.js} +4 -4
  19. package/lib/features/grid-snapping/behavior/{CreateParticipantBehavior.js → GridSnappingParticipantBehavior.js} +2 -2
  20. package/lib/features/grid-snapping/behavior/index.js +7 -7
  21. package/lib/features/keyboard/BpmnKeyboardBindings.js +7 -7
  22. package/lib/features/label-editing/LabelEditingProvider.js +1 -23
  23. package/lib/features/modeling/ElementFactory.js +18 -8
  24. package/lib/features/modeling/behavior/BoundaryEventBehavior.js +1 -16
  25. package/lib/features/modeling/behavior/DropOnFlowBehavior.js +1 -1
  26. package/lib/features/modeling/behavior/GroupBehavior.js +205 -93
  27. package/lib/features/modeling/behavior/ResizeBehavior.js +2 -0
  28. package/lib/features/modeling/behavior/RootElementReferenceBehavior.js +7 -8
  29. package/lib/features/modeling/behavior/SpaceToolBehavior.js +5 -0
  30. package/lib/features/modeling/behavior/SubProcessPlaneBehavior.js +9 -0
  31. package/lib/features/modeling/behavior/index.js +1 -1
  32. package/lib/features/modeling/behavior/util/CategoryUtil.js +66 -13
  33. package/lib/features/modeling/behavior/util/LayoutUtil.js +6 -6
  34. package/lib/features/modeling/cmd/UpdateModdlePropertiesHandler.js +4 -1
  35. package/lib/features/ordering/BpmnOrderingProvider.js +3 -1
  36. package/lib/features/replace/BpmnReplace.js +12 -0
  37. package/lib/features/search/index.js +1 -1
  38. package/lib/import/BpmnImporter.js +0 -5
  39. package/lib/util/CompatibilityUtil.js +1 -0
  40. package/package.json +21 -24
  41. package/test/helper/index.js +1 -1
  42. package/.babelrc +0 -3
@@ -2,21 +2,21 @@ import inherits from 'inherits-browser';
2
2
 
3
3
  import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
4
4
 
5
- import {
6
- add as collectionAdd,
7
- remove as collectionRemove
8
- } from 'diagram-js/lib/util/Collections';
9
-
10
5
  import {
11
6
  getBusinessObject,
12
7
  is
13
8
  } from '../../../util/ModelUtil';
14
9
 
15
10
  import {
16
- createCategoryValue
11
+ createCategory,
12
+ createCategoryValue,
13
+ linkCategoryValue,
14
+ unlinkCategory,
15
+ unlinkCategoryValue
17
16
  } from './util/CategoryUtil';
18
17
 
19
- var HIGH_PRIORITY = 2000;
18
+
19
+ var LOWER_PRIORITY = 770;
20
20
 
21
21
 
22
22
  /**
@@ -33,156 +33,268 @@ export default function GroupBehavior(
33
33
  injector.invoke(CommandInterceptor, this);
34
34
 
35
35
  /**
36
- * Removes a referenced category value for a given group shape
36
+ * Returns all group element in the current registry
37
37
  *
38
- * @param {djs.model.Shape} shape
38
+ * @return {Array<djs.model.shape>} a list of group shapes
39
39
  */
40
- function removeReferencedCategoryValue(shape) {
41
-
42
- var businessObject = getBusinessObject(shape),
43
- categoryValue = businessObject.categoryValueRef;
44
-
45
- if (!categoryValue) {
46
- return;
47
- }
48
-
49
- var category = categoryValue.$parent;
50
-
51
- if (!categoryValue) {
52
- return;
53
- }
54
-
55
- collectionRemove(category.categoryValue, categoryValue);
56
-
57
- // cleanup category if it is empty
58
- if (category && !category.categoryValue.length) {
59
- removeCategory(category);
60
- }
40
+ function getGroupElements() {
41
+ return elementRegistry.filter(function(e) {
42
+ return is(e, 'bpmn:Group');
43
+ });
61
44
  }
62
45
 
63
46
  /**
64
- * Removes a given category from the definitions
47
+ * Returns true if given category is referenced in one of the given elements
65
48
  *
66
- * @param {ModdleElement} category
49
+ * @param { djs.model.Element[] } elements
50
+ * @param { ModdleElement } category
51
+ *
52
+ * @return { boolean }
67
53
  */
68
- function removeCategory(category) {
54
+ function isReferencedCategory(elements, category) {
55
+ return elements.some(function(element) {
56
+ var businessObject = getBusinessObject(element);
69
57
 
70
- var definitions = bpmnjs.getDefinitions();
58
+ var _category = businessObject.categoryValueRef && businessObject.categoryValueRef.$parent;
71
59
 
72
- collectionRemove(definitions.get('rootElements'), category);
60
+ return _category === category;
61
+ });
73
62
  }
74
63
 
75
64
  /**
76
- * Returns all group element in the current registry
65
+ * Returns true if given categoryValue is referenced in one of the given elements
77
66
  *
78
- * @return {Array<djs.model.shape>} a list of group shapes
67
+ * @param { djs.model.Element[] } elements
68
+ * @param { ModdleElement } categoryValue
69
+ *
70
+ * @return { boolean }
79
71
  */
80
- function getGroupElements() {
81
- return elementRegistry.filter(function(e) {
82
- return is(e, 'bpmn:Group');
72
+ function isReferencedCategoryValue(elements, categoryValue) {
73
+ return elements.some(function(element) {
74
+ var businessObject = getBusinessObject(element);
75
+
76
+ return businessObject.categoryValueRef === categoryValue;
83
77
  });
84
78
  }
85
79
 
86
80
  /**
87
- * Returns true if given categoryValue is referenced in one of the given elements
81
+ * Remove category value unless it is still referenced
88
82
  *
89
- * @param {Array<djs.model.shape>} elements
90
83
  * @param {ModdleElement} categoryValue
91
- * @return {boolean}
84
+ * @param {ModdleElement} category
85
+ * @param {ModdleElement} businessObject
92
86
  */
93
- function isReferenced(elements, categoryValue) {
94
- return elements.some(function(e) {
95
-
96
- var businessObject = getBusinessObject(e);
87
+ function removeCategoryValue(categoryValue, category, businessObject) {
97
88
 
98
- return businessObject.categoryValueRef
99
- && businessObject.categoryValueRef === categoryValue;
89
+ var groups = getGroupElements().filter(function(element) {
90
+ return element.businessObject !== businessObject;
100
91
  });
92
+
93
+ if (category && !isReferencedCategory(groups, category)) {
94
+ unlinkCategory(category);
95
+ }
96
+
97
+ if (categoryValue && !isReferencedCategoryValue(groups, categoryValue)) {
98
+ unlinkCategoryValue(categoryValue);
99
+ }
101
100
  }
102
101
 
103
102
  /**
104
- * remove referenced category + value when group was deleted
103
+ * Add category value
104
+ *
105
+ * @param {ModdleElement} categoryValue
106
+ * @param {ModdleElement} category
105
107
  */
106
- this.executed('shape.delete', function(event) {
108
+ function addCategoryValue(categoryValue, category) {
109
+ return linkCategoryValue(categoryValue, category, bpmnjs.getDefinitions());
110
+ }
107
111
 
108
- var context = event.context,
109
- shape = context.shape;
112
+ function setCategoryValue(element, context) {
113
+ var businessObject = getBusinessObject(element),
114
+ categoryValue = businessObject.categoryValueRef;
110
115
 
111
- if (is(shape, 'bpmn:Group')) {
116
+ if (!categoryValue) {
117
+ categoryValue =
118
+ businessObject.categoryValueRef =
119
+ context.categoryValue = (
120
+ context.categoryValue || createCategoryValue(bpmnFactory)
121
+ );
122
+ }
112
123
 
113
- var businessObject = getBusinessObject(shape),
114
- categoryValueRef = businessObject.categoryValueRef,
115
- groupElements = getGroupElements();
124
+ var category = categoryValue.$parent;
116
125
 
117
- if (!isReferenced(groupElements, categoryValueRef)) {
118
- removeReferencedCategoryValue(shape);
119
- }
126
+ if (!category) {
127
+ category =
128
+ categoryValue.$parent =
129
+ context.category = (
130
+ context.category || createCategory(bpmnFactory)
131
+ );
120
132
  }
121
- });
122
133
 
123
- /**
124
- * re-attach removed category
125
- */
126
- this.reverted('shape.delete', function(event) {
134
+ addCategoryValue(categoryValue, category, bpmnjs.getDefinitions());
135
+ }
136
+
137
+ function unsetCategoryValue(element, context) {
138
+ var category = context.category,
139
+ categoryValue = context.categoryValue,
140
+ businessObject = getBusinessObject(element);
141
+
142
+ if (categoryValue) {
143
+ businessObject.categoryValueRef = null;
144
+
145
+ removeCategoryValue(categoryValue, category, businessObject);
146
+ } else {
147
+ removeCategoryValue(null, businessObject.categoryValueRef.$parent, businessObject);
148
+ }
149
+ }
150
+
127
151
 
152
+ // ensure category + value exist before label editing
153
+
154
+ this.execute('label.create', function(event) {
128
155
  var context = event.context,
129
- shape = context.shape;
156
+ labelTarget = context.labelTarget;
157
+
158
+ if (!is(labelTarget, 'bpmn:Group')) {
159
+ return;
160
+ }
130
161
 
131
- if (is(shape, 'bpmn:Group')) {
162
+ setCategoryValue(labelTarget, context);
163
+ });
132
164
 
133
- var businessObject = getBusinessObject(shape),
134
- categoryValueRef = businessObject.categoryValueRef,
135
- definitions = bpmnjs.getDefinitions(),
136
- category = categoryValueRef ? categoryValueRef.$parent : null;
165
+ this.revert('label.create', function(event) {
166
+ var context = event.context,
167
+ labelTarget = context.labelTarget;
137
168
 
138
- collectionAdd(category.get('categoryValue'), categoryValueRef);
139
- collectionAdd(definitions.get('rootElements'), category);
169
+ if (!is(labelTarget, 'bpmn:Group')) {
170
+ return;
140
171
  }
172
+
173
+ unsetCategoryValue(labelTarget, context);
141
174
  });
142
175
 
143
- /**
144
- * create new category + value when group was created
145
- */
146
- this.execute('shape.create', function(event) {
176
+
177
+ // remove referenced category + value when group was deleted
178
+
179
+ this.execute('shape.delete', function(event) {
180
+
147
181
  var context = event.context,
148
182
  shape = context.shape,
149
183
  businessObject = getBusinessObject(shape);
150
184
 
151
- if (is(businessObject, 'bpmn:Group') && !businessObject.categoryValueRef) {
185
+ if (!is(shape, 'bpmn:Group') || shape.labelTarget) {
186
+ return;
187
+ }
188
+
189
+ var categoryValue = context.categoryValue = businessObject.categoryValueRef,
190
+ category;
191
+
192
+ if (categoryValue) {
193
+ category = context.category = categoryValue.$parent;
194
+
195
+ removeCategoryValue(categoryValue, category, businessObject);
196
+
197
+ businessObject.categoryValueRef = null;
198
+ }
199
+ });
200
+
201
+ this.reverted('shape.delete', function(event) {
202
+
203
+ var context = event.context,
204
+ shape = context.shape;
152
205
 
153
- var definitions = bpmnjs.getDefinitions(),
154
- categoryValue = createCategoryValue(definitions, bpmnFactory);
206
+ if (!is(shape, 'bpmn:Group') || shape.labelTarget) {
207
+ return;
208
+ }
209
+
210
+ var category = context.category,
211
+ categoryValue = context.categoryValue,
212
+ businessObject = getBusinessObject(shape);
155
213
 
156
- // link the reference to the Group
214
+ if (categoryValue) {
157
215
  businessObject.categoryValueRef = categoryValue;
216
+
217
+ addCategoryValue(categoryValue, category);
158
218
  }
159
219
  });
160
220
 
161
221
 
162
- this.revert('shape.create', function(event) {
222
+ // create new category + value when group was created
223
+
224
+ this.execute('shape.create', function(event) {
225
+ var context = event.context,
226
+ shape = context.shape;
227
+
228
+ if (!is(shape, 'bpmn:Group') || shape.labelTarget) {
229
+ return;
230
+ }
231
+
232
+ if (getBusinessObject(shape).categoryValueRef) {
233
+ setCategoryValue(shape, context);
234
+ }
235
+ });
236
+
237
+ this.reverted('shape.create', function(event) {
163
238
 
164
239
  var context = event.context,
165
240
  shape = context.shape;
166
241
 
167
- if (is(shape, 'bpmn:Group')) {
168
- removeReferencedCategoryValue(shape);
242
+ if (!is(shape, 'bpmn:Group') || shape.labelTarget) {
243
+ return;
244
+ }
245
+
246
+ if (getBusinessObject(shape).categoryValueRef) {
247
+ unsetCategoryValue(shape, context);
248
+ }
249
+ });
250
+
251
+
252
+ // copy + paste categoryValueRef with group
253
+
254
+ function copy(bo, clone) {
255
+ var targetBo = bpmnFactory.create(bo.$type);
256
+
257
+ return moddleCopy.copyElement(bo, targetBo, null, clone);
258
+ }
259
+
260
+ eventBus.on('copyPaste.copyElement', LOWER_PRIORITY, function(context) {
261
+ var descriptor = context.descriptor,
262
+ element = context.element;
263
+
264
+ if (!is(element, 'bpmn:Group') || element.labelTarget) {
265
+ return;
266
+ }
267
+
268
+ var groupBo = getBusinessObject(element);
269
+
270
+ if (groupBo.categoryValueRef) {
169
271
 
170
- delete getBusinessObject(shape).categoryValueRef;
272
+ var categoryValue = groupBo.categoryValueRef;
171
273
 
274
+ descriptor.categoryValue = copy(categoryValue, true);
275
+
276
+ if (categoryValue.$parent) {
277
+ descriptor.category = copy(categoryValue.$parent, true);
278
+ }
172
279
  }
173
280
  });
174
281
 
175
- // copy bpmn:CategoryValue when copying element
176
- eventBus.on('moddleCopy.canCopyProperty', HIGH_PRIORITY, function(context) {
177
- var property = context.property,
178
- categoryValue;
282
+ eventBus.on('copyPaste.pasteElement', LOWER_PRIORITY, function(context) {
283
+ var descriptor = context.descriptor,
284
+ businessObject = descriptor.businessObject,
285
+ categoryValue = descriptor.categoryValue,
286
+ category = descriptor.category;
179
287
 
180
- if (is(property, 'bpmn:CategoryValue')) {
181
- categoryValue = createCategoryValue(bpmnjs.getDefinitions(), bpmnFactory);
288
+ if (categoryValue) {
289
+ categoryValue = businessObject.categoryValueRef = copy(categoryValue);
290
+ }
182
291
 
183
- // return copy of category
184
- return moddleCopy.copyElement(property, categoryValue);
292
+ if (category) {
293
+ categoryValue.$parent = copy(category);
185
294
  }
295
+
296
+ delete descriptor.category;
297
+ delete descriptor.categoryValue;
186
298
  });
187
299
 
188
300
  }
@@ -13,6 +13,8 @@ import {
13
13
 
14
14
  var HIGH_PRIORITY = 1500;
15
15
 
16
+ export var GROUP_MIN_DIMENSIONS = { width: 140, height: 120 };
17
+
16
18
  export var LANE_MIN_DIMENSIONS = { width: 300, height: 60 };
17
19
 
18
20
  export var PARTICIPANT_MIN_DIMENSIONS = { width: 300, height: 150 };
@@ -125,7 +125,7 @@ export default function RootElementReferenceBehavior(
125
125
  var descriptor = context.descriptor,
126
126
  element = context.element;
127
127
 
128
- if (!canHaveRootElementReference(element)) {
128
+ if (element.labelTarget || !canHaveRootElementReference(element)) {
129
129
  return;
130
130
  }
131
131
 
@@ -133,19 +133,16 @@ export default function RootElementReferenceBehavior(
133
133
  rootElement = getRootElement(businessObject);
134
134
 
135
135
  if (rootElement) {
136
+
137
+ // TODO(nikku): clone on copy
136
138
  descriptor.referencedRootElement = rootElement;
137
139
  }
138
140
  });
139
141
 
140
142
  eventBus.on('copyPaste.pasteElement', LOW_PRIORITY, function(context) {
141
143
  var descriptor = context.descriptor,
142
- businessObject = descriptor.businessObject;
143
-
144
- if (!canHaveRootElementReference(businessObject)) {
145
- return;
146
- }
147
-
148
- var referencedRootElement = descriptor.referencedRootElement;
144
+ businessObject = descriptor.businessObject,
145
+ referencedRootElement = descriptor.referencedRootElement;
149
146
 
150
147
  if (!referencedRootElement) {
151
148
  return;
@@ -159,6 +156,8 @@ export default function RootElementReferenceBehavior(
159
156
  }
160
157
 
161
158
  setRootElement(businessObject, referencedRootElement);
159
+
160
+ delete descriptor.referencedRootElement;
162
161
  });
163
162
  }
164
163
 
@@ -5,6 +5,7 @@ import { is } from '../../../util/ModelUtil';
5
5
  import { isExpanded } from '../../../util/DiUtil';
6
6
 
7
7
  import {
8
+ GROUP_MIN_DIMENSIONS,
8
9
  LANE_MIN_DIMENSIONS,
9
10
  PARTICIPANT_MIN_DIMENSIONS,
10
11
  SUB_PROCESS_MIN_DIMENSIONS,
@@ -46,6 +47,10 @@ export default function SpaceToolBehavior(eventBus) {
46
47
  if (is(shape, 'bpmn:TextAnnotation')) {
47
48
  minDimensions[ id ] = TEXT_ANNOTATION_MIN_DIMENSIONS;
48
49
  }
50
+
51
+ if (is(shape, 'bpmn:Group')) {
52
+ minDimensions[ id ] = GROUP_MIN_DIMENSIONS;
53
+ }
49
54
  });
50
55
 
51
56
  return minDimensions;
@@ -411,6 +411,15 @@ SubProcessPlaneBehavior.prototype._moveChildrenToShape = function(source, target
411
411
  return;
412
412
  }
413
413
 
414
+ // add external labels that weren't children of sub process
415
+ children = children.concat(children.reduce(function(labels, child) {
416
+ if (child.label && child.label.parent !== source) {
417
+ return labels.concat(child.label);
418
+ }
419
+
420
+ return labels;
421
+ }, []));
422
+
414
423
  // only change plane if there are no visible children, but don't move them
415
424
  var visibleChildren = children.filter(function(child) {
416
425
  return !child.hidden;
@@ -101,7 +101,7 @@ export default {
101
101
  messageFlowBehavior: [ 'type', MessageFlowBehavior ],
102
102
  modelingFeedback: [ 'type', ModelingFeedback ],
103
103
  removeElementBehavior: [ 'type', RemoveElementBehavior ],
104
- removeEmbeddedLabelBoundsBehavior: ['type', RemoveEmbeddedLabelBoundsBehavior ],
104
+ removeEmbeddedLabelBoundsBehavior: [ 'type', RemoveEmbeddedLabelBoundsBehavior ],
105
105
  removeParticipantBehavior: [ 'type', RemoveParticipantBehavior ],
106
106
  replaceConnectionBehavior: [ 'type', ReplaceConnectionBehavior ],
107
107
  replaceElementBehaviour: [ 'type', ReplaceElementBehaviour ],
@@ -1,30 +1,83 @@
1
1
  import {
2
- add as collectionAdd
2
+ add as collectionAdd,
3
+ remove as collectionRemove
3
4
  } from 'diagram-js/lib/util/Collections';
4
5
 
5
- import {
6
- getBusinessObject
7
- } from '../../../../util/ModelUtil';
8
6
 
9
7
  /**
10
8
  * Creates a new bpmn:CategoryValue inside a new bpmn:Category
11
9
  *
12
- * @param {ModdleElement} definitions
13
10
  * @param {BpmnFactory} bpmnFactory
14
11
  *
15
12
  * @return {ModdleElement} categoryValue.
16
13
  */
17
- export function createCategoryValue(definitions, bpmnFactory) {
18
- var categoryValue = bpmnFactory.create('bpmn:CategoryValue'),
19
- category = bpmnFactory.create('bpmn:Category', {
20
- categoryValue: [ categoryValue ]
21
- });
14
+ export function createCategory(bpmnFactory) {
15
+ return bpmnFactory.create('bpmn:Category');
16
+ }
17
+
18
+ /**
19
+ * Creates a new bpmn:CategoryValue inside a new bpmn:Category
20
+ *
21
+ * @param {BpmnFactory} bpmnFactory
22
+ *
23
+ * @return {ModdleElement} categoryValue.
24
+ */
25
+ export function createCategoryValue(bpmnFactory) {
26
+ return bpmnFactory.create('bpmn:CategoryValue');
27
+ }
28
+
29
+ /**
30
+ * Adds category value to definitions
31
+ *
32
+ * @param {ModdleElement} categoryValue
33
+ * @param {ModdleElement} category
34
+ * @param {ModdleElement} definitions
35
+ *
36
+ * @return {ModdleElement} categoryValue
37
+ */
38
+ export function linkCategoryValue(categoryValue, category, definitions) {
39
+ collectionAdd(category.get('categoryValue'), categoryValue);
40
+ categoryValue.$parent = category;
22
41
 
23
- // add to correct place
24
42
  collectionAdd(definitions.get('rootElements'), category);
25
- getBusinessObject(category).$parent = definitions;
26
- getBusinessObject(categoryValue).$parent = category;
43
+ category.$parent = definitions;
27
44
 
28
45
  return categoryValue;
46
+ }
47
+
48
+ /**
49
+ * Unlink category value from parent
50
+ *
51
+ * @param {ModdleElement} categoryValue
52
+ *
53
+ * @return {ModdleElement} categoryValue
54
+ */
55
+ export function unlinkCategoryValue(categoryValue) {
56
+ var category = categoryValue.$parent;
57
+
58
+ if (category) {
59
+ collectionRemove(category.get('categoryValue'), categoryValue);
60
+ categoryValue.$parent = null;
61
+ }
62
+
63
+ return categoryValue;
64
+ }
65
+
66
+ /**
67
+ * Unlink category from parent
68
+ *
69
+ * @param {ModdleElement} category
70
+ * @param {ModdleElement} definitions
71
+ *
72
+ * @return {ModdleElement} categoryValue
73
+ */
74
+ export function unlinkCategory(category) {
75
+ var definitions = category.$parent;
76
+
77
+ if (definitions) {
78
+ collectionRemove(definitions.get('rootElements'), category);
79
+ category.$parent = null;
80
+ }
29
81
 
82
+ return category;
30
83
  }
@@ -32,7 +32,7 @@ export function findNewLineStartIndex(oldWaypoints, newWaypoints, attachment, hi
32
32
 
33
33
  // point is after new segment index
34
34
  if (index >= newSegmentStartIndex) {
35
- return (index+offset < newSegmentStartIndex) ? newSegmentStartIndex : index+offset;
35
+ return (index + offset < newSegmentStartIndex) ? newSegmentStartIndex : index + offset;
36
36
  }
37
37
 
38
38
  // if point is before new segment index
@@ -62,7 +62,7 @@ export function findNewLineStartIndex(oldWaypoints, newWaypoints, attachment, hi
62
62
  newIndex = index;
63
63
 
64
64
  // decide point should take right or left segment
65
- if (insert && attachment.type !== 'bendpoint' && bendpointIndex-1 === index) {
65
+ if (insert && attachment.type !== 'bendpoint' && bendpointIndex - 1 === index) {
66
66
 
67
67
  var rel = relativePositionMidWaypoint(newWaypoints, bendpointIndex);
68
68
 
@@ -89,7 +89,7 @@ export function findNewLineStartIndex(oldWaypoints, newWaypoints, attachment, hi
89
89
  }
90
90
 
91
91
  // if nothing fits, take the middle segment
92
- return Math.floor((newWaypoints.length - 2)/2);
92
+ return Math.floor((newWaypoints.length - 2) / 2);
93
93
  }
94
94
 
95
95
 
@@ -203,8 +203,8 @@ export function getAnchorPointAdjustment(position, newWaypoints, oldWaypoints, h
203
203
 
204
204
  function relativePositionMidWaypoint(waypoints, idx) {
205
205
 
206
- var distanceSegment1 = getDistancePointPoint(waypoints[idx-1], waypoints[idx]),
207
- distanceSegment2 = getDistancePointPoint(waypoints[idx], waypoints[idx+1]);
206
+ var distanceSegment1 = getDistancePointPoint(waypoints[idx - 1], waypoints[idx]),
207
+ distanceSegment2 = getDistancePointPoint(waypoints[idx], waypoints[idx + 1]);
208
208
 
209
209
  var relativePosition = distanceSegment1 / (distanceSegment1 + distanceSegment2);
210
210
 
@@ -218,7 +218,7 @@ function getAngleDelta(l1, l2) {
218
218
  }
219
219
 
220
220
  function getLine(waypoints, idx) {
221
- return [ waypoints[idx], waypoints[idx+1] ];
221
+ return [ waypoints[idx], waypoints[idx + 1] ];
222
222
  }
223
223
 
224
224
  function getRelativeFootPosition(line, foot) {
@@ -13,7 +13,7 @@ export default function UpdateModdlePropertiesHandler(elementRegistry) {
13
13
  this._elementRegistry = elementRegistry;
14
14
  }
15
15
 
16
- UpdateModdlePropertiesHandler.$inject = ['elementRegistry'];
16
+ UpdateModdlePropertiesHandler.$inject = [ 'elementRegistry' ];
17
17
 
18
18
  UpdateModdlePropertiesHandler.prototype.execute = function(context) {
19
19
 
@@ -25,6 +25,9 @@ UpdateModdlePropertiesHandler.prototype.execute = function(context) {
25
25
  throw new Error('<moddleElement> required');
26
26
  }
27
27
 
28
+ // TODO(nikku): we need to ensure that ID properties
29
+ // are properly registered / unregistered via
30
+ // this._moddle.ids.assigned(id)
28
31
  var changed = context.changed || this.getVisualReferences(moddleElement).concat(element);
29
32
  var oldProperties = context.oldProperties || getModdleProperties(moddleElement, keys(properties));
30
33
 
@@ -24,10 +24,12 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
24
24
 
25
25
  var orders = [
26
26
  { type: 'bpmn:SubProcess', order: { level: 6 } },
27
+
28
+ // handle SequenceFlow(s) like message flows and render them always on top
27
29
  {
28
30
  type: 'bpmn:SequenceFlow',
29
31
  order: {
30
- level: 3,
32
+ level: 9,
31
33
  containers: [
32
34
  'bpmn:Participant',
33
35
  'bpmn:FlowElementsContainer'
@@ -199,6 +199,18 @@ export default function BpmnReplace(
199
199
  // else if property is explicitly set, use it
200
200
  else if (target && has(target, 'isExpanded')) {
201
201
  newElement.isExpanded = target.isExpanded;
202
+
203
+ // assign default size of new expanded element
204
+ var defaultSize = elementFactory.getDefaultSize(newBusinessObject, {
205
+ isExpanded: newElement.isExpanded
206
+ });
207
+
208
+ newElement.width = defaultSize.width;
209
+ newElement.height = defaultSize.height;
210
+
211
+ // keep element centered
212
+ newElement.x = element.x - (newElement.width - element.width) / 2;
213
+ newElement.y = element.y - (newElement.height - element.height) / 2;
202
214
  }
203
215
 
204
216
  // TODO: need also to respect min/max Size