bpmn-js 8.8.0 → 9.0.0-subprocesses.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 (53) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/assets/bpmn-js.css +58 -0
  3. package/dist/assets/diagram-js.css +1 -0
  4. package/dist/bpmn-modeler.development.js +1489 -827
  5. package/dist/bpmn-modeler.production.min.js +7 -6
  6. package/dist/bpmn-navigated-viewer.development.js +20890 -19973
  7. package/dist/bpmn-navigated-viewer.production.min.js +22 -20
  8. package/dist/bpmn-viewer.development.js +20091 -19174
  9. package/dist/bpmn-viewer.production.min.js +22 -20
  10. package/lib/BaseViewer.js +0 -13
  11. package/lib/Viewer.js +3 -1
  12. package/lib/draw/BpmnRenderUtil.js +6 -4
  13. package/lib/draw/BpmnRenderer.js +367 -296
  14. package/lib/features/context-pad/ContextPadProvider.js +1 -1
  15. package/lib/features/copy-paste/BpmnCopyPaste.js +13 -13
  16. package/lib/features/copy-paste/ModdleCopy.js +19 -2
  17. package/lib/features/di-ordering/BpmnDiOrdering.js +2 -3
  18. package/lib/features/label-editing/LabelEditingPreview.js +3 -3
  19. package/lib/features/label-editing/cmd/UpdateLabelHandler.js +2 -1
  20. package/lib/features/modeling/BpmnFactory.js +8 -8
  21. package/lib/features/modeling/BpmnUpdater.js +35 -27
  22. package/lib/features/modeling/ElementFactory.js +60 -37
  23. package/lib/features/modeling/behavior/DataStoreBehavior.js +3 -1
  24. package/lib/features/modeling/behavior/IsHorizontalFix.js +7 -4
  25. package/lib/features/modeling/behavior/LabelBehavior.js +8 -7
  26. package/lib/features/modeling/behavior/ResizeBehavior.js +129 -3
  27. package/lib/features/modeling/behavior/ToggleElementCollapseBehaviour.js +6 -6
  28. package/lib/features/modeling/behavior/util/ResizeUtil.js +1 -132
  29. package/lib/features/modeling/cmd/UpdateCanvasRootHandler.js +8 -6
  30. package/lib/features/modeling/cmd/UpdatePropertiesHandler.js +19 -12
  31. package/lib/features/modeling/cmd/UpdateSemanticParentHandler.js +5 -3
  32. package/lib/features/palette/PaletteProvider.js +3 -1
  33. package/lib/features/popup-menu/ReplaceMenuProvider.js +5 -5
  34. package/lib/features/popup-menu/util/TypeUtil.js +1 -1
  35. package/lib/features/replace/BpmnReplace.js +29 -29
  36. package/lib/features/subprocess-navigation/SubprocessCentering.js +55 -0
  37. package/lib/features/subprocess-navigation/SubprocessCompatibility.js +135 -0
  38. package/lib/features/subprocess-navigation/SubprocessElements.js +55 -0
  39. package/lib/features/subprocess-navigation/SubprocessFlows.js +109 -0
  40. package/lib/features/subprocess-navigation/SubprocessOverlays.js +104 -0
  41. package/lib/features/subprocess-navigation/index.js +18 -0
  42. package/lib/import/BpmnImporter.js +76 -22
  43. package/lib/import/BpmnTreeWalker.js +19 -17
  44. package/lib/import/Importer.js +17 -6
  45. package/lib/util/CompatibilityUtil.js +21 -1
  46. package/lib/util/DiUtil.js +10 -3
  47. package/lib/util/LabelUtil.js +2 -3
  48. package/lib/util/ModelUtil.js +11 -0
  49. package/package.json +2 -2
  50. package/test/helper/index.js +6 -1
  51. package/test/matchers/BoundsMatchers.js +10 -10
  52. package/test/matchers/ConnectionMatchers.js +5 -5
  53. package/test/util/MockEvents.js +10 -2
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v8.8.0
2
+ * bpmn-js - bpmn-modeler v9.0.0-subprocesses.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: 2021-10-13
11
+ * Date: 2021-10-26
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -2337,13 +2337,14 @@
2337
2337
  eventBus.on([ 'render.shape', 'render.connection' ], renderPriority, function(evt, context) {
2338
2338
  var type = evt.type,
2339
2339
  element = context.element,
2340
- visuals = context.gfx;
2340
+ visuals = context.gfx,
2341
+ attrs = context.attrs;
2341
2342
 
2342
2343
  if (self.canRender(element)) {
2343
2344
  if (type === 'render.shape') {
2344
- return self.drawShape(visuals, element);
2345
+ return self.drawShape(visuals, element, attrs);
2345
2346
  } else {
2346
- return self.drawConnection(visuals, element);
2347
+ return self.drawConnection(visuals, element, attrs);
2347
2348
  }
2348
2349
  }
2349
2350
  });
@@ -2803,7 +2804,7 @@
2803
2804
  return true;
2804
2805
  };
2805
2806
 
2806
- DefaultRenderer.prototype.drawShape = function drawShape(visuals, element) {
2807
+ DefaultRenderer.prototype.drawShape = function drawShape(visuals, element, attrs) {
2807
2808
  var rect = create$1('rect');
2808
2809
 
2809
2810
  attr(rect, {
@@ -2814,9 +2815,9 @@
2814
2815
  });
2815
2816
 
2816
2817
  if (isFrameElement$1(element)) {
2817
- attr(rect, this.FRAME_STYLE);
2818
+ attr(rect, assign({}, this.FRAME_STYLE, attrs || {}));
2818
2819
  } else {
2819
- attr(rect, this.SHAPE_STYLE);
2820
+ attr(rect, assign({}, this.SHAPE_STYLE, attrs || {}));
2820
2821
  }
2821
2822
 
2822
2823
  append(visuals, rect);
@@ -2824,9 +2825,9 @@
2824
2825
  return rect;
2825
2826
  };
2826
2827
 
2827
- DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection) {
2828
+ DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection, attrs) {
2828
2829
 
2829
- var line = createLine(connection.waypoints, this.CONNECTION_STYLE);
2830
+ var line = createLine(connection.waypoints, assign({}, this.CONNECTION_STYLE, attrs || {}));
2830
2831
  append(visuals, line);
2831
2832
 
2832
2833
  return line;
@@ -14940,10 +14941,74 @@
14940
14941
  return '<' + e.$type + (e.id ? ' id="' + e.id : '') + '" />';
14941
14942
  }
14942
14943
 
14943
- var diRefs = new Refs(
14944
- { name: 'bpmnElement', enumerable: true },
14945
- { name: 'di', configurable: true }
14946
- );
14944
+ // TODO(nikku): remove with future bpmn-js version
14945
+
14946
+ /**
14947
+ * Wraps APIs to check:
14948
+ *
14949
+ * 1) If a callback is passed -> Warn users about callback deprecation.
14950
+ * 2) If Promise class is implemented in current environment.
14951
+ *
14952
+ * @private
14953
+ */
14954
+ function wrapForCompatibility(api) {
14955
+
14956
+ return function() {
14957
+
14958
+ if (!window.Promise) {
14959
+ throw new Error('Promises is not supported in this environment. Please polyfill Promise.');
14960
+ }
14961
+
14962
+ var argLen = arguments.length;
14963
+ if (argLen >= 1 && isFunction(arguments[argLen - 1])) {
14964
+
14965
+ var callback = arguments[argLen - 1];
14966
+
14967
+ console.warn(new Error(
14968
+ 'Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' +
14969
+ 'Please switch to promises: https://bpmn.io/l/moving-to-promises.html'
14970
+ ));
14971
+
14972
+ var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1);
14973
+
14974
+ api.apply(this, argsWithoutCallback).then(function(result) {
14975
+
14976
+ var firstKey = Object.keys(result)[0];
14977
+
14978
+ // The APIs we are wrapping all resolve a single item depending on the API.
14979
+ // For instance, importXML resolves { warnings } and saveXML returns { xml }.
14980
+ // That's why we can call the callback with the first item of result.
14981
+ return callback(null, result[firstKey]);
14982
+
14983
+ // Passing a second paramter instead of catch because we don't want to
14984
+ // catch errors thrown by callback().
14985
+ }, function(err) {
14986
+
14987
+ return callback(err, err.warnings);
14988
+ });
14989
+ } else {
14990
+
14991
+ return api.apply(this, arguments);
14992
+ }
14993
+ };
14994
+ }
14995
+
14996
+
14997
+ // TODO(nikku): remove with future bpmn-js version
14998
+
14999
+ var DI_ERROR_MESSAGE = 'Tried to access di from the businessObject. The di is available through the diagram element only. For more information, see https://github.com/bpmn-io/bpmn-js/issues/1472';
15000
+
15001
+ function ensureCompatDiRef(businessObject) {
15002
+
15003
+ // bpmnElement can have multiple independent DIs
15004
+ if (!has(businessObject, 'di')) {
15005
+ Object.defineProperty(businessObject, 'di', {
15006
+ get: function() {
15007
+ throw new Error(DI_ERROR_MESSAGE);
15008
+ }
15009
+ });
15010
+ }
15011
+ }
14947
15012
 
14948
15013
  /**
14949
15014
  * Returns true if an element has the given meta-model type
@@ -14978,6 +15043,8 @@
14978
15043
  // prerequisites are drawn
14979
15044
  var deferred = [];
14980
15045
 
15046
+ var diMap = {};
15047
+
14981
15048
  // Helpers //////////////////////
14982
15049
 
14983
15050
  function contextual(fn, ctx) {
@@ -15006,17 +15073,17 @@
15006
15073
  }
15007
15074
 
15008
15075
  // call handler
15009
- return handler.element(element, ctx);
15076
+ return handler.element(element, diMap[element.id], ctx);
15010
15077
  }
15011
15078
 
15012
15079
  function visitRoot(element, diagram) {
15013
- return handler.root(element, diagram);
15080
+ return handler.root(element, diMap[element.id], diagram);
15014
15081
  }
15015
15082
 
15016
15083
  function visitIfDi(element, ctx) {
15017
15084
 
15018
15085
  try {
15019
- var gfx = element.di && visit(element, ctx);
15086
+ var gfx = diMap[element.id] && visit(element, ctx);
15020
15087
 
15021
15088
  handled(element);
15022
15089
 
@@ -15039,7 +15106,7 @@
15039
15106
  var bpmnElement = di.bpmnElement;
15040
15107
 
15041
15108
  if (bpmnElement) {
15042
- if (bpmnElement.di) {
15109
+ if (diMap[bpmnElement.id]) {
15043
15110
  logError(
15044
15111
  translate('multiple DI elements defined for {element}', {
15045
15112
  element: elementToString(bpmnElement)
@@ -15047,8 +15114,9 @@
15047
15114
  { element: bpmnElement }
15048
15115
  );
15049
15116
  } else {
15050
- diRefs.bind(bpmnElement, 'di');
15051
- bpmnElement.di = di;
15117
+ diMap[bpmnElement.id] = di;
15118
+
15119
+ ensureCompatDiRef(bpmnElement);
15052
15120
  }
15053
15121
  } else {
15054
15122
  logError(
@@ -15105,6 +15173,7 @@
15105
15173
  }
15106
15174
 
15107
15175
  // load DI from selected diagram only
15176
+ diMap = {};
15108
15177
  handleDiagram(diagram);
15109
15178
 
15110
15179
 
@@ -15144,10 +15213,10 @@
15144
15213
 
15145
15214
  var ctx = visitRoot(rootElement, plane);
15146
15215
 
15147
- if (is$2(rootElement, 'bpmn:Process')) {
15216
+ if (is$2(rootElement, 'bpmn:Process') || is$2(rootElement, 'bpmn:SubProcess')) {
15148
15217
  handleProcess(rootElement, ctx);
15149
15218
  } else if (is$2(rootElement, 'bpmn:Collaboration')) {
15150
- handleCollaboration(rootElement);
15219
+ handleCollaboration(rootElement, ctx);
15151
15220
 
15152
15221
  // force drawing of everything not yet drawn that is part of the target DI
15153
15222
  handleUnhandledProcesses(definitions.rootElements, ctx);
@@ -15354,15 +15423,15 @@
15354
15423
  }
15355
15424
  }
15356
15425
 
15357
- function handleCollaboration(collaboration) {
15426
+ function handleCollaboration(collaboration, context) {
15358
15427
 
15359
- forEach(collaboration.participants, contextual(handleParticipant));
15428
+ forEach(collaboration.participants, contextual(handleParticipant, context));
15360
15429
 
15361
- handleArtifacts(collaboration.artifacts);
15430
+ handleArtifacts(collaboration.artifacts, context);
15362
15431
 
15363
15432
  // handle message flows latest in the process
15364
15433
  deferred.push(function() {
15365
- handleMessageFlows(collaboration.messageFlows);
15434
+ handleMessageFlows(collaboration.messageFlows, context);
15366
15435
  });
15367
15436
  }
15368
15437
 
@@ -15421,7 +15490,8 @@
15421
15490
 
15422
15491
  var importer,
15423
15492
  eventBus,
15424
- translate;
15493
+ translate,
15494
+ canvas;
15425
15495
 
15426
15496
  var error,
15427
15497
  warnings = [];
@@ -15437,12 +15507,12 @@
15437
15507
 
15438
15508
  var visitor = {
15439
15509
 
15440
- root: function(element) {
15441
- return importer.add(element);
15510
+ root: function(element, di) {
15511
+ return importer.add(element, di);
15442
15512
  },
15443
15513
 
15444
- element: function(element, parentShape) {
15445
- return importer.add(element, parentShape);
15514
+ element: function(element, di, parentShape) {
15515
+ return importer.add(element, di, parentShape);
15446
15516
  },
15447
15517
 
15448
15518
  error: function(message, context) {
@@ -15454,7 +15524,16 @@
15454
15524
 
15455
15525
  // traverse BPMN 2.0 document model,
15456
15526
  // starting at definitions
15457
- walker.handleDefinitions(definitions, bpmnDiagram);
15527
+ if (!bpmnDiagram && definitions.diagrams) {
15528
+ for (var i = 0; i < definitions.diagrams.length; i++) {
15529
+ walker.handleDefinitions(definitions, definitions.diagrams[i]);
15530
+ }
15531
+ } else {
15532
+ walker.handleDefinitions(definitions, bpmnDiagram);
15533
+ }
15534
+
15535
+ var mainDiagram = bpmnDiagram || definitions.diagrams[0];
15536
+ canvas.setActivePlane(mainDiagram.plane.bpmnElement.id);
15458
15537
  }
15459
15538
 
15460
15539
  return new Promise(function(resolve, reject) {
@@ -15462,6 +15541,7 @@
15462
15541
  importer = diagram.get('bpmnImporter');
15463
15542
  eventBus = diagram.get('eventBus');
15464
15543
  translate = diagram.get('translate');
15544
+ canvas = diagram.get('canvas');
15465
15545
 
15466
15546
  eventBus.fire('import.render.start', { definitions: definitions });
15467
15547
 
@@ -15481,58 +15561,6 @@
15481
15561
  });
15482
15562
  }
15483
15563
 
15484
- // TODO(nikku): remove with future bpmn-js version
15485
-
15486
- /**
15487
- * Wraps APIs to check:
15488
- *
15489
- * 1) If a callback is passed -> Warn users about callback deprecation.
15490
- * 2) If Promise class is implemented in current environment.
15491
- *
15492
- * @private
15493
- */
15494
- function wrapForCompatibility(api) {
15495
-
15496
- return function() {
15497
-
15498
- if (!window.Promise) {
15499
- throw new Error('Promises is not supported in this environment. Please polyfill Promise.');
15500
- }
15501
-
15502
- var argLen = arguments.length;
15503
- if (argLen >= 1 && isFunction(arguments[argLen - 1])) {
15504
-
15505
- var callback = arguments[argLen - 1];
15506
-
15507
- console.warn(new Error(
15508
- 'Passing callbacks to ' + api.name + ' is deprecated and will be removed in a future major release. ' +
15509
- 'Please switch to promises: https://bpmn.io/l/moving-to-promises.html'
15510
- ));
15511
-
15512
- var argsWithoutCallback = Array.prototype.slice.call(arguments, 0, -1);
15513
-
15514
- api.apply(this, argsWithoutCallback).then(function(result) {
15515
-
15516
- var firstKey = Object.keys(result)[0];
15517
-
15518
- // The APIs we are wrapping all resolve a single item depending on the API.
15519
- // For instance, importXML resolves { warnings } and saveXML returns { xml }.
15520
- // That's why we can call the callback with the first item of result.
15521
- return callback(null, result[firstKey]);
15522
-
15523
- // Passing a second paramter instead of catch because we don't want to
15524
- // catch errors thrown by callback().
15525
- }, function(err) {
15526
-
15527
- return callback(err, err.warnings);
15528
- });
15529
- } else {
15530
-
15531
- return api.apply(this, arguments);
15532
- }
15533
- };
15534
- }
15535
-
15536
15564
  /**
15537
15565
  * This file must not be changed or exchanged.
15538
15566
  *
@@ -16112,19 +16140,6 @@
16112
16140
  return;
16113
16141
  }
16114
16142
 
16115
- // remove businessObject#di binding
16116
- //
16117
- // this is necessary, as we establish the bindings
16118
- // in the BpmnTreeWalker (and assume none are given
16119
- // on reimport)
16120
- this.get('elementRegistry').forEach(function(element) {
16121
- var bo = element.businessObject;
16122
-
16123
- if (bo && bo.di) {
16124
- delete bo.di;
16125
- }
16126
- });
16127
-
16128
16143
  // remove drawn elements
16129
16144
  Diagram.prototype.clear.call(this);
16130
16145
  };
@@ -16453,14 +16468,31 @@
16453
16468
  return (element && element.businessObject) || element;
16454
16469
  }
16455
16470
 
16456
- function isExpanded(element) {
16471
+ /**
16472
+ * Return the di object for a given element.
16473
+ *
16474
+ * @param {djs.model.Base} element
16475
+ *
16476
+ * @return {ModdleElement}
16477
+ */
16478
+ function getDi(element) {
16479
+ return element && element.di;
16480
+ }
16481
+
16482
+ function isExpanded(element, di) {
16457
16483
 
16458
16484
  if (is$1(element, 'bpmn:CallActivity')) {
16459
16485
  return false;
16460
16486
  }
16461
16487
 
16462
16488
  if (is$1(element, 'bpmn:SubProcess')) {
16463
- return getBusinessObject(element).di && !!getBusinessObject(element).di.isExpanded;
16489
+ di = di || getDi(element);
16490
+
16491
+ if (di && is$1(di, 'bpmndi:BPMNPlane')) {
16492
+ return true;
16493
+ }
16494
+
16495
+ return di && !!di.isExpanded;
16464
16496
  }
16465
16497
 
16466
16498
  if (is$1(element, 'bpmn:Participant')) {
@@ -16605,10 +16637,6 @@
16605
16637
  return element.isCollection || (dataObject && dataObject.isCollection);
16606
16638
  }
16607
16639
 
16608
- function getDi(element) {
16609
- return element.businessObject.di;
16610
- }
16611
-
16612
16640
  function getSemantic(element) {
16613
16641
  return element.businessObject;
16614
16642
  }
@@ -17041,8 +17069,8 @@
17041
17069
  }
17042
17070
 
17043
17071
  function as(type) {
17044
- return function(parentGfx, element) {
17045
- return handlers[type](parentGfx, element);
17072
+ return function(parentGfx, element, attrs) {
17073
+ return handlers[type](parentGfx, element, attrs);
17046
17074
  };
17047
17075
  }
17048
17076
 
@@ -17050,58 +17078,58 @@
17050
17078
  return handlers[type];
17051
17079
  }
17052
17080
 
17053
- function renderEventContent(element, parentGfx) {
17081
+ function renderEventContent(element, parentGfx, attrs) {
17054
17082
 
17055
17083
  var event = getSemantic(element);
17056
17084
  var isThrowing = isThrowEvent(event);
17057
17085
 
17058
17086
  if (event.eventDefinitions && event.eventDefinitions.length>1) {
17059
17087
  if (event.parallelMultiple) {
17060
- return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element, isThrowing);
17088
+ return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element, attrs, isThrowing);
17061
17089
  }
17062
17090
  else {
17063
- return renderer('bpmn:MultipleEventDefinition')(parentGfx, element, isThrowing);
17091
+ return renderer('bpmn:MultipleEventDefinition')(parentGfx, element, attrs, isThrowing);
17064
17092
  }
17065
17093
  }
17066
17094
 
17067
17095
  if (isTypedEvent(event, 'bpmn:MessageEventDefinition')) {
17068
- return renderer('bpmn:MessageEventDefinition')(parentGfx, element, isThrowing);
17096
+ return renderer('bpmn:MessageEventDefinition')(parentGfx, element, attrs, isThrowing);
17069
17097
  }
17070
17098
 
17071
17099
  if (isTypedEvent(event, 'bpmn:TimerEventDefinition')) {
17072
- return renderer('bpmn:TimerEventDefinition')(parentGfx, element, isThrowing);
17100
+ return renderer('bpmn:TimerEventDefinition')(parentGfx, element, attrs, isThrowing);
17073
17101
  }
17074
17102
 
17075
17103
  if (isTypedEvent(event, 'bpmn:ConditionalEventDefinition')) {
17076
- return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element);
17104
+ return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element, attrs);
17077
17105
  }
17078
17106
 
17079
17107
  if (isTypedEvent(event, 'bpmn:SignalEventDefinition')) {
17080
- return renderer('bpmn:SignalEventDefinition')(parentGfx, element, isThrowing);
17108
+ return renderer('bpmn:SignalEventDefinition')(parentGfx, element, attrs, isThrowing);
17081
17109
  }
17082
17110
 
17083
17111
  if (isTypedEvent(event, 'bpmn:EscalationEventDefinition')) {
17084
- return renderer('bpmn:EscalationEventDefinition')(parentGfx, element, isThrowing);
17112
+ return renderer('bpmn:EscalationEventDefinition')(parentGfx, element, attrs, isThrowing);
17085
17113
  }
17086
17114
 
17087
17115
  if (isTypedEvent(event, 'bpmn:LinkEventDefinition')) {
17088
- return renderer('bpmn:LinkEventDefinition')(parentGfx, element, isThrowing);
17116
+ return renderer('bpmn:LinkEventDefinition')(parentGfx, element, attrs, isThrowing);
17089
17117
  }
17090
17118
 
17091
17119
  if (isTypedEvent(event, 'bpmn:ErrorEventDefinition')) {
17092
- return renderer('bpmn:ErrorEventDefinition')(parentGfx, element, isThrowing);
17120
+ return renderer('bpmn:ErrorEventDefinition')(parentGfx, element, attrs, isThrowing);
17093
17121
  }
17094
17122
 
17095
17123
  if (isTypedEvent(event, 'bpmn:CancelEventDefinition')) {
17096
- return renderer('bpmn:CancelEventDefinition')(parentGfx, element, isThrowing);
17124
+ return renderer('bpmn:CancelEventDefinition')(parentGfx, element, attrs, isThrowing);
17097
17125
  }
17098
17126
 
17099
17127
  if (isTypedEvent(event, 'bpmn:CompensateEventDefinition')) {
17100
- return renderer('bpmn:CompensateEventDefinition')(parentGfx, element, isThrowing);
17128
+ return renderer('bpmn:CompensateEventDefinition')(parentGfx, element, attrs, isThrowing);
17101
17129
  }
17102
17130
 
17103
17131
  if (isTypedEvent(event, 'bpmn:TerminateEventDefinition')) {
17104
- return renderer('bpmn:TerminateEventDefinition')(parentGfx, element, isThrowing);
17132
+ return renderer('bpmn:TerminateEventDefinition')(parentGfx, element, attrs, isThrowing);
17105
17133
  }
17106
17134
 
17107
17135
  return null;
@@ -17124,20 +17152,20 @@
17124
17152
  return text;
17125
17153
  }
17126
17154
 
17127
- function renderEmbeddedLabel(parentGfx, element, align) {
17155
+ function renderEmbeddedLabel(parentGfx, element, align, attrs) {
17128
17156
  var semantic = getSemantic(element);
17129
17157
 
17130
17158
  return renderLabel(parentGfx, semantic.name, {
17131
17159
  box: element,
17132
17160
  align: align,
17133
17161
  padding: 5,
17134
- style: {
17162
+ style: assign({
17135
17163
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
17136
- }
17164
+ }, attrs)
17137
17165
  });
17138
17166
  }
17139
17167
 
17140
- function renderExternalLabel(parentGfx, element) {
17168
+ function renderExternalLabel(parentGfx, element, attrs) {
17141
17169
 
17142
17170
  var box = {
17143
17171
  width: 90,
@@ -17154,21 +17182,22 @@
17154
17182
  textRenderer.getExternalStyle(),
17155
17183
  {
17156
17184
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
17157
- }
17185
+ },
17186
+ attrs
17158
17187
  )
17159
17188
  });
17160
17189
  }
17161
17190
 
17162
- function renderLaneLabel(parentGfx, text, element) {
17191
+ function renderLaneLabel(parentGfx, text, element, attrs) {
17163
17192
  var textBox = renderLabel(parentGfx, text, {
17164
17193
  box: {
17165
17194
  height: 30,
17166
17195
  width: element.height
17167
17196
  },
17168
17197
  align: 'center-middle',
17169
- style: {
17198
+ style: assign({
17170
17199
  fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
17171
- }
17200
+ }, attrs)
17172
17201
  });
17173
17202
 
17174
17203
  var top = -1 * element.height;
@@ -17195,11 +17224,11 @@
17195
17224
 
17196
17225
  return drawCircle(parentGfx, element.width, element.height, attrs);
17197
17226
  },
17198
- 'bpmn:StartEvent': function(parentGfx, element) {
17199
- var attrs = {
17227
+ 'bpmn:StartEvent': function(parentGfx, element, attrs) {
17228
+ attrs = assign({
17200
17229
  fill: getFillColor(element, defaultFillColor),
17201
17230
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17202
- };
17231
+ }, attrs);
17203
17232
 
17204
17233
  var semantic = getSemantic(element);
17205
17234
 
@@ -17218,7 +17247,7 @@
17218
17247
 
17219
17248
  return circle;
17220
17249
  },
17221
- 'bpmn:MessageEventDefinition': function(parentGfx, element, isThrowing) {
17250
+ 'bpmn:MessageEventDefinition': function(parentGfx, element, attrs, isThrowing) {
17222
17251
  var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
17223
17252
  xScaleFactor: 0.9,
17224
17253
  yScaleFactor: 0.9,
@@ -17233,20 +17262,24 @@
17233
17262
  var fill = isThrowing ? getStrokeColor$1(element, defaultStrokeColor) : getFillColor(element, defaultFillColor);
17234
17263
  var stroke = isThrowing ? getFillColor(element, defaultFillColor) : getStrokeColor$1(element, defaultStrokeColor);
17235
17264
 
17236
- var messagePath = drawPath(parentGfx, pathData, {
17265
+ attrs = assign({
17237
17266
  strokeWidth: 1,
17238
17267
  fill: fill,
17239
17268
  stroke: stroke
17240
- });
17269
+ }, attrs);
17270
+
17271
+ var messagePath = drawPath(parentGfx, pathData, attrs);
17241
17272
 
17242
17273
  return messagePath;
17243
17274
  },
17244
- 'bpmn:TimerEventDefinition': function(parentGfx, element) {
17245
- var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
17275
+ 'bpmn:TimerEventDefinition': function(parentGfx, element, attrs) {
17276
+ var outerAttrs = assign({
17246
17277
  strokeWidth: 2,
17247
17278
  fill: getFillColor(element, defaultFillColor),
17248
17279
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17249
- });
17280
+ }, attrs);
17281
+
17282
+ var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, outerAttrs);
17250
17283
 
17251
17284
  var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
17252
17285
  xScaleFactor: 0.75,
@@ -17259,11 +17292,13 @@
17259
17292
  }
17260
17293
  });
17261
17294
 
17262
- drawPath(parentGfx, pathData, {
17295
+ var innerAttrs = assign({
17263
17296
  strokeWidth: 2,
17264
17297
  strokeLinecap: 'square',
17265
17298
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17266
- });
17299
+ }, attrs);
17300
+
17301
+ drawPath(parentGfx, pathData, innerAttrs);
17267
17302
 
17268
17303
  for (var i = 0;i < 12; i++) {
17269
17304
 
@@ -17281,17 +17316,25 @@
17281
17316
  var width = element.width / 2;
17282
17317
  var height = element.height / 2;
17283
17318
 
17284
- drawPath(parentGfx, linePathData, {
17319
+ var lineAttrs = assign({
17285
17320
  strokeWidth: 1,
17286
17321
  strokeLinecap: 'square',
17287
17322
  transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
17288
17323
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17289
- });
17324
+ }, attrs);
17325
+
17326
+ drawPath(parentGfx, linePathData, lineAttrs);
17290
17327
  }
17291
17328
 
17292
17329
  return circle;
17293
17330
  },
17294
- 'bpmn:EscalationEventDefinition': function(parentGfx, event, isThrowing) {
17331
+ 'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs, isThrowing) {
17332
+ attrs = assign({
17333
+ strokeWidth: 1,
17334
+ fill: fill,
17335
+ stroke: getStrokeColor$1(event, defaultStrokeColor)
17336
+ }, attrs);
17337
+
17295
17338
  var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
17296
17339
  xScaleFactor: 1,
17297
17340
  yScaleFactor: 1,
@@ -17305,13 +17348,14 @@
17305
17348
 
17306
17349
  var fill = isThrowing ? getStrokeColor$1(event, defaultStrokeColor) : 'none';
17307
17350
 
17308
- return drawPath(parentGfx, pathData, {
17351
+ return drawPath(parentGfx, pathData, attrs);
17352
+ },
17353
+ 'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs) {
17354
+ attrs = assign({
17309
17355
  strokeWidth: 1,
17310
- fill: fill,
17311
17356
  stroke: getStrokeColor$1(event, defaultStrokeColor)
17312
- });
17313
- },
17314
- 'bpmn:ConditionalEventDefinition': function(parentGfx, event) {
17357
+ }, attrs);
17358
+
17315
17359
  var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
17316
17360
  xScaleFactor: 1,
17317
17361
  yScaleFactor: 1,
@@ -17323,12 +17367,9 @@
17323
17367
  }
17324
17368
  });
17325
17369
 
17326
- return drawPath(parentGfx, pathData, {
17327
- strokeWidth: 1,
17328
- stroke: getStrokeColor$1(event, defaultStrokeColor)
17329
- });
17370
+ return drawPath(parentGfx, pathData, attrs);
17330
17371
  },
17331
- 'bpmn:LinkEventDefinition': function(parentGfx, event, isThrowing) {
17372
+ 'bpmn:LinkEventDefinition': function(parentGfx, event, attrs, isThrowing) {
17332
17373
  var pathData = pathMap.getScaledPath('EVENT_LINK', {
17333
17374
  xScaleFactor: 1,
17334
17375
  yScaleFactor: 1,
@@ -17342,13 +17383,15 @@
17342
17383
 
17343
17384
  var fill = isThrowing ? getStrokeColor$1(event, defaultStrokeColor) : 'none';
17344
17385
 
17345
- return drawPath(parentGfx, pathData, {
17386
+ attrs = assign({
17346
17387
  strokeWidth: 1,
17347
17388
  fill: fill,
17348
17389
  stroke: getStrokeColor$1(event, defaultStrokeColor)
17349
- });
17390
+ }, attrs);
17391
+
17392
+ return drawPath(parentGfx, pathData, attrs);
17350
17393
  },
17351
- 'bpmn:ErrorEventDefinition': function(parentGfx, event, isThrowing) {
17394
+ 'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs, isThrowing) {
17352
17395
  var pathData = pathMap.getScaledPath('EVENT_ERROR', {
17353
17396
  xScaleFactor: 1.1,
17354
17397
  yScaleFactor: 1.1,
@@ -17362,13 +17405,15 @@
17362
17405
 
17363
17406
  var fill = isThrowing ? getStrokeColor$1(event, defaultStrokeColor) : 'none';
17364
17407
 
17365
- return drawPath(parentGfx, pathData, {
17408
+ attrs = assign({
17366
17409
  strokeWidth: 1,
17367
17410
  fill: fill,
17368
17411
  stroke: getStrokeColor$1(event, defaultStrokeColor)
17369
- });
17412
+ }, attrs);
17413
+
17414
+ return drawPath(parentGfx, pathData, attrs);
17370
17415
  },
17371
- 'bpmn:CancelEventDefinition': function(parentGfx, event, isThrowing) {
17416
+ 'bpmn:CancelEventDefinition': function(parentGfx, event, attrs, isThrowing) {
17372
17417
  var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
17373
17418
  xScaleFactor: 1.0,
17374
17419
  yScaleFactor: 1.0,
@@ -17382,17 +17427,19 @@
17382
17427
 
17383
17428
  var fill = isThrowing ? getStrokeColor$1(event, defaultStrokeColor) : 'none';
17384
17429
 
17385
- var path = drawPath(parentGfx, pathData, {
17430
+ attrs = assign({
17386
17431
  strokeWidth: 1,
17387
17432
  fill: fill,
17388
17433
  stroke: getStrokeColor$1(event, defaultStrokeColor)
17389
- });
17434
+ }, attrs);
17435
+
17436
+ var path = drawPath(parentGfx, pathData, attrs);
17390
17437
 
17391
17438
  rotate(path, 45);
17392
17439
 
17393
17440
  return path;
17394
17441
  },
17395
- 'bpmn:CompensateEventDefinition': function(parentGfx, event, isThrowing) {
17442
+ 'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs, isThrowing) {
17396
17443
  var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
17397
17444
  xScaleFactor: 1,
17398
17445
  yScaleFactor: 1,
@@ -17406,13 +17453,15 @@
17406
17453
 
17407
17454
  var fill = isThrowing ? getStrokeColor$1(event, defaultStrokeColor) : 'none';
17408
17455
 
17409
- return drawPath(parentGfx, pathData, {
17456
+ attrs = assign({
17410
17457
  strokeWidth: 1,
17411
17458
  fill: fill,
17412
17459
  stroke: getStrokeColor$1(event, defaultStrokeColor)
17413
- });
17460
+ }, attrs);
17461
+
17462
+ return drawPath(parentGfx, pathData, attrs);
17414
17463
  },
17415
- 'bpmn:SignalEventDefinition': function(parentGfx, event, isThrowing) {
17464
+ 'bpmn:SignalEventDefinition': function(parentGfx, event, attrs, isThrowing) {
17416
17465
  var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
17417
17466
  xScaleFactor: 0.9,
17418
17467
  yScaleFactor: 0.9,
@@ -17426,13 +17475,15 @@
17426
17475
 
17427
17476
  var fill = isThrowing ? getStrokeColor$1(event, defaultStrokeColor) : 'none';
17428
17477
 
17429
- return drawPath(parentGfx, pathData, {
17478
+ attrs = assign({
17430
17479
  strokeWidth: 1,
17431
17480
  fill: fill,
17432
17481
  stroke: getStrokeColor$1(event, defaultStrokeColor)
17433
- });
17482
+ }, attrs);
17483
+
17484
+ return drawPath(parentGfx, pathData, attrs);
17434
17485
  },
17435
- 'bpmn:MultipleEventDefinition': function(parentGfx, event, isThrowing) {
17486
+ 'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs, isThrowing) {
17436
17487
  var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
17437
17488
  xScaleFactor: 1.1,
17438
17489
  yScaleFactor: 1.1,
@@ -17446,12 +17497,14 @@
17446
17497
 
17447
17498
  var fill = isThrowing ? getStrokeColor$1(event, defaultStrokeColor) : 'none';
17448
17499
 
17449
- return drawPath(parentGfx, pathData, {
17500
+ attrs = assign({
17450
17501
  strokeWidth: 1,
17451
17502
  fill: fill
17452
- });
17503
+ }, attrs);
17504
+
17505
+ return drawPath(parentGfx, pathData, attrs);
17453
17506
  },
17454
- 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event) {
17507
+ 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs) {
17455
17508
  var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
17456
17509
  xScaleFactor: 1.2,
17457
17510
  yScaleFactor: 1.2,
@@ -17463,47 +17516,54 @@
17463
17516
  }
17464
17517
  });
17465
17518
 
17466
- return drawPath(parentGfx, pathData, {
17519
+ attrs = assign({
17467
17520
  strokeWidth: 1,
17468
17521
  fill: getStrokeColor$1(event, defaultStrokeColor),
17469
17522
  stroke: getStrokeColor$1(event, defaultStrokeColor)
17470
- });
17523
+ }, attrs);
17524
+
17525
+
17526
+ return drawPath(parentGfx, pathData, attrs);
17471
17527
  },
17472
- 'bpmn:EndEvent': function(parentGfx, element) {
17473
- var circle = renderer('bpmn:Event')(parentGfx, element, {
17528
+ 'bpmn:EndEvent': function(parentGfx, element, attrs) {
17529
+ var outerAttrs = assign({
17474
17530
  strokeWidth: 4,
17475
17531
  fill: getFillColor(element, defaultFillColor),
17476
- stroke: getStrokeColor$1(element, defaultStrokeColor)
17477
- });
17532
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
17533
+ }, attrs);
17478
17534
 
17479
- renderEventContent(element, parentGfx);
17535
+ var circle = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
17536
+
17537
+ renderEventContent(element, parentGfx, attrs);
17480
17538
 
17481
17539
  return circle;
17482
17540
  },
17483
- 'bpmn:TerminateEventDefinition': function(parentGfx, element) {
17484
- var circle = drawCircle(parentGfx, element.width, element.height, 8, {
17485
- strokeWidth: 4,
17486
- fill: getStrokeColor$1(element, defaultStrokeColor),
17487
- stroke: getStrokeColor$1(element, defaultStrokeColor)
17488
- });
17541
+ 'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs) {
17542
+ attrs = assign({
17543
+ fill: getFillColor(element, defaultFillColor),
17544
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
17545
+ strokeWidth: 4
17546
+ }, attrs);
17547
+
17548
+ var circle = drawCircle(parentGfx, element.width, element.height, 8, attrs);
17489
17549
 
17490
17550
  return circle;
17491
17551
  },
17492
- 'bpmn:IntermediateEvent': function(parentGfx, element) {
17493
- var outer = renderer('bpmn:Event')(parentGfx, element, {
17552
+ 'bpmn:IntermediateEvent': function(parentGfx, element, attrs) {
17553
+ var outerAttrs = assign({
17494
17554
  strokeWidth: 1,
17495
17555
  fill: getFillColor(element, defaultFillColor),
17496
17556
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17497
- });
17557
+ }, attrs);
17558
+
17559
+ var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
17498
17560
 
17499
17561
  /* inner */
17500
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
17501
- strokeWidth: 1,
17562
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, assign({}, outerAttrs, {
17502
17563
  fill: getFillColor(element, 'none'),
17503
- stroke: getStrokeColor$1(element, defaultStrokeColor)
17504
- });
17564
+ }));
17505
17565
 
17506
- renderEventContent(element, parentGfx);
17566
+ renderEventContent(element, parentGfx, attrs);
17507
17567
 
17508
17568
  return outer;
17509
17569
  },
@@ -17521,21 +17581,21 @@
17521
17581
  return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, attrs);
17522
17582
  },
17523
17583
 
17524
- 'bpmn:Task': function(parentGfx, element) {
17525
- var attrs = {
17584
+ 'bpmn:Task': function(parentGfx, element, attrs) {
17585
+ attrs = assign({
17526
17586
  fill: getFillColor(element, defaultFillColor),
17527
17587
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17528
- };
17588
+ }, attrs);
17529
17589
 
17530
17590
  var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
17531
17591
 
17532
17592
  renderEmbeddedLabel(parentGfx, element, 'center-middle');
17533
- attachTaskMarkers(parentGfx, element);
17593
+ attachTaskMarkers(parentGfx, element, attrs);
17534
17594
 
17535
17595
  return rect;
17536
17596
  },
17537
- 'bpmn:ServiceTask': function(parentGfx, element) {
17538
- var task = renderer('bpmn:Task')(parentGfx, element);
17597
+ 'bpmn:ServiceTask': function(parentGfx, element, attrs) {
17598
+ var task = renderer('bpmn:Task')(parentGfx, element, attrs);
17539
17599
 
17540
17600
  var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
17541
17601
  abspos: {
@@ -17544,11 +17604,12 @@
17544
17604
  }
17545
17605
  });
17546
17606
 
17547
- /* service bg */ drawPath(parentGfx, pathDataBG, {
17607
+ var serviceAttrs = assign({
17548
17608
  strokeWidth: 1,
17549
17609
  fill: getFillColor(element, defaultFillColor),
17550
17610
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17551
- });
17611
+ }, attrs);
17612
+ /* service bg */ drawPath(parentGfx, pathDataBG, serviceAttrs);
17552
17613
 
17553
17614
  var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', {
17554
17615
  abspos: {
@@ -17557,10 +17618,11 @@
17557
17618
  }
17558
17619
  });
17559
17620
 
17560
- /* service fill */ drawPath(parentGfx, fillPathData, {
17621
+ var fillAttrs = assign({
17561
17622
  strokeWidth: 0,
17562
17623
  fill: getFillColor(element, defaultFillColor)
17563
- });
17624
+ }, attrs);
17625
+ /* service fill */ drawPath(parentGfx, fillPathData, fillAttrs);
17564
17626
 
17565
17627
  var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
17566
17628
  abspos: {
@@ -17569,16 +17631,12 @@
17569
17631
  }
17570
17632
  });
17571
17633
 
17572
- /* service */ drawPath(parentGfx, pathData, {
17573
- strokeWidth: 1,
17574
- fill: getFillColor(element, defaultFillColor),
17575
- stroke: getStrokeColor$1(element, defaultStrokeColor)
17576
- });
17634
+ /* service */ drawPath(parentGfx, pathData, serviceAttrs);
17577
17635
 
17578
17636
  return task;
17579
17637
  },
17580
- 'bpmn:UserTask': function(parentGfx, element) {
17581
- var task = renderer('bpmn:Task')(parentGfx, element);
17638
+ 'bpmn:UserTask': function(parentGfx, element, attrs) {
17639
+ var task = renderer('bpmn:Task')(parentGfx, element, attrs);
17582
17640
 
17583
17641
  var x = 15;
17584
17642
  var y = 12;
@@ -17590,11 +17648,12 @@
17590
17648
  }
17591
17649
  });
17592
17650
 
17593
- /* user path */ drawPath(parentGfx, pathData, {
17651
+ var userAttrs = assign({
17594
17652
  strokeWidth: 0.5,
17595
17653
  fill: getFillColor(element, defaultFillColor),
17596
17654
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17597
- });
17655
+ }, attrs);
17656
+ /* user path */ drawPath(parentGfx, pathData, userAttrs);
17598
17657
 
17599
17658
  var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
17600
17659
  abspos: {
@@ -17603,11 +17662,7 @@
17603
17662
  }
17604
17663
  });
17605
17664
 
17606
- /* user2 path */ drawPath(parentGfx, pathData2, {
17607
- strokeWidth: 0.5,
17608
- fill: getFillColor(element, defaultFillColor),
17609
- stroke: getStrokeColor$1(element, defaultStrokeColor)
17610
- });
17665
+ /* user2 path */ drawPath(parentGfx, pathData2, userAttrs);
17611
17666
 
17612
17667
  var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
17613
17668
  abspos: {
@@ -17616,16 +17671,12 @@
17616
17671
  }
17617
17672
  });
17618
17673
 
17619
- /* user3 path */ drawPath(parentGfx, pathData3, {
17620
- strokeWidth: 0.5,
17621
- fill: getStrokeColor$1(element, defaultStrokeColor),
17622
- stroke: getStrokeColor$1(element, defaultStrokeColor)
17623
- });
17674
+ /* user3 path */ drawPath(parentGfx, pathData3, userAttrs);
17624
17675
 
17625
17676
  return task;
17626
17677
  },
17627
- 'bpmn:ManualTask': function(parentGfx, element) {
17628
- var task = renderer('bpmn:Task')(parentGfx, element);
17678
+ 'bpmn:ManualTask': function(parentGfx, element, attrs) {
17679
+ var task = renderer('bpmn:Task')(parentGfx, element, attrs);
17629
17680
 
17630
17681
  var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
17631
17682
  abspos: {
@@ -17634,16 +17685,17 @@
17634
17685
  }
17635
17686
  });
17636
17687
 
17637
- /* manual path */ drawPath(parentGfx, pathData, {
17688
+ var manualAttrs = assign({
17638
17689
  strokeWidth: 0.5, // 0.25,
17639
17690
  fill: getFillColor(element, defaultFillColor),
17640
17691
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17641
- });
17692
+ }, attrs);
17693
+ /* manual path */ drawPath(parentGfx, pathData, manualAttrs);
17642
17694
 
17643
17695
  return task;
17644
17696
  },
17645
- 'bpmn:SendTask': function(parentGfx, element) {
17646
- var task = renderer('bpmn:Task')(parentGfx, element);
17697
+ 'bpmn:SendTask': function(parentGfx, element, attrs) {
17698
+ var task = renderer('bpmn:Task')(parentGfx, element, attrs);
17647
17699
 
17648
17700
  var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
17649
17701
  xScaleFactor: 1,
@@ -17656,22 +17708,25 @@
17656
17708
  }
17657
17709
  });
17658
17710
 
17659
- /* send path */ drawPath(parentGfx, pathData, {
17711
+ /* send path */
17712
+ var pathAttrs = assign({
17660
17713
  strokeWidth: 1,
17661
17714
  fill: getStrokeColor$1(element, defaultStrokeColor),
17662
17715
  stroke: getFillColor(element, defaultFillColor)
17663
- });
17716
+ }, attrs);
17717
+
17718
+ drawPath(parentGfx, pathData, pathAttrs);
17664
17719
 
17665
17720
  return task;
17666
17721
  },
17667
- 'bpmn:ReceiveTask' : function(parentGfx, element) {
17722
+ 'bpmn:ReceiveTask' : function(parentGfx, element, attrs) {
17668
17723
  var semantic = getSemantic(element);
17669
17724
 
17670
- var task = renderer('bpmn:Task')(parentGfx, element);
17725
+ var task = renderer('bpmn:Task')(parentGfx, element, attrs);
17671
17726
  var pathData;
17672
17727
 
17673
17728
  if (semantic.instantiate) {
17674
- drawCircle(parentGfx, 28, 28, 20 * 0.22, { strokeWidth: 1 });
17729
+ drawCircle(parentGfx, 28, 28, 20 * 0.22, assign({ strokeWidth: 1 }, attrs));
17675
17730
 
17676
17731
  pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
17677
17732
  abspos: {
@@ -17693,16 +17748,18 @@
17693
17748
  });
17694
17749
  }
17695
17750
 
17696
- /* receive path */ drawPath(parentGfx, pathData, {
17751
+ var receiveAttrs = assign({
17697
17752
  strokeWidth: 1,
17698
17753
  fill: getFillColor(element, defaultFillColor),
17699
17754
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17700
- });
17755
+ }, attrs);
17756
+
17757
+ /* receive path */ drawPath(parentGfx, pathData, receiveAttrs);
17701
17758
 
17702
17759
  return task;
17703
17760
  },
17704
- 'bpmn:ScriptTask': function(parentGfx, element) {
17705
- var task = renderer('bpmn:Task')(parentGfx, element);
17761
+ 'bpmn:ScriptTask': function(parentGfx, element, attrs) {
17762
+ var task = renderer('bpmn:Task')(parentGfx, element, attrs);
17706
17763
 
17707
17764
  var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
17708
17765
  abspos: {
@@ -17711,15 +17768,16 @@
17711
17768
  }
17712
17769
  });
17713
17770
 
17714
- /* script path */ drawPath(parentGfx, pathData, {
17771
+ var scriptAttrs = assign({
17715
17772
  strokeWidth: 1,
17716
17773
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17717
- });
17774
+ }, attrs);
17775
+ /* script path */ drawPath(parentGfx, pathData, scriptAttrs);
17718
17776
 
17719
17777
  return task;
17720
17778
  },
17721
- 'bpmn:BusinessRuleTask': function(parentGfx, element) {
17722
- var task = renderer('bpmn:Task')(parentGfx, element);
17779
+ 'bpmn:BusinessRuleTask': function(parentGfx, element, attrs) {
17780
+ var task = renderer('bpmn:Task')(parentGfx, element, attrs);
17723
17781
 
17724
17782
  var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
17725
17783
  abspos: {
@@ -17728,12 +17786,12 @@
17728
17786
  }
17729
17787
  });
17730
17788
 
17731
- var businessHeaderPath = drawPath(parentGfx, headerPathData);
17732
- attr(businessHeaderPath, {
17789
+ var headerAttrs = assign({
17733
17790
  strokeWidth: 1,
17734
17791
  fill: getFillColor(element, '#aaaaaa'),
17735
17792
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17736
- });
17793
+ }, attrs);
17794
+ drawPath(parentGfx, headerPathData, headerAttrs);
17737
17795
 
17738
17796
  var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
17739
17797
  abspos: {
@@ -17742,11 +17800,11 @@
17742
17800
  }
17743
17801
  });
17744
17802
 
17745
- var businessPath = drawPath(parentGfx, headerData);
17746
- attr(businessPath, {
17803
+ var businessAttrs = assign({
17747
17804
  strokeWidth: 1,
17748
17805
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17749
- });
17806
+ }, attrs);
17807
+ drawPath(parentGfx, headerData, businessAttrs);
17750
17808
 
17751
17809
  return task;
17752
17810
  },
@@ -17769,41 +17827,42 @@
17769
17827
  renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle');
17770
17828
 
17771
17829
  if (expanded) {
17772
- attachTaskMarkers(parentGfx, element);
17830
+ attachTaskMarkers(parentGfx, element, attrs);
17773
17831
  } else {
17774
- attachTaskMarkers(parentGfx, element, ['SubProcessMarker']);
17832
+ attachTaskMarkers(parentGfx, element, attrs, ['SubProcessMarker']);
17775
17833
  }
17776
17834
 
17777
17835
  return rect;
17778
17836
  },
17779
- 'bpmn:AdHocSubProcess': function(parentGfx, element) {
17780
- return renderer('bpmn:SubProcess')(parentGfx, element);
17837
+ 'bpmn:AdHocSubProcess': function(parentGfx, element, attrs) {
17838
+ return renderer('bpmn:SubProcess')(parentGfx, element, attrs);
17781
17839
  },
17782
- 'bpmn:Transaction': function(parentGfx, element) {
17783
- var outer = renderer('bpmn:SubProcess')(parentGfx, element);
17840
+ 'bpmn:Transaction': function(parentGfx, element, attrs) {
17841
+ var outer = renderer('bpmn:SubProcess')(parentGfx, element, attrs);
17784
17842
 
17785
17843
  var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
17786
17844
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17787
17845
  });
17788
17846
 
17789
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, innerAttrs);
17847
+ /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 2, INNER_OUTER_DIST, assign(innerAttrs, attrs));
17790
17848
 
17791
17849
  return outer;
17792
17850
  },
17793
- 'bpmn:CallActivity': function(parentGfx, element) {
17794
- return renderer('bpmn:SubProcess')(parentGfx, element, {
17851
+ 'bpmn:CallActivity': function(parentGfx, element, attrs) {
17852
+ attrs = assign({
17795
17853
  strokeWidth: 5
17796
- });
17797
- },
17798
- 'bpmn:Participant': function(parentGfx, element) {
17854
+ }, attrs);
17799
17855
 
17800
- var attrs = {
17856
+ return renderer('bpmn:SubProcess')(parentGfx, element, attrs);
17857
+ },
17858
+ 'bpmn:Participant': function(parentGfx, element, attrs) {
17859
+ var outerAttrs = assign({
17801
17860
  fillOpacity: DEFAULT_FILL_OPACITY,
17802
17861
  fill: getFillColor(element, defaultFillColor),
17803
17862
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17804
- };
17863
+ }, attrs);
17805
17864
 
17806
- var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
17865
+ var lane = renderer('bpmn:Lane')(parentGfx, element, outerAttrs);
17807
17866
 
17808
17867
  var expandedPool = isExpanded(element);
17809
17868
 
@@ -17811,9 +17870,9 @@
17811
17870
  drawLine(parentGfx, [
17812
17871
  { x: 30, y: 0 },
17813
17872
  { x: 30, y: element.height }
17814
- ], {
17873
+ ], assign({
17815
17874
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17816
- });
17875
+ }, attrs));
17817
17876
  var text = getSemantic(element).name;
17818
17877
  renderLaneLabel(parentGfx, text, element);
17819
17878
  } else {
@@ -17831,7 +17890,7 @@
17831
17890
  var participantMultiplicity = !!(getSemantic(element).participantMultiplicity);
17832
17891
 
17833
17892
  if (participantMultiplicity) {
17834
- renderer('ParticipantMultiplicityMarker')(parentGfx, element);
17893
+ renderer('ParticipantMultiplicityMarker')(parentGfx, element, attrs);
17835
17894
  }
17836
17895
 
17837
17896
  return lane;
@@ -17852,20 +17911,23 @@
17852
17911
 
17853
17912
  return rect;
17854
17913
  },
17855
- 'bpmn:InclusiveGateway': function(parentGfx, element) {
17856
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
17914
+ 'bpmn:InclusiveGateway': function(parentGfx, element, attrs) {
17915
+ var diamond = renderer('bpmn:Gateway')(parentGfx, element, attrs);
17857
17916
 
17858
- /* circle path */
17859
- drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
17917
+
17918
+ var circleAttrs = assign({
17860
17919
  strokeWidth: 2.5,
17861
17920
  fill: getFillColor(element, defaultFillColor),
17862
17921
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17863
- });
17922
+ }, attrs);
17923
+
17924
+ /* circle path */
17925
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.24, circleAttrs);
17864
17926
 
17865
17927
  return diamond;
17866
17928
  },
17867
- 'bpmn:ExclusiveGateway': function(parentGfx, element) {
17868
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
17929
+ 'bpmn:ExclusiveGateway': function(parentGfx, element, attrs) {
17930
+ var diamond = renderer('bpmn:Gateway')(parentGfx, element, attrs);
17869
17931
 
17870
17932
  var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
17871
17933
  xScaleFactor: 0.4,
@@ -17879,17 +17941,17 @@
17879
17941
  });
17880
17942
 
17881
17943
  if ((getDi(element).isMarkerVisible)) {
17882
- drawPath(parentGfx, pathData, {
17944
+ drawPath(parentGfx, pathData, assign({
17883
17945
  strokeWidth: 1,
17884
17946
  fill: getStrokeColor$1(element, defaultStrokeColor),
17885
17947
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17886
- });
17948
+ }, attrs));
17887
17949
  }
17888
17950
 
17889
17951
  return diamond;
17890
17952
  },
17891
- 'bpmn:ComplexGateway': function(parentGfx, element) {
17892
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
17953
+ 'bpmn:ComplexGateway': function(parentGfx, element, attrs) {
17954
+ var diamond = renderer('bpmn:Gateway')(parentGfx, element, attrs);
17893
17955
 
17894
17956
  var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
17895
17957
  xScaleFactor: 0.5,
@@ -17902,16 +17964,17 @@
17902
17964
  }
17903
17965
  });
17904
17966
 
17905
- /* complex path */ drawPath(parentGfx, pathData, {
17967
+ var innerAttrs = assign({
17906
17968
  strokeWidth: 1,
17907
17969
  fill: getStrokeColor$1(element, defaultStrokeColor),
17908
17970
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17909
- });
17971
+ }, attrs);
17972
+ /* complex path */ drawPath(parentGfx, pathData, innerAttrs);
17910
17973
 
17911
17974
  return diamond;
17912
17975
  },
17913
- 'bpmn:ParallelGateway': function(parentGfx, element) {
17914
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
17976
+ 'bpmn:ParallelGateway': function(parentGfx, element, attrs) {
17977
+ var diamond = renderer('bpmn:Gateway')(parentGfx, element, attrs);
17915
17978
 
17916
17979
  var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
17917
17980
  xScaleFactor: 0.6,
@@ -17924,25 +17987,27 @@
17924
17987
  }
17925
17988
  });
17926
17989
 
17927
- /* parallel path */ drawPath(parentGfx, pathData, {
17990
+ var innerAttrs = assign({
17928
17991
  strokeWidth: 1,
17929
17992
  fill: getStrokeColor$1(element, defaultStrokeColor),
17930
17993
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17931
- });
17994
+ }, attrs);
17995
+ /* parallel path */ drawPath(parentGfx, pathData, innerAttrs);
17932
17996
 
17933
17997
  return diamond;
17934
17998
  },
17935
- 'bpmn:EventBasedGateway': function(parentGfx, element) {
17999
+ 'bpmn:EventBasedGateway': function(parentGfx, element, attrs) {
17936
18000
 
17937
18001
  var semantic = getSemantic(element);
17938
18002
 
17939
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
18003
+ var diamond = renderer('bpmn:Gateway')(parentGfx, element, attrs);
17940
18004
 
17941
- /* outer circle path */ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
18005
+ var outerAttrs = assign({
17942
18006
  strokeWidth: 1,
17943
18007
  fill: 'none',
17944
18008
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17945
- });
18009
+ }, attrs);
18010
+ /* outer circle path */ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, outerAttrs);
17946
18011
 
17947
18012
  var type = semantic.eventGatewayType;
17948
18013
  var instantiate = !!semantic.instantiate;
@@ -17960,13 +18025,12 @@
17960
18025
  }
17961
18026
  });
17962
18027
 
17963
- var attrs = {
18028
+ var innerAttrs = assign({
17964
18029
  strokeWidth: 2,
17965
18030
  fill: getFillColor(element, 'none'),
17966
18031
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17967
- };
17968
-
17969
- /* event path */ drawPath(parentGfx, pathData, attrs);
18032
+ }, attrs);
18033
+ /* event path */ drawPath(parentGfx, pathData, innerAttrs);
17970
18034
  }
17971
18035
 
17972
18036
  if (type === 'Parallel') {
@@ -17982,7 +18046,7 @@
17982
18046
  }
17983
18047
  });
17984
18048
 
17985
- var parallelPath = drawPath(parentGfx, pathData);
18049
+ var parallelPath = drawPath(parentGfx, pathData, attrs);
17986
18050
  attr(parallelPath, {
17987
18051
  strokeWidth: 1,
17988
18052
  fill: 'none'
@@ -17990,12 +18054,12 @@
17990
18054
  } else if (type === 'Exclusive') {
17991
18055
 
17992
18056
  if (!instantiate) {
17993
- var innerCircle = drawCircle(parentGfx, element.width, element.height, element.height * 0.26);
17994
- attr(innerCircle, {
18057
+ var innerCircleAttrs = assign({
17995
18058
  strokeWidth: 1,
17996
18059
  fill: 'none',
17997
18060
  stroke: getStrokeColor$1(element, defaultStrokeColor)
17998
- });
18061
+ }, attrs);
18062
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.26, innerCircleAttrs);
17999
18063
  }
18000
18064
 
18001
18065
  drawEvent();
@@ -18004,26 +18068,28 @@
18004
18068
 
18005
18069
  return diamond;
18006
18070
  },
18007
- 'bpmn:Gateway': function(parentGfx, element) {
18008
- var attrs = {
18071
+ 'bpmn:Gateway': function(parentGfx, element, attrs) {
18072
+ attrs = assign({
18009
18073
  fill: getFillColor(element, defaultFillColor),
18010
18074
  fillOpacity: DEFAULT_FILL_OPACITY,
18011
18075
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18012
- };
18076
+ }, attrs);
18013
18077
 
18014
18078
  return drawDiamond(parentGfx, element.width, element.height, attrs);
18015
18079
  },
18016
- 'bpmn:SequenceFlow': function(parentGfx, element) {
18080
+ 'bpmn:SequenceFlow': function(parentGfx, element, attrs) {
18081
+ attrs = attrs || {};
18082
+
18017
18083
  var pathData = createPathFromConnection(element);
18018
18084
 
18019
- var fill = getFillColor(element, defaultFillColor),
18020
- stroke = getStrokeColor$1(element, defaultStrokeColor);
18085
+ var fill = attrs.fill || getFillColor(element, defaultFillColor),
18086
+ stroke = attrs.stroke || getStrokeColor$1(element, defaultStrokeColor);
18021
18087
 
18022
- var attrs = {
18088
+ attrs = assign({
18023
18089
  strokeLinejoin: 'round',
18024
18090
  markerEnd: marker('sequenceflow-end', fill, stroke),
18025
18091
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18026
- };
18092
+ }, attrs || {});
18027
18093
 
18028
18094
  var path = drawPath(parentGfx, pathData, attrs);
18029
18095
 
@@ -18077,41 +18143,56 @@
18077
18143
 
18078
18144
  return drawLine(parentGfx, element.waypoints, attrs);
18079
18145
  },
18080
- 'bpmn:DataInputAssociation': function(parentGfx, element) {
18081
- var fill = getFillColor(element, defaultFillColor),
18082
- stroke = getStrokeColor$1(element, defaultStrokeColor);
18146
+ 'bpmn:DataInputAssociation': function(parentGfx, element, attrs) {
18147
+ attrs = attrs || {};
18148
+
18149
+ var fill = attrs.fill || getFillColor(element, defaultFillColor),
18150
+ stroke = attrs.stroke || getStrokeColor$1(element, defaultStrokeColor);
18083
18151
 
18084
- return renderer('bpmn:Association')(parentGfx, element, {
18152
+ attrs = assign({
18153
+ fill: fill,
18154
+ stroke: stroke,
18085
18155
  markerEnd: marker('association-end', fill, stroke)
18086
- });
18156
+ }, attrs);
18157
+
18158
+ return renderer('bpmn:Association')(parentGfx, element, attrs);
18087
18159
  },
18088
- 'bpmn:DataOutputAssociation': function(parentGfx, element) {
18089
- var fill = getFillColor(element, defaultFillColor),
18090
- stroke = getStrokeColor$1(element, defaultStrokeColor);
18160
+ 'bpmn:DataOutputAssociation': function(parentGfx, element, attrs) {
18161
+ attrs = attrs || {};
18162
+
18163
+ var fill = attrs.fill || getFillColor(element, defaultFillColor),
18164
+ stroke = attrs.stroke || getStrokeColor$1(element, defaultStrokeColor);
18165
+
18091
18166
 
18092
- return renderer('bpmn:Association')(parentGfx, element, {
18167
+ attrs = assign({
18168
+ fill: fill,
18169
+ stroke: stroke,
18093
18170
  markerEnd: marker('association-end', fill, stroke)
18094
- });
18171
+ }, attrs);
18172
+
18173
+ return renderer('bpmn:Association')(parentGfx, element, attrs);
18095
18174
  },
18096
- 'bpmn:MessageFlow': function(parentGfx, element) {
18175
+ 'bpmn:MessageFlow': function(parentGfx, element, attrs) {
18176
+ attrs = attrs || {};
18097
18177
 
18098
18178
  var semantic = getSemantic(element),
18099
18179
  di = getDi(element);
18100
18180
 
18101
- var fill = getFillColor(element, defaultFillColor),
18102
- stroke = getStrokeColor$1(element, defaultStrokeColor);
18181
+ var fill = attrs.fill || getFillColor(element, defaultFillColor),
18182
+ stroke = attrs.stroke || getStrokeColor$1(element, defaultStrokeColor);
18103
18183
 
18104
18184
  var pathData = createPathFromConnection(element);
18105
18185
 
18106
- var attrs = {
18186
+
18187
+ attrs = assign({
18107
18188
  markerEnd: marker('messageflow-end', fill, stroke),
18108
18189
  markerStart: marker('messageflow-start', fill, stroke),
18109
18190
  strokeDasharray: '10, 12',
18110
18191
  strokeLinecap: 'round',
18111
18192
  strokeLinejoin: 'round',
18112
18193
  strokeWidth: '1.5px',
18113
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18114
- };
18194
+ stroke: stroke
18195
+ }, attrs);
18115
18196
 
18116
18197
  var path = drawPath(parentGfx, pathData, attrs);
18117
18198
 
@@ -18158,7 +18239,7 @@
18158
18239
 
18159
18240
  return path;
18160
18241
  },
18161
- 'bpmn:DataObject': function(parentGfx, element) {
18242
+ 'bpmn:DataObject': function(parentGfx, element, attrs) {
18162
18243
  var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
18163
18244
  xScaleFactor: 1,
18164
18245
  yScaleFactor: 1,
@@ -18170,46 +18251,56 @@
18170
18251
  }
18171
18252
  });
18172
18253
 
18173
- var elementObject = drawPath(parentGfx, pathData, {
18254
+ var outerAttrs = assign({
18174
18255
  fill: getFillColor(element, defaultFillColor),
18175
18256
  fillOpacity: DEFAULT_FILL_OPACITY,
18176
18257
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18177
- });
18258
+ }, attrs);
18259
+ var elementObject = drawPath(parentGfx, pathData, outerAttrs);
18178
18260
 
18179
18261
  var semantic = getSemantic(element);
18180
18262
 
18181
18263
  if (isCollection(semantic)) {
18182
- renderDataItemCollection(parentGfx, element);
18264
+ renderDataItemCollection(parentGfx, element, attrs);
18183
18265
  }
18184
18266
 
18185
18267
  return elementObject;
18186
18268
  },
18187
18269
  'bpmn:DataObjectReference': as('bpmn:DataObject'),
18188
- 'bpmn:DataInput': function(parentGfx, element) {
18270
+ 'bpmn:DataInput': function(parentGfx, element, attrs) {
18189
18271
 
18190
18272
  var arrowPathData = pathMap.getRawPath('DATA_ARROW');
18191
18273
 
18192
18274
  // page
18193
- var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
18275
+ var elementObject = renderer('bpmn:DataObject')(parentGfx, element, attrs);
18194
18276
 
18195
- /* input arrow path */ drawPath(parentGfx, arrowPathData, { strokeWidth: 1 });
18277
+ var innerAttrs = assign({ strokeWidth: 1 }, attrs);
18278
+ /* input arrow path */ drawPath(parentGfx, arrowPathData, innerAttrs);
18196
18279
 
18197
18280
  return elementObject;
18198
18281
  },
18199
- 'bpmn:DataOutput': function(parentGfx, element) {
18282
+ 'bpmn:DataOutput': function(parentGfx, element, attrs) {
18200
18283
  var arrowPathData = pathMap.getRawPath('DATA_ARROW');
18201
18284
 
18202
18285
  // page
18203
- var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
18286
+ var elementObject = renderer('bpmn:DataObject')(parentGfx, element, attrs);
18204
18287
 
18205
- /* output arrow path */ drawPath(parentGfx, arrowPathData, {
18288
+ var arrowAttrs = assign({
18206
18289
  strokeWidth: 1,
18207
18290
  fill: 'black'
18208
- });
18291
+ }, attrs);
18292
+ /* output arrow path */ drawPath(parentGfx, arrowPathData, arrowAttrs);
18209
18293
 
18210
18294
  return elementObject;
18211
18295
  },
18212
- 'bpmn:DataStoreReference': function(parentGfx, element) {
18296
+ 'bpmn:DataStoreReference': function(parentGfx, element, attrs) {
18297
+ attrs = assign({
18298
+ strokeWidth: 2,
18299
+ fill: getFillColor(element, defaultFillColor),
18300
+ fillOpacity: DEFAULT_FILL_OPACITY,
18301
+ stroke: getStrokeColor$1(element, defaultStrokeColor)
18302
+ }, attrs);
18303
+
18213
18304
  var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {
18214
18305
  xScaleFactor: 1,
18215
18306
  yScaleFactor: 1,
@@ -18221,25 +18312,20 @@
18221
18312
  }
18222
18313
  });
18223
18314
 
18224
- var elementStore = drawPath(parentGfx, DATA_STORE_PATH, {
18225
- strokeWidth: 2,
18226
- fill: getFillColor(element, defaultFillColor),
18227
- fillOpacity: DEFAULT_FILL_OPACITY,
18228
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18229
- });
18315
+ var elementStore = drawPath(parentGfx, DATA_STORE_PATH, attrs);
18230
18316
 
18231
18317
  return elementStore;
18232
18318
  },
18233
- 'bpmn:BoundaryEvent': function(parentGfx, element) {
18319
+ 'bpmn:BoundaryEvent': function(parentGfx, element, attrs) {
18234
18320
 
18235
18321
  var semantic = getSemantic(element),
18236
18322
  cancel = semantic.cancelActivity;
18237
18323
 
18238
- var attrs = {
18324
+ attrs = assign({
18239
18325
  strokeWidth: 1,
18240
18326
  fill: getFillColor(element, defaultFillColor),
18241
18327
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18242
- };
18328
+ }, attrs);
18243
18329
 
18244
18330
  if (!cancel) {
18245
18331
  attrs.strokeDasharray = '6';
@@ -18260,30 +18346,32 @@
18260
18346
 
18261
18347
  /* inner path */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, innerAttrs);
18262
18348
 
18263
- renderEventContent(element, parentGfx);
18349
+ renderEventContent(element, parentGfx, attrs);
18264
18350
 
18265
18351
  return outer;
18266
18352
  },
18267
- 'bpmn:Group': function(parentGfx, element) {
18353
+ 'bpmn:Group': function(parentGfx, element, attrs) {
18268
18354
 
18269
- var group = drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
18355
+ attrs = assign({
18270
18356
  stroke: getStrokeColor$1(element, defaultStrokeColor),
18271
18357
  strokeWidth: 1,
18272
18358
  strokeDasharray: '8,3,1,3',
18273
18359
  fill: 'none',
18274
18360
  pointerEvents: 'none'
18275
- });
18361
+ }, attrs);
18362
+
18363
+ var group = drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, attrs);
18276
18364
 
18277
18365
  return group;
18278
18366
  },
18279
18367
  'label': function(parentGfx, element) {
18280
18368
  return renderExternalLabel(parentGfx, element);
18281
18369
  },
18282
- 'bpmn:TextAnnotation': function(parentGfx, element) {
18283
- var style = {
18370
+ 'bpmn:TextAnnotation': function(parentGfx, element, attrs) {
18371
+ var style = assign({}, attrs, {
18284
18372
  'fill': 'none',
18285
18373
  'stroke': 'none'
18286
- };
18374
+ });
18287
18375
 
18288
18376
  var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, style);
18289
18377
 
@@ -18298,9 +18386,10 @@
18298
18386
  }
18299
18387
  });
18300
18388
 
18301
- drawPath(parentGfx, textPathData, {
18389
+ var pathAttrs = assign({
18302
18390
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18303
- });
18391
+ }, attrs);
18392
+ drawPath(parentGfx, textPathData, pathAttrs);
18304
18393
 
18305
18394
  var text = getSemantic(element).text || '';
18306
18395
  renderLabel(parentGfx, text, {
@@ -18314,7 +18403,13 @@
18314
18403
 
18315
18404
  return textElement;
18316
18405
  },
18317
- 'ParticipantMultiplicityMarker': function(parentGfx, element) {
18406
+ 'ParticipantMultiplicityMarker': function(parentGfx, element, attrs) {
18407
+ attrs = assign({
18408
+ strokeWidth: 2,
18409
+ fill: getFillColor(element, defaultFillColor),
18410
+ stroke: getStrokeColor$1(element, defaultStrokeColor)
18411
+ }, attrs);
18412
+
18318
18413
  var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
18319
18414
  xScaleFactor: 1,
18320
18415
  yScaleFactor: 1,
@@ -18326,18 +18421,15 @@
18326
18421
  }
18327
18422
  });
18328
18423
 
18329
- drawMarker('participant-multiplicity', parentGfx, markerPath, {
18330
- strokeWidth: 2,
18331
- fill: getFillColor(element, defaultFillColor),
18332
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18333
- });
18424
+ drawMarker('participant-multiplicity', parentGfx, markerPath, attrs);
18334
18425
  },
18335
- 'SubProcessMarker': function(parentGfx, element) {
18336
- var markerRect = drawRect(parentGfx, 14, 14, 0, {
18337
- strokeWidth: 1,
18426
+ 'SubProcessMarker': function(parentGfx, element, attrs) {
18427
+ attrs = assign({
18338
18428
  fill: getFillColor(element, defaultFillColor),
18339
18429
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18340
- });
18430
+ }, attrs);
18431
+
18432
+ var markerRect = drawRect(parentGfx, 14, 14, 0, assign({ strokeWidth: 1 }, attrs));
18341
18433
 
18342
18434
  // Process marker is placed in the middle of the box
18343
18435
  // therefore fixed values can be used here
@@ -18354,12 +18446,14 @@
18354
18446
  }
18355
18447
  });
18356
18448
 
18357
- drawMarker('sub-process', parentGfx, markerPath, {
18449
+ drawMarker('sub-process', parentGfx, markerPath, attrs);
18450
+ },
18451
+ 'ParallelMarker': function(parentGfx, element, attrs, position) {
18452
+ attrs = assign({
18358
18453
  fill: getFillColor(element, defaultFillColor),
18359
18454
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18360
- });
18361
- },
18362
- 'ParallelMarker': function(parentGfx, element, position) {
18455
+ }, attrs);
18456
+
18363
18457
  var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
18364
18458
  xScaleFactor: 1,
18365
18459
  yScaleFactor: 1,
@@ -18371,12 +18465,13 @@
18371
18465
  }
18372
18466
  });
18373
18467
 
18374
- drawMarker('parallel', parentGfx, markerPath, {
18468
+ drawMarker('parallel', parentGfx, markerPath, attrs);
18469
+ },
18470
+ 'SequentialMarker': function(parentGfx, element, attrs, position) {
18471
+ attrs = assign({
18375
18472
  fill: getFillColor(element, defaultFillColor),
18376
18473
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18377
- });
18378
- },
18379
- 'SequentialMarker': function(parentGfx, element, position) {
18474
+ }, attrs);
18380
18475
  var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
18381
18476
  xScaleFactor: 1,
18382
18477
  yScaleFactor: 1,
@@ -18388,12 +18483,15 @@
18388
18483
  }
18389
18484
  });
18390
18485
 
18391
- drawMarker('sequential', parentGfx, markerPath, {
18486
+ drawMarker('sequential', parentGfx, markerPath, attrs);
18487
+ },
18488
+ 'CompensationMarker': function(parentGfx, element, attrs, position) {
18489
+ attrs = assign({
18490
+ strokeWidth: 1,
18392
18491
  fill: getFillColor(element, defaultFillColor),
18393
18492
  stroke: getStrokeColor$1(element, defaultStrokeColor)
18394
- });
18395
- },
18396
- 'CompensationMarker': function(parentGfx, element, position) {
18493
+ }, attrs);
18494
+
18397
18495
  var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
18398
18496
  xScaleFactor: 1,
18399
18497
  yScaleFactor: 1,
@@ -18405,13 +18503,17 @@
18405
18503
  }
18406
18504
  });
18407
18505
 
18408
- drawMarker('compensation', parentGfx, markerMath, {
18506
+ drawMarker('compensation', parentGfx, markerMath, attrs);
18507
+ },
18508
+ 'LoopMarker': function(parentGfx, element, attrs, position) {
18509
+ attrs = assign({
18409
18510
  strokeWidth: 1,
18410
18511
  fill: getFillColor(element, defaultFillColor),
18411
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18412
- });
18413
- },
18414
- 'LoopMarker': function(parentGfx, element, position) {
18512
+ stroke: getStrokeColor$1(element, defaultStrokeColor),
18513
+ strokeLinecap: 'round',
18514
+ strokeMiterlimit: 0.5
18515
+ }, attrs);
18516
+
18415
18517
  var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
18416
18518
  xScaleFactor: 1,
18417
18519
  yScaleFactor: 1,
@@ -18423,15 +18525,15 @@
18423
18525
  }
18424
18526
  });
18425
18527
 
18426
- drawMarker('loop', parentGfx, markerPath, {
18427
- strokeWidth: 1,
18428
- fill: getFillColor(element, defaultFillColor),
18429
- stroke: getStrokeColor$1(element, defaultStrokeColor),
18430
- strokeLinecap: 'round',
18431
- strokeMiterlimit: 0.5
18432
- });
18528
+ drawMarker('loop', parentGfx, markerPath, attrs);
18433
18529
  },
18434
- 'AdhocMarker': function(parentGfx, element, position) {
18530
+ 'AdhocMarker': function(parentGfx, element, attrs, position) {
18531
+ attrs = assign({
18532
+ strokeWidth: 1,
18533
+ fill: getStrokeColor$1(element, defaultStrokeColor),
18534
+ stroke: getStrokeColor$1(element, defaultStrokeColor)
18535
+ }, attrs);
18536
+
18435
18537
  var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
18436
18538
  xScaleFactor: 1,
18437
18539
  yScaleFactor: 1,
@@ -18443,15 +18545,11 @@
18443
18545
  }
18444
18546
  });
18445
18547
 
18446
- drawMarker('adhoc', parentGfx, markerPath, {
18447
- strokeWidth: 1,
18448
- fill: getStrokeColor$1(element, defaultStrokeColor),
18449
- stroke: getStrokeColor$1(element, defaultStrokeColor)
18450
- });
18548
+ drawMarker('adhoc', parentGfx, markerPath, attrs);
18451
18549
  }
18452
18550
  };
18453
18551
 
18454
- function attachTaskMarkers(parentGfx, element, taskMarkers) {
18552
+ function attachTaskMarkers(parentGfx, element, attrs, taskMarkers) {
18455
18553
  var obj = getSemantic(element);
18456
18554
 
18457
18555
  var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;
@@ -18476,15 +18574,15 @@
18476
18574
  }
18477
18575
 
18478
18576
  forEach(taskMarkers, function(marker) {
18479
- renderer(marker)(parentGfx, element, position);
18577
+ renderer(marker)(parentGfx, element, attrs, position);
18480
18578
  });
18481
18579
 
18482
18580
  if (obj.isForCompensation) {
18483
- renderer('CompensationMarker')(parentGfx, element, position);
18581
+ renderer('CompensationMarker')(parentGfx, element, attrs, position);
18484
18582
  }
18485
18583
 
18486
18584
  if (obj.$type === 'bpmn:AdHocSubProcess') {
18487
- renderer('AdhocMarker')(parentGfx, element, position);
18585
+ renderer('AdhocMarker')(parentGfx, element, attrs, position);
18488
18586
  }
18489
18587
 
18490
18588
  var loopCharacteristics = obj.loopCharacteristics,
@@ -18493,20 +18591,23 @@
18493
18591
  if (loopCharacteristics) {
18494
18592
 
18495
18593
  if (isSequential === undefined) {
18496
- renderer('LoopMarker')(parentGfx, element, position);
18594
+ renderer('LoopMarker')(parentGfx, element, attrs, position);
18497
18595
  }
18498
18596
 
18499
18597
  if (isSequential === false) {
18500
- renderer('ParallelMarker')(parentGfx, element, position);
18598
+ renderer('ParallelMarker')(parentGfx, element, attrs, position);
18501
18599
  }
18502
18600
 
18503
18601
  if (isSequential === true) {
18504
- renderer('SequentialMarker')(parentGfx, element, position);
18602
+ renderer('SequentialMarker')(parentGfx, element, attrs, position);
18505
18603
  }
18506
18604
  }
18507
18605
  }
18508
18606
 
18509
- function renderDataItemCollection(parentGfx, element) {
18607
+ function renderDataItemCollection(parentGfx, element, attrs) {
18608
+ attrs = assign({
18609
+ strokeWidth: 2
18610
+ }, attrs);
18510
18611
 
18511
18612
  var yPosition = (element.height - 18) / element.height;
18512
18613
 
@@ -18521,9 +18622,7 @@
18521
18622
  }
18522
18623
  });
18523
18624
 
18524
- /* collection path */ drawPath(parentGfx, pathData, {
18525
- strokeWidth: 2
18526
- });
18625
+ /* collection path */ drawPath(parentGfx, pathData, attrs);
18527
18626
  }
18528
18627
 
18529
18628
 
@@ -18549,20 +18648,20 @@
18549
18648
  return is$1(element, 'bpmn:BaseElement');
18550
18649
  };
18551
18650
 
18552
- BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
18651
+ BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs) {
18553
18652
  var type = element.type;
18554
18653
  var h = this.handlers[type];
18555
18654
 
18556
18655
  /* jshint -W040 */
18557
- return h(parentGfx, element);
18656
+ return h(parentGfx, element, attrs);
18558
18657
  };
18559
18658
 
18560
- BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
18659
+ BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs) {
18561
18660
  var type = element.type;
18562
18661
  var h = this.handlers[type];
18563
18662
 
18564
18663
  /* jshint -W040 */
18565
- return h(parentGfx, element);
18664
+ return h(parentGfx, element, attrs);
18566
18665
  };
18567
18666
 
18568
18667
  BpmnRenderer.prototype.getShapePath = function(element) {
@@ -19679,15 +19778,14 @@
19679
19778
  * Returns the bounds of an elements label, parsed from the elements DI or
19680
19779
  * generated from its bounds.
19681
19780
  *
19682
- * @param {BpmnElement} semantic
19781
+ * @param {BpmndDi} di
19683
19782
  * @param {djs.model.Base} element
19684
19783
  */
19685
- function getExternalLabelBounds(semantic, element) {
19784
+ function getExternalLabelBounds(di, element) {
19686
19785
 
19687
19786
  var mid,
19688
19787
  size,
19689
19788
  bounds,
19690
- di = semantic.di,
19691
19789
  label = di.label;
19692
19790
 
19693
19791
  if (label && label.bounds) {
@@ -19719,17 +19817,18 @@
19719
19817
  return element && !!element.labelTarget;
19720
19818
  }
19721
19819
 
19722
- function elementData(semantic, attrs) {
19820
+ function elementData(semantic, di, attrs) {
19723
19821
  return assign({
19724
19822
  id: semantic.id,
19725
19823
  type: semantic.$type,
19726
- businessObject: semantic
19824
+ businessObject: semantic,
19825
+ di: di
19727
19826
  }, attrs);
19728
19827
  }
19729
19828
 
19730
- function getWaypoints(bo, source, target) {
19829
+ function getWaypoints(di, source, target) {
19731
19830
 
19732
- var waypoints = bo.di.waypoint;
19831
+ var waypoints = di.waypoint;
19733
19832
 
19734
19833
  if (!waypoints || waypoints.length < 2) {
19735
19834
  return [ getMid(source), getMid(target) ];
@@ -19740,6 +19839,32 @@
19740
19839
  });
19741
19840
  }
19742
19841
 
19842
+ var PLANE_PADDING = 50;
19843
+
19844
+ function getPlaneBounds(plane) {
19845
+ var planeTrbl = {
19846
+ top: Infinity,
19847
+ right: -Infinity,
19848
+ bottom: -Infinity,
19849
+ left: Infinity
19850
+ };
19851
+
19852
+ plane.planeElement.forEach(function(element) {
19853
+ if (!element.bounds) {
19854
+ return;
19855
+ }
19856
+
19857
+ var trbl = asTRBL(element.bounds);
19858
+
19859
+ planeTrbl.top = Math.min(trbl.top, planeTrbl.top);
19860
+ planeTrbl.left = Math.min(trbl.left, planeTrbl.left);
19861
+ planeTrbl.right = Math.max(trbl.right, planeTrbl.right);
19862
+ planeTrbl.bottom = Math.max(trbl.bottom, planeTrbl.bottom);
19863
+ });
19864
+
19865
+ return asBounds(planeTrbl);
19866
+ }
19867
+
19743
19868
  function notYetDrawn(translate, semantic, refSemantic, property) {
19744
19869
  return new Error(translate('element {element} referenced by {referenced}#{property} not yet drawn', {
19745
19870
  element: elementToString(refSemantic),
@@ -19785,10 +19910,8 @@
19785
19910
  * Add bpmn element (semantic) to the canvas onto the
19786
19911
  * specified parent shape.
19787
19912
  */
19788
- BpmnImporter.prototype.add = function(semantic, parentElement) {
19789
-
19790
- var di = semantic.di,
19791
- element,
19913
+ BpmnImporter.prototype.add = function(semantic, di, parentElement) {
19914
+ var element,
19792
19915
  translate = this._translate,
19793
19916
  hidden;
19794
19917
 
@@ -19799,22 +19922,49 @@
19799
19922
  // invisible root element (process or collaboration)
19800
19923
  if (is$1(di, 'bpmndi:BPMNPlane')) {
19801
19924
 
19802
- // add a virtual element (not being drawn)
19803
- element = this._elementFactory.createRoot(elementData(semantic));
19925
+ if (is$1(semantic, 'bpmn:SubProcess')) {
19926
+ var plane = this._canvas.createPlane(semantic.id, element);
19927
+
19928
+ // Get size of expanded element
19929
+ var bounds = getPlaneBounds(di);
19930
+
19931
+ var primary = this._elementRegistry.get(semantic.id);
19932
+ element = this._elementFactory.createShape(elementData(semantic, di, {
19933
+ collapsed: false,
19934
+ hidden: false,
19935
+ x: bounds.x - PLANE_PADDING,
19936
+ y: bounds.y - PLANE_PADDING,
19937
+ width: bounds.width + PLANE_PADDING * 2,
19938
+ height: bounds.height + PLANE_PADDING * 2,
19939
+ isFrame: true
19940
+ }));
19941
+
19942
+ element.id = element.id + '_secondary';
19943
+ element.isSecondary = true;
19944
+ element.primaryShape = primary;
19945
+
19946
+ this._canvas.addShape(element, plane.rootElement);
19947
+ }
19948
+ else {
19949
+
19950
+ // add a virtual element (not being drawn)
19951
+ element = this._elementFactory.createRoot(elementData(semantic, di));
19804
19952
 
19805
- this._canvas.setRootElement(element);
19953
+ this._canvas.createPlane(semantic.id, element);
19954
+ }
19806
19955
  }
19807
19956
 
19808
19957
  // SHAPE
19809
19958
  else if (is$1(di, 'bpmndi:BPMNShape')) {
19810
19959
 
19811
- var collapsed = !isExpanded(semantic),
19960
+ var collapsed = !isExpanded(semantic, di),
19812
19961
  isFrame = isFrameElement(semantic);
19962
+
19813
19963
  hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
19814
19964
 
19815
- var bounds = semantic.di.bounds;
19965
+ bounds = di.bounds;
19816
19966
 
19817
- element = this._elementFactory.createShape(elementData(semantic, {
19967
+ element = this._elementFactory.createShape(elementData(semantic, di, {
19818
19968
  collapsed: collapsed,
19819
19969
  hidden: hidden,
19820
19970
  x: Math.round(bounds.x),
@@ -19837,7 +19987,7 @@
19837
19987
 
19838
19988
  // check whether data store is inside our outside of its semantic parent
19839
19989
  if (!isPointInsideBBox$1(parentElement, getMid(bounds))) {
19840
- parentElement = this._canvas.getRootElement();
19990
+ parentElement = this._canvas.findPlane(parentElement).rootElement;
19841
19991
  }
19842
19992
  }
19843
19993
 
@@ -19852,11 +20002,11 @@
19852
20002
 
19853
20003
  hidden = parentElement && (parentElement.hidden || parentElement.collapsed);
19854
20004
 
19855
- element = this._elementFactory.createConnection(elementData(semantic, {
20005
+ element = this._elementFactory.createConnection(elementData(semantic, di, {
19856
20006
  hidden: hidden,
19857
20007
  source: source,
19858
20008
  target: target,
19859
- waypoints: getWaypoints(semantic, source, target)
20009
+ waypoints: getWaypoints(di, source, target)
19860
20010
  }));
19861
20011
 
19862
20012
  if (is$1(semantic, 'bpmn:DataAssociation')) {
@@ -19865,7 +20015,7 @@
19865
20015
  // are rendered correctly across different "hacks" people
19866
20016
  // love to model such as cross participant / sub process
19867
20017
  // associations
19868
- parentElement = null;
20018
+ parentElement = this._canvas.findPlane(parentElement).rootElement;
19869
20019
  }
19870
20020
 
19871
20021
  // insert sequence flows behind other flow nodes (cf. #727)
@@ -19883,7 +20033,7 @@
19883
20033
 
19884
20034
  // (optional) LABEL
19885
20035
  if (isLabelExternal(semantic) && getLabel(element)) {
19886
- this.addLabel(semantic, element);
20036
+ this.addLabel(semantic, di, element);
19887
20037
  }
19888
20038
 
19889
20039
 
@@ -19932,12 +20082,12 @@
19932
20082
  /**
19933
20083
  * add label for an element
19934
20084
  */
19935
- BpmnImporter.prototype.addLabel = function(semantic, element) {
20085
+ BpmnImporter.prototype.addLabel = function(semantic, di, element) {
19936
20086
  var bounds,
19937
20087
  text,
19938
20088
  label;
19939
20089
 
19940
- bounds = getExternalLabelBounds(semantic, element);
20090
+ bounds = getExternalLabelBounds(di, element);
19941
20091
 
19942
20092
  text = getLabel(element);
19943
20093
 
@@ -19947,7 +20097,7 @@
19947
20097
  bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
19948
20098
  }
19949
20099
 
19950
- label = this._elementFactory.createLabel(elementData(semantic, {
20100
+ label = this._elementFactory.createLabel(elementData(semantic, di, {
19951
20101
  id: semantic.id + '_label',
19952
20102
  labelTarget: element,
19953
20103
  type: 'label',
@@ -21491,22 +21641,26 @@
21491
21641
 
21492
21642
  Overlays.prototype._updateOverlayVisibilty = function(overlay, viewbox) {
21493
21643
  var show = overlay.show,
21644
+ plane = overlay.plane,
21494
21645
  minZoom = show && show.minZoom,
21495
21646
  maxZoom = show && show.maxZoom,
21496
21647
  htmlContainer = overlay.htmlContainer,
21648
+ activePlane = this._canvas.getActivePlane(),
21497
21649
  visible = true;
21498
21650
 
21499
- if (show) {
21651
+ if (plane !== activePlane) {
21652
+ visible = false;
21653
+ } else if (show) {
21500
21654
  if (
21501
21655
  (isDefined(minZoom) && minZoom > viewbox.scale) ||
21502
21656
  (isDefined(maxZoom) && maxZoom < viewbox.scale)
21503
21657
  ) {
21504
21658
  visible = false;
21505
21659
  }
21506
-
21507
- setVisible$1(htmlContainer, visible);
21508
21660
  }
21509
21661
 
21662
+ setVisible$1(htmlContainer, visible);
21663
+
21510
21664
  this._updateOverlayScale(overlay, viewbox);
21511
21665
  };
21512
21666
 
@@ -21677,6 +21831,660 @@
21677
21831
  overlays: [ 'type', Overlays ]
21678
21832
  };
21679
21833
 
21834
+ /**
21835
+ * Adds change support to the diagram, including
21836
+ *
21837
+ * <ul>
21838
+ * <li>redrawing shapes and connections on change</li>
21839
+ * </ul>
21840
+ *
21841
+ * @param {EventBus} eventBus
21842
+ * @param {Canvas} canvas
21843
+ * @param {ElementRegistry} elementRegistry
21844
+ * @param {GraphicsFactory} graphicsFactory
21845
+ */
21846
+ function ChangeSupport(
21847
+ eventBus, canvas, elementRegistry,
21848
+ graphicsFactory) {
21849
+
21850
+
21851
+ // redraw shapes / connections on change
21852
+
21853
+ eventBus.on('element.changed', function(event) {
21854
+
21855
+ var element = event.element;
21856
+
21857
+ // element might have been deleted and replaced by new element with same ID
21858
+ // thus check for parent of element except for root element
21859
+ if (element.parent || element === canvas.getRootElement()) {
21860
+ event.gfx = elementRegistry.getGraphics(element);
21861
+ }
21862
+
21863
+ // shape + gfx may have been deleted
21864
+ if (!event.gfx) {
21865
+ return;
21866
+ }
21867
+
21868
+ eventBus.fire(getType(element) + '.changed', event);
21869
+ });
21870
+
21871
+ eventBus.on('elements.changed', function(event) {
21872
+
21873
+ var elements = event.elements;
21874
+
21875
+ elements.forEach(function(e) {
21876
+ eventBus.fire('element.changed', { element: e });
21877
+ });
21878
+
21879
+ graphicsFactory.updateContainments(elements);
21880
+ });
21881
+
21882
+ eventBus.on('shape.changed', function(event) {
21883
+ graphicsFactory.update('shape', event.element, event.gfx);
21884
+ });
21885
+
21886
+ eventBus.on('connection.changed', function(event) {
21887
+ graphicsFactory.update('connection', event.element, event.gfx);
21888
+ });
21889
+ }
21890
+
21891
+ ChangeSupport.$inject = [
21892
+ 'eventBus',
21893
+ 'canvas',
21894
+ 'elementRegistry',
21895
+ 'graphicsFactory'
21896
+ ];
21897
+
21898
+ var ChangeSupportModule = {
21899
+ __init__: [ 'changeSupport'],
21900
+ changeSupport: [ 'type', ChangeSupport ]
21901
+ };
21902
+
21903
+ function SubprocessElements(eventBus, elementRegistry, canvas, elementFactory) {
21904
+ var attachBoundaries = function() {
21905
+ var secondaryShapes = elementRegistry.filter(function(el) {
21906
+ return is$1(el, 'bpmn:SubProcess') && el.isSecondary;
21907
+ });
21908
+
21909
+ secondaryShapes.forEach(function(process) {
21910
+
21911
+ // Add Boundary events
21912
+ if (process.primaryShape && process.primaryShape.attachers) {
21913
+ process.primaryShape.attachers.forEach(function(boundary) {
21914
+ var bo = getBusinessObject(boundary);
21915
+
21916
+ var primary = process.primaryShape;
21917
+
21918
+ var relativeXPos = (boundary.x + 15 - primary.x) / primary.width;
21919
+ var relativeYPos = (boundary.y + 15 - primary.y) / primary.height;
21920
+
21921
+ var dx = process.x + (process.width * relativeXPos) - 15;
21922
+ var dy = process.y + (process.height * relativeYPos) - 15;
21923
+
21924
+ var boundaryShape = elementFactory.createShape({
21925
+ id: bo.id + '_secondary',
21926
+ businessObject: bo,
21927
+ type: 'bpmn:BoundaryEvent',
21928
+ hidden: false,
21929
+ x: dx,
21930
+ y: dy,
21931
+ width: 30,
21932
+ height: 30,
21933
+ isFrame: false,
21934
+ isSecondary: true,
21935
+ primaryShape: boundary,
21936
+ di: boundary.di
21937
+ });
21938
+
21939
+ canvas.addShape(boundaryShape, process.parent);
21940
+
21941
+ if (!process.attachers) {
21942
+ process.attachers = [];
21943
+ }
21944
+
21945
+ process.attachers.push(boundaryShape);
21946
+ });
21947
+ }
21948
+ });
21949
+ };
21950
+
21951
+ eventBus.on('import.done', attachBoundaries);
21952
+ }
21953
+
21954
+
21955
+ SubprocessElements.$inject = [ 'eventBus', 'elementRegistry', 'canvas', 'elementFactory' ];
21956
+
21957
+ var defaultPosition = { x: 100, y: 50 };
21958
+
21959
+ function SubprocessCentering(eventBus, canvas) {
21960
+ var currentPlane = 'base';
21961
+ var positionMap = {};
21962
+
21963
+ eventBus.on('plane.set', function(event) {
21964
+
21965
+ var currentViewbox = canvas.viewbox();
21966
+ positionMap[currentPlane] = {
21967
+ x: currentViewbox.x,
21968
+ y: currentViewbox.y,
21969
+ zoom: currentViewbox.scale
21970
+ };
21971
+
21972
+ var planeId = event.plane.name;
21973
+ var storedViewbox = positionMap[planeId];
21974
+
21975
+ if (!storedViewbox) {
21976
+ if (!event.plane.rootElement.isImplicit) {
21977
+ storedViewbox = {
21978
+ x: 0,
21979
+ y: 0,
21980
+ zoom: 1
21981
+ };
21982
+ }
21983
+ else {
21984
+ var currentBoundingBox = canvas.getActiveLayer().getBBox();
21985
+ storedViewbox = {
21986
+ x: currentBoundingBox.x - defaultPosition.x,
21987
+ y: currentBoundingBox.y - defaultPosition.y,
21988
+ zoom: 1
21989
+ };
21990
+ }
21991
+ }
21992
+
21993
+ var dx = (currentViewbox.x - storedViewbox.x) * currentViewbox.scale,
21994
+ dy = (currentViewbox.y - storedViewbox.y) * currentViewbox.scale;
21995
+
21996
+ if (dx !== 0 || dy !== 0) {
21997
+ canvas.scroll({
21998
+ dx: dx,
21999
+ dy: dy
22000
+ });
22001
+ }
22002
+
22003
+ if (storedViewbox.zoom !== currentViewbox.scale) {
22004
+ canvas.zoom(storedViewbox.zoom, { x: 0, y: 0 });
22005
+ }
22006
+
22007
+ currentPlane = planeId;
22008
+ });
22009
+ }
22010
+
22011
+ SubprocessCentering.$inject = [ 'eventBus', 'canvas' ];
22012
+
22013
+ function SubprocessCompatibility(eventBus, elementRegistry, canvas, moddle, elementFactory, bpmnjs) {
22014
+ this._eventBus = eventBus;
22015
+ this._elementRegistry = elementRegistry;
22016
+ this._canvas = canvas;
22017
+ this._bpmnjs = bpmnjs;
22018
+ this._moddle = moddle;
22019
+ this._elementFactory = elementFactory;
22020
+
22021
+ var self = this;
22022
+
22023
+ eventBus.on('import.done', 1500, function() {
22024
+ self._handleImport();
22025
+ });
22026
+ }
22027
+
22028
+ SubprocessCompatibility.prototype._handleImport = function() {
22029
+ var elementRegistry = this._elementRegistry;
22030
+ var canvas = this._canvas;
22031
+ var elementFactory = this._elementFactory;
22032
+ var self = this;
22033
+ var legacyProcesses = elementRegistry.filter(function(element) {
22034
+ return is$1(element, 'bpmn:SubProcess') && !isExpanded(element) && element.children && element.children.length;
22035
+ });
22036
+
22037
+ legacyProcesses.forEach(function(oldParent) {
22038
+ var bo = getBusinessObject(oldParent);
22039
+
22040
+ var newDiagram = self.createDiagram(bo);
22041
+
22042
+ var newParent = elementFactory.createRoot(
22043
+ {
22044
+ id: bo.id,
22045
+ type: bo.$type,
22046
+ businessObject: bo,
22047
+ di: newDiagram.plane
22048
+ }
22049
+ );
22050
+
22051
+ newParent.id = newParent.id + '_plane';
22052
+
22053
+ canvas.createPlane(bo.id, newParent);
22054
+
22055
+ var elementsToChange = selfAndAllChildren(oldParent).filter(function(el) {
22056
+ return el !== oldParent;
22057
+ });
22058
+
22059
+ self.moveElementsToRoot(elementsToChange);
22060
+
22061
+ elementsToChange.forEach(function(el) {
22062
+ if (el.parent === oldParent) {
22063
+ el.parent = newParent;
22064
+ }
22065
+ el.hidden = el.parent && (el.parent.hidden || el.parent.collapsed);
22066
+
22067
+ self.moveToDiPlane(el, newDiagram.plane);
22068
+
22069
+ self._eventBus.fire('elements.changed', { elements: [el] });
22070
+ });
22071
+ });
22072
+
22073
+ };
22074
+
22075
+ SubprocessCompatibility.prototype.moveToDiPlane = function(element, newPlane) {
22076
+ var di = getDi(element);
22077
+ var containingDiagram = findRootDiagram(di);
22078
+
22079
+ // Remove DI from old Plane and add it to the new one
22080
+ var parentPlaneElement = containingDiagram.plane.get('planeElement');
22081
+ parentPlaneElement.splice(parentPlaneElement.indexOf(di), 1);
22082
+ newPlane.get('planeElement').push(di);
22083
+ };
22084
+
22085
+ SubprocessCompatibility.prototype.moveElementsToRoot = function(elements) {
22086
+ var defaultPosition = { x: 180, y: 160 },
22087
+ minX = Infinity,
22088
+ minY = Infinity;
22089
+
22090
+ elements.forEach(function(el) {
22091
+ minX = Math.min(minX, el.x || Infinity);
22092
+ minY = Math.min(minY, el.y || Infinity);
22093
+ });
22094
+
22095
+ var xOffset = defaultPosition.x - minX;
22096
+ var yOffset = defaultPosition.y - minY;
22097
+
22098
+ elements.forEach(function(el) {
22099
+ if (el.waypoints) {
22100
+ el.waypoints.forEach(function(waypoint) {
22101
+ waypoint.x = waypoint.x + xOffset;
22102
+ waypoint.y = waypoint.y + yOffset;
22103
+ });
22104
+ } else {
22105
+ el.x = el.x + xOffset;
22106
+ el.y = el.y + yOffset;
22107
+ }
22108
+ });
22109
+ };
22110
+
22111
+ SubprocessCompatibility.prototype.getDefinitions = function() {
22112
+ return this._bpmnjs._definitions || [];
22113
+ };
22114
+
22115
+ SubprocessCompatibility.prototype.getDiagrams = function() {
22116
+ return this.getDefinitions().diagrams || [];
22117
+ };
22118
+
22119
+ SubprocessCompatibility.prototype.createDiagram = function(bo) {
22120
+ var plane = this._moddle.create('bpmndi:BPMNPlane', { bpmnElement: bo });
22121
+ var diagram = this._moddle.create('bpmndi:BPMNDiagram', {
22122
+ plane: plane
22123
+ });
22124
+ plane.$parent = diagram;
22125
+ plane.bpmnElement = bo;
22126
+ diagram.$parent = this.getDefinitions();
22127
+ this.getDiagrams().push(diagram);
22128
+ return diagram;
22129
+ };
22130
+
22131
+ SubprocessCompatibility.$inject = [ 'eventBus', 'elementRegistry', 'canvas', 'moddle', 'elementFactory', 'bpmnjs' ];
22132
+
22133
+
22134
+ // Util
22135
+
22136
+ var findRootDiagram = function(element) {
22137
+ if (is$1(element, 'bpmndi:BPMNDiagram')) {
22138
+ return element;
22139
+ } else {
22140
+ return findRootDiagram(element.$parent);
22141
+ }
22142
+ };
22143
+
22144
+ var css_escape = {exports: {}};
22145
+
22146
+ /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
22147
+
22148
+ (function (module, exports) {
22149
+ (function(root, factory) {
22150
+ // https://github.com/umdjs/umd/blob/master/returnExports.js
22151
+ {
22152
+ // For Node.js.
22153
+ module.exports = factory(root);
22154
+ }
22155
+ }(typeof commonjsGlobal != 'undefined' ? commonjsGlobal : commonjsGlobal, function(root) {
22156
+
22157
+ if (root.CSS && root.CSS.escape) {
22158
+ return root.CSS.escape;
22159
+ }
22160
+
22161
+ // https://drafts.csswg.org/cssom/#serialize-an-identifier
22162
+ var cssEscape = function(value) {
22163
+ if (arguments.length == 0) {
22164
+ throw new TypeError('`CSS.escape` requires an argument.');
22165
+ }
22166
+ var string = String(value);
22167
+ var length = string.length;
22168
+ var index = -1;
22169
+ var codeUnit;
22170
+ var result = '';
22171
+ var firstCodeUnit = string.charCodeAt(0);
22172
+ while (++index < length) {
22173
+ codeUnit = string.charCodeAt(index);
22174
+ // Note: there’s no need to special-case astral symbols, surrogate
22175
+ // pairs, or lone surrogates.
22176
+
22177
+ // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
22178
+ // (U+FFFD).
22179
+ if (codeUnit == 0x0000) {
22180
+ result += '\uFFFD';
22181
+ continue;
22182
+ }
22183
+
22184
+ if (
22185
+ // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
22186
+ // U+007F, […]
22187
+ (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
22188
+ // If the character is the first character and is in the range [0-9]
22189
+ // (U+0030 to U+0039), […]
22190
+ (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
22191
+ // If the character is the second character and is in the range [0-9]
22192
+ // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
22193
+ (
22194
+ index == 1 &&
22195
+ codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
22196
+ firstCodeUnit == 0x002D
22197
+ )
22198
+ ) {
22199
+ // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
22200
+ result += '\\' + codeUnit.toString(16) + ' ';
22201
+ continue;
22202
+ }
22203
+
22204
+ if (
22205
+ // If the character is the first character and is a `-` (U+002D), and
22206
+ // there is no second character, […]
22207
+ index == 0 &&
22208
+ length == 1 &&
22209
+ codeUnit == 0x002D
22210
+ ) {
22211
+ result += '\\' + string.charAt(index);
22212
+ continue;
22213
+ }
22214
+
22215
+ // If the character is not handled by one of the above rules and is
22216
+ // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
22217
+ // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
22218
+ // U+005A), or [a-z] (U+0061 to U+007A), […]
22219
+ if (
22220
+ codeUnit >= 0x0080 ||
22221
+ codeUnit == 0x002D ||
22222
+ codeUnit == 0x005F ||
22223
+ codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
22224
+ codeUnit >= 0x0041 && codeUnit <= 0x005A ||
22225
+ codeUnit >= 0x0061 && codeUnit <= 0x007A
22226
+ ) {
22227
+ // the character itself
22228
+ result += string.charAt(index);
22229
+ continue;
22230
+ }
22231
+
22232
+ // Otherwise, the escaped character.
22233
+ // https://drafts.csswg.org/cssom/#escape-a-character
22234
+ result += '\\' + string.charAt(index);
22235
+
22236
+ }
22237
+ return result;
22238
+ };
22239
+
22240
+ if (!root.CSS) {
22241
+ root.CSS = {};
22242
+ }
22243
+
22244
+ root.CSS.escape = cssEscape;
22245
+ return cssEscape;
22246
+
22247
+ }));
22248
+ }(css_escape));
22249
+
22250
+ var cssEscape = css_escape.exports;
22251
+
22252
+ var HTML_ESCAPE_MAP = {
22253
+ '&': '&amp;',
22254
+ '<': '&lt;',
22255
+ '>': '&gt;',
22256
+ '"': '&quot;',
22257
+ '\'': '&#39;'
22258
+ };
22259
+
22260
+ function escapeHTML(str) {
22261
+ str = '' + str;
22262
+
22263
+ return str && str.replace(/[&<>"']/g, function(match) {
22264
+ return HTML_ESCAPE_MAP[match];
22265
+ });
22266
+ }
22267
+
22268
+ var ARROW_DOWN_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>';
22269
+ var ARROW_UP_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M11.1819805,12.4926407 L5.5003106,6.8103106 L5.5,12 L4,12 L4,4 L12,4 L12,5.5 L6.3103106,5.5003106 L12.2426407,11.4319805 C12.5355339,11.7248737 12.5355339,12.1997475 12.2426407,12.4926407 C11.9497475,12.7855339 11.4748737,12.7855339 11.1819805,12.4926407 Z"/></svg>';
22270
+
22271
+ function SubprocessOverlays(eventBus, elementRegistry, overlays, canvas) {
22272
+
22273
+ function createBreadcrumbs(subProcess) {
22274
+ var breadcrumbs = domify('<ul class="bjs-breadcrumbs"></ul>');
22275
+ var drillUp = domify('<button class="bjs-drilldown">' + ARROW_UP_SVG + '</button>');
22276
+ drillUp.addEventListener('click', function() {
22277
+ var plane = canvas.findPlane(getBusinessObject(subProcess).id);
22278
+ canvas.setActivePlane(plane);
22279
+ });
22280
+
22281
+ breadcrumbs.appendChild(drillUp);
22282
+
22283
+ var parents = getParentChain(subProcess);
22284
+
22285
+ var path = parents.map(function(el) {
22286
+ var title = escapeHTML(el.name) || el.id;
22287
+ var link = domify('<li><span class="bjs-crumb"><a title="' + title + '">' + title + '</a></span></li>');
22288
+
22289
+ link.addEventListener('click', function() {
22290
+ if (canvas.getPlane(el.id)) {
22291
+ canvas.setActivePlane(el.id);
22292
+ } else {
22293
+ var plane = canvas.findPlane(el.id);
22294
+ canvas.setActivePlane(plane);
22295
+ }
22296
+ });
22297
+
22298
+ return link;
22299
+ });
22300
+
22301
+ path.forEach(function(el) {
22302
+ breadcrumbs.appendChild(el);
22303
+ });
22304
+
22305
+ overlays.add(subProcess, {
22306
+ position: {
22307
+ top: -30,
22308
+ left: -10
22309
+ },
22310
+ html: breadcrumbs
22311
+ });
22312
+ }
22313
+
22314
+ var createDrilldown = function(element) {
22315
+ var html = domify('<button class="bjs-drilldown">' + ARROW_DOWN_SVG + '</button>');
22316
+
22317
+ html.addEventListener('click', function() {
22318
+ canvas.setActivePlane(element.id);
22319
+ });
22320
+
22321
+ overlays.add(element, {
22322
+ position: {
22323
+ bottom: -7,
22324
+ right: -8
22325
+ },
22326
+ html: html
22327
+ });
22328
+ };
22329
+
22330
+ var addOverlays = function(elements) {
22331
+ elements.forEach(function(element) {
22332
+ if (is$1(element, 'bpmn:SubProcess')
22333
+ && element.collapsed
22334
+ && canvas.getPlane(element.id)) {
22335
+ createDrilldown(element);
22336
+ }
22337
+
22338
+ if (is$1(element, 'bpmn:SubProcess') && element.isSecondary) {
22339
+ createBreadcrumbs(element);
22340
+ }
22341
+ });
22342
+ };
22343
+
22344
+ eventBus.on('import.done', function() {
22345
+ addOverlays(elementRegistry.filter(function(el) {
22346
+ return is$1(el, 'bpmn:SubProcess');
22347
+ }));
22348
+ });
22349
+ }
22350
+
22351
+ SubprocessOverlays.$inject = [ 'eventBus', 'elementRegistry', 'overlays', 'canvas' ];
22352
+
22353
+
22354
+ var getParentChain = function(child) {
22355
+ var bo = getBusinessObject(child);
22356
+
22357
+ var parents = [];
22358
+
22359
+ for (var element = bo; element; element = element.$parent) {
22360
+ if (is$1(element, 'bpmn:SubProcess') || is$1(element, 'bpmn:Process')) {
22361
+ parents.push(element);
22362
+ }
22363
+ }
22364
+
22365
+ return parents.reverse();
22366
+ };
22367
+
22368
+ var FLOW_LENGTH = 50;
22369
+ var HIGH_RENDER_PRIORITY = 2000;
22370
+
22371
+ function SubprocessFlows(eventBus, config) {
22372
+
22373
+ var mutedStrokeColor = (config && config.mutedStrokeColor) || '#dddddd';
22374
+
22375
+ function drawFakeFlows(element, parentGfx) {
22376
+ var primary = element.primaryShape;
22377
+
22378
+ var drawFakeConnection = function(connection, isOutgoing) {
22379
+
22380
+ var segment;
22381
+ if (isOutgoing) {
22382
+ segment = connection.waypoints.slice(0, 2);
22383
+
22384
+ // Reverse order for normalizing
22385
+ segment = segment.reverse();
22386
+ } else {
22387
+ segment = connection.waypoints.slice(connection.waypoints.length - 2);
22388
+ }
22389
+
22390
+ var endpoint = segment[1];
22391
+
22392
+ var relativePosition = {
22393
+ x: (endpoint.x - primary.x) / primary.width,
22394
+ y: (endpoint.y - primary.y) / primary.height
22395
+ };
22396
+
22397
+ var anchorPoint = {
22398
+ x: endpoint.x - (element.width * relativePosition.x),
22399
+ y: endpoint.y - (element.height * relativePosition.y)
22400
+ };
22401
+
22402
+ var newWaypoints = segment.map(function(el) {
22403
+ return { x: el.x - anchorPoint.x, y: el.y - anchorPoint.y };
22404
+ });
22405
+
22406
+ newWaypoints[0] = normalizeLength(newWaypoints[1], newWaypoints[0], FLOW_LENGTH);
22407
+
22408
+ var attrs = {
22409
+ stroke: mutedStrokeColor
22410
+ };
22411
+
22412
+ if (isOutgoing) {
22413
+
22414
+ // Reverse order again for correct end marker position
22415
+ newWaypoints = newWaypoints.reverse();
22416
+ } else {
22417
+
22418
+ // Remove start marker for incoming flows
22419
+ attrs.markerStart = undefined;
22420
+ }
22421
+
22422
+ eventBus.fire('render.connection', {
22423
+ type: connection.type,
22424
+ gfx: parentGfx,
22425
+ element: {
22426
+ type: connection.type,
22427
+ waypoints: newWaypoints,
22428
+ di: connection.di,
22429
+ businessObject: connection.businessObject
22430
+ },
22431
+ attrs: attrs
22432
+ });
22433
+ };
22434
+
22435
+ primary.incoming && primary.incoming.forEach(function(connection) {
22436
+ drawFakeConnection(connection, false);
22437
+ });
22438
+
22439
+ primary.outgoing && primary.outgoing.forEach(function(connection) {
22440
+ drawFakeConnection(connection, true);
22441
+ });
22442
+ }
22443
+
22444
+ eventBus.on([ 'render.shape' ], HIGH_RENDER_PRIORITY, function(evt, context) {
22445
+ var element = context.element,
22446
+ visuals = context.gfx;
22447
+
22448
+ if (element.isSecondary && element.primaryShape) {
22449
+ drawFakeFlows(element, visuals);
22450
+ }
22451
+
22452
+ });
22453
+
22454
+ }
22455
+
22456
+ SubprocessFlows.$inject = [ 'eventBus', 'config' ];
22457
+
22458
+
22459
+ // helpers
22460
+
22461
+ function normalizeLength(fixedPoint, variablePoint, length) {
22462
+ var dx = fixedPoint.x - variablePoint.x,
22463
+ dy = fixedPoint.y - variablePoint.y,
22464
+ totalDistance = Math.abs(dx) + Math.abs(dy);
22465
+
22466
+ dx = dx / totalDistance;
22467
+ dy = dy / totalDistance;
22468
+
22469
+ dx *= length;
22470
+ dy *= length;
22471
+
22472
+ return {
22473
+ x: fixedPoint.x - dx,
22474
+ y: fixedPoint.y - dy
22475
+ };
22476
+ }
22477
+
22478
+ var SubprocessNavigationModule = {
22479
+ __depends__: [ OverlaysModule, ChangeSupportModule ],
22480
+ __init__: [ 'subprocessElements', 'subprocessOverlays', 'subprocessCompatibility', 'subprocessCentering', 'subprocessFlows' ],
22481
+ subprocessElements: [ 'type', SubprocessElements ],
22482
+ subprocessOverlays: [ 'type', SubprocessOverlays ],
22483
+ subprocessCompatibility: [ 'type', SubprocessCompatibility ],
22484
+ subprocessCentering: [ 'type', SubprocessCentering ],
22485
+ subprocessFlows: ['type', SubprocessFlows]
22486
+ };
22487
+
21680
22488
  /**
21681
22489
  * A viewer for BPMN 2.0 diagrams.
21682
22490
  *
@@ -21735,7 +22543,8 @@
21735
22543
  CoreModule,
21736
22544
  translate,
21737
22545
  SelectionModule,
21738
- OverlaysModule
22546
+ OverlaysModule,
22547
+ SubprocessNavigationModule
21739
22548
  ];
21740
22549
 
21741
22550
  // default moddle extensions the viewer is composed of
@@ -28263,130 +29072,6 @@
28263
29072
  calculateSegmentMoveRegion(segmentLengthYAxis);
28264
29073
  }
28265
29074
 
28266
- var css_escape = {exports: {}};
28267
-
28268
- /*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
28269
-
28270
- (function (module, exports) {
28271
- (function(root, factory) {
28272
- // https://github.com/umdjs/umd/blob/master/returnExports.js
28273
- {
28274
- // For Node.js.
28275
- module.exports = factory(root);
28276
- }
28277
- }(typeof commonjsGlobal != 'undefined' ? commonjsGlobal : commonjsGlobal, function(root) {
28278
-
28279
- if (root.CSS && root.CSS.escape) {
28280
- return root.CSS.escape;
28281
- }
28282
-
28283
- // https://drafts.csswg.org/cssom/#serialize-an-identifier
28284
- var cssEscape = function(value) {
28285
- if (arguments.length == 0) {
28286
- throw new TypeError('`CSS.escape` requires an argument.');
28287
- }
28288
- var string = String(value);
28289
- var length = string.length;
28290
- var index = -1;
28291
- var codeUnit;
28292
- var result = '';
28293
- var firstCodeUnit = string.charCodeAt(0);
28294
- while (++index < length) {
28295
- codeUnit = string.charCodeAt(index);
28296
- // Note: there’s no need to special-case astral symbols, surrogate
28297
- // pairs, or lone surrogates.
28298
-
28299
- // If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
28300
- // (U+FFFD).
28301
- if (codeUnit == 0x0000) {
28302
- result += '\uFFFD';
28303
- continue;
28304
- }
28305
-
28306
- if (
28307
- // If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
28308
- // U+007F, […]
28309
- (codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
28310
- // If the character is the first character and is in the range [0-9]
28311
- // (U+0030 to U+0039), […]
28312
- (index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
28313
- // If the character is the second character and is in the range [0-9]
28314
- // (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
28315
- (
28316
- index == 1 &&
28317
- codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
28318
- firstCodeUnit == 0x002D
28319
- )
28320
- ) {
28321
- // https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
28322
- result += '\\' + codeUnit.toString(16) + ' ';
28323
- continue;
28324
- }
28325
-
28326
- if (
28327
- // If the character is the first character and is a `-` (U+002D), and
28328
- // there is no second character, […]
28329
- index == 0 &&
28330
- length == 1 &&
28331
- codeUnit == 0x002D
28332
- ) {
28333
- result += '\\' + string.charAt(index);
28334
- continue;
28335
- }
28336
-
28337
- // If the character is not handled by one of the above rules and is
28338
- // greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
28339
- // is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
28340
- // U+005A), or [a-z] (U+0061 to U+007A), […]
28341
- if (
28342
- codeUnit >= 0x0080 ||
28343
- codeUnit == 0x002D ||
28344
- codeUnit == 0x005F ||
28345
- codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
28346
- codeUnit >= 0x0041 && codeUnit <= 0x005A ||
28347
- codeUnit >= 0x0061 && codeUnit <= 0x007A
28348
- ) {
28349
- // the character itself
28350
- result += string.charAt(index);
28351
- continue;
28352
- }
28353
-
28354
- // Otherwise, the escaped character.
28355
- // https://drafts.csswg.org/cssom/#escape-a-character
28356
- result += '\\' + string.charAt(index);
28357
-
28358
- }
28359
- return result;
28360
- };
28361
-
28362
- if (!root.CSS) {
28363
- root.CSS = {};
28364
- }
28365
-
28366
- root.CSS.escape = cssEscape;
28367
- return cssEscape;
28368
-
28369
- }));
28370
- }(css_escape));
28371
-
28372
- var cssEscape = css_escape.exports;
28373
-
28374
- var HTML_ESCAPE_MAP = {
28375
- '&': '&amp;',
28376
- '<': '&lt;',
28377
- '>': '&gt;',
28378
- '"': '&quot;',
28379
- '\'': '&#39;'
28380
- };
28381
-
28382
- function escapeHTML(str) {
28383
- str = '' + str;
28384
-
28385
- return str && str.replace(/[&<>"']/g, function(match) {
28386
- return HTML_ESCAPE_MAP[match];
28387
- });
28388
- }
28389
-
28390
29075
  /**
28391
29076
  * A service that adds editable bendpoints to connections.
28392
29077
  */
@@ -33447,23 +34132,13 @@
33447
34132
  element = context.element;
33448
34133
 
33449
34134
  var businessObject = descriptor.oldBusinessObject = getBusinessObject(element);
34135
+ var di = descriptor.oldDi = getDi(element);
33450
34136
 
33451
34137
  descriptor.type = element.type;
33452
34138
 
33453
34139
  copyProperties$1(businessObject, descriptor, 'name');
33454
34140
 
33455
- descriptor.di = {};
33456
-
33457
- // colors will be set to DI
33458
- copyProperties$1(businessObject.di, descriptor.di, [
33459
- 'fill',
33460
- 'stroke',
33461
- 'background-color',
33462
- 'border-color',
33463
- 'color'
33464
- ]);
33465
-
33466
- copyProperties$1(businessObject.di, descriptor, 'isExpanded');
34141
+ copyProperties$1(di, descriptor, 'isExpanded');
33467
34142
 
33468
34143
  if (isLabel$3(descriptor)) {
33469
34144
  return descriptor;
@@ -33537,11 +34212,13 @@
33537
34212
  var cache = context.cache,
33538
34213
  descriptor = context.descriptor,
33539
34214
  oldBusinessObject = descriptor.oldBusinessObject,
33540
- newBusinessObject;
34215
+ oldDi = descriptor.oldDi,
34216
+ newBusinessObject, newDi;
33541
34217
 
33542
34218
  // do NOT copy business object if external label
33543
34219
  if (isLabel$3(descriptor)) {
33544
34220
  descriptor.businessObject = getBusinessObject(cache[ descriptor.labelTarget ]);
34221
+ descriptor.di = getDi(cache[ descriptor.labelTarget ]);
33545
34222
 
33546
34223
  return;
33547
34224
  }
@@ -33553,6 +34230,13 @@
33553
34230
  newBusinessObject
33554
34231
  );
33555
34232
 
34233
+ newDi = bpmnFactory.create(oldDi.$type);
34234
+
34235
+ descriptor.di = moddleCopy.copyElement(
34236
+ oldDi,
34237
+ newDi
34238
+ );
34239
+
33556
34240
  // resolve references e.g. default sequence flow
33557
34241
  resolveReferences(descriptor, cache);
33558
34242
 
@@ -33784,11 +34468,16 @@
33784
34468
 
33785
34469
  var propertyDescriptor = this._moddle.getPropertyDescriptor(parent, propertyName);
33786
34470
 
33787
- // do NOT copy Ids and references
33788
- if (propertyDescriptor.isId || propertyDescriptor.isReference) {
34471
+ // do NOT copy references
34472
+ if (propertyDescriptor.isReference) {
33789
34473
  return;
33790
34474
  }
33791
34475
 
34476
+ // copy id
34477
+ if (propertyDescriptor.isId) {
34478
+ return this._copyId(property, parent);
34479
+ }
34480
+
33792
34481
  // copy arrays
33793
34482
  if (isArray$2(property)) {
33794
34483
  return reduce(property, function(childProperties, childProperty) {
@@ -33827,6 +34516,18 @@
33827
34516
  return property;
33828
34517
  };
33829
34518
 
34519
+ ModdleCopy.prototype._copyId = function(id, element) {
34520
+
34521
+ // disallow if already taken
34522
+ if (this._moddle.ids.assigned(id)) {
34523
+ return;
34524
+ } else {
34525
+
34526
+ this._moddle.ids.claim(id, element);
34527
+ return id;
34528
+ }
34529
+ };
34530
+
33830
34531
  // helpers //////////
33831
34532
 
33832
34533
  function getPropertyNames(descriptor, keepDefaultProperties) {
@@ -33927,6 +34628,7 @@
33927
34628
  });
33928
34629
  }
33929
34630
 
34631
+
33930
34632
  var CUSTOM_PROPERTIES = [
33931
34633
  'cancelActivity',
33932
34634
  'instantiate',
@@ -33935,8 +34637,10 @@
33935
34637
  'isInterrupting'
33936
34638
  ];
33937
34639
 
33938
-
33939
- function toggeling(element, target) {
34640
+ /**
34641
+ * Check if element should be collapsed or expanded.
34642
+ */
34643
+ function shouldToggleCollapsed(element, targetElement) {
33940
34644
 
33941
34645
  var oldCollapsed = (
33942
34646
  element && has(element, 'collapsed') ? element.collapsed : !isExpanded(element)
@@ -33944,11 +34648,11 @@
33944
34648
 
33945
34649
  var targetCollapsed;
33946
34650
 
33947
- if (target && (has(target, 'collapsed') || has(target, 'isExpanded'))) {
34651
+ if (targetElement && (has(targetElement, 'collapsed') || has(targetElement, 'isExpanded'))) {
33948
34652
 
33949
34653
  // property is explicitly set so use it
33950
34654
  targetCollapsed = (
33951
- has(target, 'collapsed') ? target.collapsed : !target.isExpanded
34655
+ has(targetElement, 'collapsed') ? targetElement.collapsed : !targetElement.isExpanded
33952
34656
  );
33953
34657
  } else {
33954
34658
 
@@ -33957,7 +34661,6 @@
33957
34661
  }
33958
34662
 
33959
34663
  if (oldCollapsed !== targetCollapsed) {
33960
- element.collapsed = oldCollapsed;
33961
34664
  return true;
33962
34665
  }
33963
34666
 
@@ -33965,7 +34668,6 @@
33965
34668
  }
33966
34669
 
33967
34670
 
33968
-
33969
34671
  /**
33970
34672
  * This module takes care of replacing BPMN elements
33971
34673
  */
@@ -33996,15 +34698,13 @@
33996
34698
  var type = target.type,
33997
34699
  oldBusinessObject = element.businessObject;
33998
34700
 
33999
- if (isSubProcess(oldBusinessObject)) {
34000
- if (type === 'bpmn:SubProcess') {
34001
- if (toggeling(element, target)) {
34701
+ if (isSubProcess(oldBusinessObject) && type === 'bpmn:SubProcess') {
34702
+ if (shouldToggleCollapsed(element, target)) {
34002
34703
 
34003
- // expanding or collapsing process
34004
- modeling.toggleCollapse(element);
34704
+ // expanding or collapsing process
34705
+ modeling.toggleCollapse(element);
34005
34706
 
34006
- return element;
34007
- }
34707
+ return element;
34008
34708
  }
34009
34709
  }
34010
34710
 
@@ -34012,9 +34712,20 @@
34012
34712
 
34013
34713
  var newElement = {
34014
34714
  type: type,
34015
- businessObject: newBusinessObject
34715
+ businessObject: newBusinessObject,
34016
34716
  };
34017
34717
 
34718
+ newElement.di = {};
34719
+
34720
+ // colors will be set to DI
34721
+ copyProperties(element.di, newElement.di, [
34722
+ 'fill',
34723
+ 'stroke',
34724
+ 'background-color',
34725
+ 'border-color',
34726
+ 'color'
34727
+ ]);
34728
+
34018
34729
  var elementProps = getPropertyNames(oldBusinessObject.$descriptor),
34019
34730
  newElementProps = getPropertyNames(newBusinessObject.$descriptor, true),
34020
34731
  copyProps = intersection(elementProps, newElementProps);
@@ -34074,7 +34785,7 @@
34074
34785
  if (isSubProcess(oldBusinessObject)) {
34075
34786
 
34076
34787
  // no toggeling, so keep old state
34077
- newElement.isExpanded = isExpanded(oldBusinessObject);
34788
+ newElement.isExpanded = isExpanded(element);
34078
34789
  }
34079
34790
 
34080
34791
  // else if property is explicitly set, use it
@@ -34085,7 +34796,7 @@
34085
34796
  // TODO: need also to respect min/max Size
34086
34797
  // copy size, from an expanded subprocess to an expanded alternative subprocess
34087
34798
  // except bpmn:Task, because Task is always expanded
34088
- if ((isExpanded(oldBusinessObject) && !is$1(oldBusinessObject, 'bpmn:Task')) && newElement.isExpanded) {
34799
+ if ((isExpanded(element) && !is$1(oldBusinessObject, 'bpmn:Task')) && newElement.isExpanded) {
34089
34800
  newElement.width = element.width;
34090
34801
  newElement.height = element.height;
34091
34802
  }
@@ -34110,12 +34821,12 @@
34110
34821
 
34111
34822
  // apply same width and default height
34112
34823
  newElement.width = element.width;
34113
- newElement.height = elementFactory._getDefaultSize(newBusinessObject).height;
34824
+ newElement.height = elementFactory.getDefaultSize(newElement).height;
34114
34825
  }
34115
34826
 
34116
34827
  if (!rules.allowed('shape.resize', { shape: newBusinessObject })) {
34117
- newElement.height = elementFactory._getDefaultSize(newBusinessObject).height;
34118
- newElement.width = elementFactory._getDefaultSize(newBusinessObject).width;
34828
+ newElement.height = elementFactory.getDefaultSize(newElement).height;
34829
+ newElement.width = elementFactory.getDefaultSize(newElement).width;
34119
34830
  }
34120
34831
 
34121
34832
  newBusinessObject.name = oldBusinessObject.name;
@@ -34153,16 +34864,6 @@
34153
34864
  newElement.x = element.x + (element.width - newElement.width) / 2;
34154
34865
  }
34155
34866
 
34156
- newElement.di = {};
34157
-
34158
- // colors will be set to DI
34159
- copyProperties(oldBusinessObject.di, newElement.di, [
34160
- 'fill',
34161
- 'stroke',
34162
- 'background-color',
34163
- 'border-color',
34164
- 'color'
34165
- ]);
34166
34867
 
34167
34868
  newElement = replace.replaceElement(element, newElement, hints);
34168
34869
 
@@ -34247,7 +34948,7 @@
34247
34948
 
34248
34949
  var isExpandedEqual = (
34249
34950
  target.isExpanded === undefined ||
34250
- target.isExpanded === isExpanded(businessObject)
34951
+ target.isExpanded === isExpanded(element)
34251
34952
  );
34252
34953
 
34253
34954
  return !isTypeEqual || !isEventDefinitionEqual || !isTriggeredByEventEqual || !isExpandedEqual;
@@ -35184,7 +35885,7 @@
35184
35885
  if (is$1(businessObject, 'bpmn:Participant')) {
35185
35886
 
35186
35887
  entries = filter(PARTICIPANT, function(entry) {
35187
- return isExpanded(businessObject) !== entry.target.isExpanded;
35888
+ return isExpanded(element) !== entry.target.isExpanded;
35188
35889
  });
35189
35890
 
35190
35891
  return this._createEntries(element, entries);
@@ -35280,7 +35981,7 @@
35280
35981
  }
35281
35982
 
35282
35983
  // expanded event sub processes
35283
- if (isEventSubProcess(businessObject) && isExpanded(businessObject)) {
35984
+ if (isEventSubProcess(businessObject) && isExpanded(element)) {
35284
35985
 
35285
35986
  entries = filter(EVENT_SUB_PROCESS, differentType);
35286
35987
 
@@ -35288,7 +35989,7 @@
35288
35989
  }
35289
35990
 
35290
35991
  // expanded sub processes
35291
- if (is$1(businessObject, 'bpmn:SubProcess') && isExpanded(businessObject)) {
35992
+ if (is$1(businessObject, 'bpmn:SubProcess') && isExpanded(element)) {
35292
35993
 
35293
35994
  entries = filter(SUBPROCESS_EXPANDED, differentType);
35294
35995
 
@@ -35296,7 +35997,7 @@
35296
35997
  }
35297
35998
 
35298
35999
  // collapsed ad hoc sub processes
35299
- if (is$1(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(businessObject)) {
36000
+ if (is$1(businessObject, 'bpmn:AdHocSubProcess') && !isExpanded(element)) {
35300
36001
 
35301
36002
  entries = filter(TASK, function(entry) {
35302
36003
 
@@ -35322,7 +36023,7 @@
35322
36023
  entries = filter(TASK, differentType);
35323
36024
 
35324
36025
  // collapsed SubProcess can not be replaced with itself
35325
- if (is$1(businessObject, 'bpmn:SubProcess') && !isExpanded(businessObject)) {
36026
+ if (is$1(businessObject, 'bpmn:SubProcess') && !isExpanded(element)) {
35326
36027
  entries = filter(entries, function(entry) {
35327
36028
  return entry.label !== 'Sub Process (collapsed)';
35328
36029
  });
@@ -36228,7 +36929,7 @@
36228
36929
  }
36229
36930
 
36230
36931
 
36231
- if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(businessObject)) {
36932
+ if (isAny(businessObject, [ 'bpmn:Lane', 'bpmn:Participant' ]) && isExpanded(element)) {
36232
36933
 
36233
36934
  var childLanes = getChildLanes(element);
36234
36935
 
@@ -38455,75 +39156,6 @@
38455
39156
  keyboardMoveSelection: [ 'type', KeyboardMoveSelection ]
38456
39157
  };
38457
39158
 
38458
- /**
38459
- * Adds change support to the diagram, including
38460
- *
38461
- * <ul>
38462
- * <li>redrawing shapes and connections on change</li>
38463
- * </ul>
38464
- *
38465
- * @param {EventBus} eventBus
38466
- * @param {Canvas} canvas
38467
- * @param {ElementRegistry} elementRegistry
38468
- * @param {GraphicsFactory} graphicsFactory
38469
- */
38470
- function ChangeSupport(
38471
- eventBus, canvas, elementRegistry,
38472
- graphicsFactory) {
38473
-
38474
-
38475
- // redraw shapes / connections on change
38476
-
38477
- eventBus.on('element.changed', function(event) {
38478
-
38479
- var element = event.element;
38480
-
38481
- // element might have been deleted and replaced by new element with same ID
38482
- // thus check for parent of element except for root element
38483
- if (element.parent || element === canvas.getRootElement()) {
38484
- event.gfx = elementRegistry.getGraphics(element);
38485
- }
38486
-
38487
- // shape + gfx may have been deleted
38488
- if (!event.gfx) {
38489
- return;
38490
- }
38491
-
38492
- eventBus.fire(getType(element) + '.changed', event);
38493
- });
38494
-
38495
- eventBus.on('elements.changed', function(event) {
38496
-
38497
- var elements = event.elements;
38498
-
38499
- elements.forEach(function(e) {
38500
- eventBus.fire('element.changed', { element: e });
38501
- });
38502
-
38503
- graphicsFactory.updateContainments(elements);
38504
- });
38505
-
38506
- eventBus.on('shape.changed', function(event) {
38507
- graphicsFactory.update('shape', event.element, event.gfx);
38508
- });
38509
-
38510
- eventBus.on('connection.changed', function(event) {
38511
- graphicsFactory.update('connection', event.element, event.gfx);
38512
- });
38513
- }
38514
-
38515
- ChangeSupport.$inject = [
38516
- 'eventBus',
38517
- 'canvas',
38518
- 'elementRegistry',
38519
- 'graphicsFactory'
38520
- ];
38521
-
38522
- var ChangeSupportModule = {
38523
- __init__: [ 'changeSupport'],
38524
- changeSupport: [ 'type', ChangeSupport ]
38525
- };
38526
-
38527
39159
  var DEFAULT_MIN_WIDTH = 10;
38528
39160
 
38529
39161
 
@@ -39615,9 +40247,9 @@
39615
40247
  // helpers ///////////////////
39616
40248
 
39617
40249
  function getStrokeColor(element, defaultColor) {
39618
- var bo = getBusinessObject(element);
40250
+ var di = getDi(element);
39619
40251
 
39620
- return bo.di.get('stroke') || defaultColor || 'black';
40252
+ return di.get('stroke') || defaultColor || 'black';
39621
40253
  }
39622
40254
 
39623
40255
  var LabelEditingModule = {
@@ -40828,21 +41460,23 @@
40828
41460
 
40829
41461
  UpdateSemanticParentHandler.prototype.execute = function(context) {
40830
41462
  var dataStoreBo = context.dataStoreBo,
41463
+ dataStoreDi = context.dataStoreDi,
40831
41464
  newSemanticParent = context.newSemanticParent,
40832
41465
  newDiParent = context.newDiParent;
40833
41466
 
40834
41467
  context.oldSemanticParent = dataStoreBo.$parent;
40835
- context.oldDiParent = dataStoreBo.di.$parent;
41468
+ context.oldDiParent = dataStoreDi.$parent;
40836
41469
 
40837
41470
  // update semantic parent
40838
41471
  this._bpmnUpdater.updateSemanticParent(dataStoreBo, newSemanticParent);
40839
41472
 
40840
41473
  // update DI parent
40841
- this._bpmnUpdater.updateDiParent(dataStoreBo.di, newDiParent);
41474
+ this._bpmnUpdater.updateDiParent(dataStoreDi, newDiParent);
40842
41475
  };
40843
41476
 
40844
41477
  UpdateSemanticParentHandler.prototype.revert = function(context) {
40845
41478
  var dataStoreBo = context.dataStoreBo,
41479
+ dataStoreDi = context.dataStoreDi,
40846
41480
  oldSemanticParent = context.oldSemanticParent,
40847
41481
  oldDiParent = context.oldDiParent;
40848
41482
 
@@ -40850,7 +41484,7 @@
40850
41484
  this._bpmnUpdater.updateSemanticParent(dataStoreBo, oldSemanticParent);
40851
41485
 
40852
41486
  // update DI parent
40853
- this._bpmnUpdater.updateDiParent(dataStoreBo.di, oldDiParent);
41487
+ this._bpmnUpdater.updateDiParent(dataStoreDi, oldDiParent);
40854
41488
  };
40855
41489
 
40856
41490
  /**
@@ -40886,8 +41520,9 @@
40886
41520
 
40887
41521
  commandStack.execute('dataStore.updateContainment', {
40888
41522
  dataStoreBo: dataStoreBo,
41523
+ dataStoreDi: getDi(dataStore),
40889
41524
  newSemanticParent: newDataStoreParentBo.processRef || newDataStoreParentBo,
40890
- newDiParent: newDataStoreParentBo.di
41525
+ newDiParent: getDi(newDataStoreParent)
40891
41526
  });
40892
41527
  }
40893
41528
  }
@@ -41827,12 +42462,14 @@
41827
42462
  ];
41828
42463
 
41829
42464
  this.executed([ 'shape.move', 'shape.create', 'shape.resize' ], function(event) {
41830
- var bo = getBusinessObject(event.context.shape);
42465
+ var shape = event.context.shape,
42466
+ bo = getBusinessObject(shape),
42467
+ di = getDi(shape);
41831
42468
 
41832
- if (isAny(bo, elementTypesToUpdate) && !bo.di.get('isHorizontal')) {
42469
+ if (isAny(bo, elementTypesToUpdate) && !di.get('isHorizontal')) {
41833
42470
 
41834
42471
  // set attribute directly to avoid modeling#updateProperty side effects
41835
- bo.di.set('isHorizontal', true);
42472
+ di.set('isHorizontal', true);
41836
42473
  }
41837
42474
  });
41838
42475
 
@@ -42638,27 +43275,27 @@
42638
43275
 
42639
43276
  var context = event.context,
42640
43277
  element = context.shape,
42641
- businessObject,
43278
+ labelTarget = context.labelTarget,
42642
43279
  di;
42643
43280
 
42644
43281
  // we want to trigger on real labels only
42645
- if (!element.labelTarget) {
43282
+ if (!labelTarget) {
42646
43283
  return;
42647
43284
  }
42648
43285
 
42649
43286
  // we want to trigger on BPMN elements only
42650
- if (!is$1(element.labelTarget || element, 'bpmn:BaseElement')) {
43287
+ if (!is$1(labelTarget, 'bpmn:BaseElement')) {
42651
43288
  return;
42652
43289
  }
42653
43290
 
42654
- businessObject = element.businessObject,
42655
- di = businessObject.di;
42656
-
43291
+ di = getDi(labelTarget);
42657
43292
 
42658
43293
  if (!di.label) {
42659
43294
  di.label = bpmnFactory.create('bpmndi:BPMNLabel', {
42660
43295
  bounds: bpmnFactory.create('dc:Bounds')
42661
43296
  });
43297
+
43298
+ element.di = di;
42662
43299
  }
42663
43300
 
42664
43301
  assign(di.label.bounds, {
@@ -43428,6 +44065,49 @@
43428
44065
  'selection'
43429
44066
  ];
43430
44067
 
44068
+ var HIGH_PRIORITY$8 = 1500;
44069
+
44070
+ var LANE_MIN_DIMENSIONS = { width: 300, height: 60 };
44071
+
44072
+ var PARTICIPANT_MIN_DIMENSIONS = { width: 300, height: 150 };
44073
+
44074
+ var SUB_PROCESS_MIN_DIMENSIONS = { width: 140, height: 120 };
44075
+
44076
+ var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 50, height: 30 };
44077
+
44078
+ /**
44079
+ * Set minimum bounds/resize constraints on resize.
44080
+ *
44081
+ * @param {EventBus} eventBus
44082
+ */
44083
+ function ResizeBehavior(eventBus) {
44084
+ eventBus.on('resize.start', HIGH_PRIORITY$8, function(event) {
44085
+ var context = event.context,
44086
+ shape = context.shape,
44087
+ direction = context.direction,
44088
+ balanced = context.balanced;
44089
+
44090
+ if (is$1(shape, 'bpmn:Lane') || is$1(shape, 'bpmn:Participant')) {
44091
+ context.resizeConstraints = getParticipantResizeConstraints(shape, direction, balanced);
44092
+ }
44093
+
44094
+ if (is$1(shape, 'bpmn:Participant')) {
44095
+ context.minDimensions = PARTICIPANT_MIN_DIMENSIONS;
44096
+ }
44097
+
44098
+ if (is$1(shape, 'bpmn:SubProcess') && isExpanded(shape)) {
44099
+ context.minDimensions = SUB_PROCESS_MIN_DIMENSIONS;
44100
+ }
44101
+
44102
+ if (is$1(shape, 'bpmn:TextAnnotation')) {
44103
+ context.minDimensions = TEXT_ANNOTATION_MIN_DIMENSIONS;
44104
+ }
44105
+ });
44106
+ }
44107
+
44108
+ ResizeBehavior.$inject = [ 'eventBus' ];
44109
+
44110
+
43431
44111
  var abs$2 = Math.abs,
43432
44112
  min = Math.min,
43433
44113
  max$2 = Math.max;
@@ -43455,7 +44135,6 @@
43455
44135
  LANE_TOP_PADDING = 20,
43456
44136
  LANE_BOTTOM_PADDING = 20;
43457
44137
 
43458
-
43459
44138
  function getParticipantResizeConstraints(laneShape, resizeDirection, balanced) {
43460
44139
  var lanesRoot = getLanesRoot(laneShape);
43461
44140
 
@@ -43548,49 +44227,6 @@
43548
44227
  };
43549
44228
  }
43550
44229
 
43551
- var HIGH_PRIORITY$8 = 1500;
43552
-
43553
- var LANE_MIN_DIMENSIONS = { width: 300, height: 60 };
43554
-
43555
- var PARTICIPANT_MIN_DIMENSIONS = { width: 300, height: 150 };
43556
-
43557
- var SUB_PROCESS_MIN_DIMENSIONS = { width: 140, height: 120 };
43558
-
43559
- var TEXT_ANNOTATION_MIN_DIMENSIONS = { width: 50, height: 30 };
43560
-
43561
-
43562
- /**
43563
- * Set minimum bounds/resize constraints on resize.
43564
- *
43565
- * @param {EventBus} eventBus
43566
- */
43567
- function ResizeBehavior(eventBus) {
43568
- eventBus.on('resize.start', HIGH_PRIORITY$8, function(event) {
43569
- var context = event.context,
43570
- shape = context.shape,
43571
- direction = context.direction,
43572
- balanced = context.balanced;
43573
-
43574
- if (is$1(shape, 'bpmn:Lane') || is$1(shape, 'bpmn:Participant')) {
43575
- context.resizeConstraints = getParticipantResizeConstraints(shape, direction, balanced);
43576
- }
43577
-
43578
- if (is$1(shape, 'bpmn:Participant')) {
43579
- context.minDimensions = PARTICIPANT_MIN_DIMENSIONS;
43580
- }
43581
-
43582
- if (is$1(shape, 'bpmn:SubProcess') && isExpanded(shape)) {
43583
- context.minDimensions = SUB_PROCESS_MIN_DIMENSIONS;
43584
- }
43585
-
43586
- if (is$1(shape, 'bpmn:TextAnnotation')) {
43587
- context.minDimensions = TEXT_ANNOTATION_MIN_DIMENSIONS;
43588
- }
43589
- });
43590
- }
43591
-
43592
- ResizeBehavior.$inject = [ 'eventBus' ];
43593
-
43594
44230
  var SLIGHTLY_HIGHER_PRIORITY = 1001;
43595
44231
 
43596
44232
 
@@ -43945,11 +44581,11 @@
43945
44581
  hideEmptyLabels(shape.children);
43946
44582
 
43947
44583
  // remove collapsed marker
43948
- getBusinessObject(shape).di.isExpanded = true;
44584
+ getDi(shape).isExpanded = true;
43949
44585
  } else {
43950
44586
 
43951
44587
  // place collapsed marker
43952
- getBusinessObject(shape).di.isExpanded = false;
44588
+ getDi(shape).isExpanded = false;
43953
44589
  }
43954
44590
  });
43955
44591
 
@@ -43961,16 +44597,16 @@
43961
44597
 
43962
44598
  // revert removing/placing collapsed marker
43963
44599
  if (!shape.collapsed) {
43964
- getBusinessObject(shape).di.isExpanded = true;
44600
+ getDi(shape).isExpanded = true;
43965
44601
 
43966
44602
  } else {
43967
- getBusinessObject(shape).di.isExpanded = false;
44603
+ getDi(shape).isExpanded = false;
43968
44604
  }
43969
44605
  });
43970
44606
 
43971
44607
  this.postExecuted([ 'shape.toggleCollapse' ], LOW_PRIORITY$8, function(e) {
43972
44608
  var shape = e.context.shape,
43973
- defaultSize = elementFactory._getDefaultSize(shape),
44609
+ defaultSize = elementFactory.getDefaultSize(shape),
43974
44610
  newBounds;
43975
44611
 
43976
44612
  if (shape.collapsed) {
@@ -45276,7 +45912,7 @@
45276
45912
 
45277
45913
  function orderDi() {
45278
45914
  var root = canvas.getRootElement(),
45279
- rootDi = getBusinessObject(root).di,
45915
+ rootDi = getDi(root),
45280
45916
  elements,
45281
45917
  diElements;
45282
45918
 
@@ -48037,11 +48673,10 @@
48037
48673
  };
48038
48674
 
48039
48675
 
48040
- BpmnFactory.prototype.createDiShape = function(semantic, bounds, attrs) {
48041
-
48676
+ BpmnFactory.prototype.createDiShape = function(semantic, attrs) {
48042
48677
  return this.create('bpmndi:BPMNShape', assign({
48043
48678
  bpmnElement: semantic,
48044
- bounds: this.createDiBounds(bounds)
48679
+ bounds: this.createDiBounds()
48045
48680
  }, attrs));
48046
48681
  };
48047
48682
 
@@ -48064,16 +48699,17 @@
48064
48699
  };
48065
48700
 
48066
48701
 
48067
- BpmnFactory.prototype.createDiEdge = function(semantic, waypoints, attrs) {
48702
+ BpmnFactory.prototype.createDiEdge = function(semantic, attrs) {
48068
48703
  return this.create('bpmndi:BPMNEdge', assign({
48069
- bpmnElement: semantic
48704
+ bpmnElement: semantic,
48705
+ waypoints: this.createDiWaypoints([])
48070
48706
  }, attrs));
48071
48707
  };
48072
48708
 
48073
- BpmnFactory.prototype.createDiPlane = function(semantic) {
48074
- return this.create('bpmndi:BPMNPlane', {
48709
+ BpmnFactory.prototype.createDiPlane = function(semantic, attrs) {
48710
+ return this.create('bpmndi:BPMNPlane', assign({
48075
48711
  bpmnElement: semantic
48076
- });
48712
+ }, attrs));
48077
48713
  };
48078
48714
 
48079
48715
  /**
@@ -48358,8 +48994,9 @@
48358
48994
  var parentShape = element.parent;
48359
48995
 
48360
48996
  var businessObject = element.businessObject,
48997
+ di = getDi(element),
48361
48998
  parentBusinessObject = parentShape && parentShape.businessObject,
48362
- parentDi = parentBusinessObject && parentBusinessObject.di;
48999
+ parentDi = getDi(parentShape);
48363
49000
 
48364
49001
  if (is$1(element, 'bpmn:FlowNode')) {
48365
49002
  this.updateFlowNodeRefs(businessObject, parentBusinessObject, oldParent && oldParent.businessObject);
@@ -48387,13 +49024,13 @@
48387
49024
  this.updateSemanticParent(businessObject.dataObjectRef, parentBusinessObject);
48388
49025
  }
48389
49026
 
48390
- this.updateDiParent(businessObject.di, parentDi);
49027
+ this.updateDiParent(di, parentDi);
48391
49028
  };
48392
49029
 
48393
49030
 
48394
49031
  BpmnUpdater.prototype.updateBounds = function(shape) {
48395
49032
 
48396
- var di = shape.businessObject.di;
49033
+ var di = getDi(shape);
48397
49034
 
48398
49035
  var target = (shape instanceof Label) ? this._getLabel(di) : di;
48399
49036
 
@@ -48433,14 +49070,17 @@
48433
49070
 
48434
49071
 
48435
49072
  // update existing sourceElement and targetElement di information
48436
- BpmnUpdater.prototype.updateDiConnection = function(di, newSource, newTarget) {
49073
+ BpmnUpdater.prototype.updateDiConnection = function(connection, newSource, newTarget) {
49074
+ var connectionDi = getDi(connection),
49075
+ newSourceDi = getDi(newSource),
49076
+ newTargetDi = getDi(newTarget);
48437
49077
 
48438
- if (di.sourceElement && di.sourceElement.bpmnElement !== newSource) {
48439
- di.sourceElement = newSource && newSource.di;
49078
+ if (connectionDi.sourceElement && connectionDi.sourceElement.bpmnElement !== getBusinessObject(newSource)) {
49079
+ connectionDi.sourceElement = newSource && newSourceDi;
48440
49080
  }
48441
49081
 
48442
- if (di.targetElement && di.targetElement.bpmnElement !== newTarget) {
48443
- di.targetElement = newTarget && newTarget.di;
49082
+ if (connectionDi.targetElement && connectionDi.targetElement.bpmnElement !== getBusinessObject(newTarget)) {
49083
+ connectionDi.targetElement = newTarget && newTargetDi;
48444
49084
  }
48445
49085
 
48446
49086
  };
@@ -48665,69 +49305,72 @@
48665
49305
 
48666
49306
 
48667
49307
  BpmnUpdater.prototype.updateConnectionWaypoints = function(connection) {
48668
- connection.businessObject.di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
49308
+ var di = getDi(connection);
49309
+
49310
+ di.set('waypoint', this._bpmnFactory.createDiWaypoints(connection.waypoints));
48669
49311
  };
48670
49312
 
48671
49313
 
48672
49314
  BpmnUpdater.prototype.updateConnection = function(context) {
48673
-
48674
49315
  var connection = context.connection,
48675
49316
  businessObject = getBusinessObject(connection),
48676
- newSource = getBusinessObject(connection.source),
48677
- newTarget = getBusinessObject(connection.target),
49317
+ newSource = connection.source,
49318
+ newSourceBo = getBusinessObject(newSource),
49319
+ newTarget = connection.target,
49320
+ newTargetBo = getBusinessObject(connection.target),
48678
49321
  visualParent;
48679
49322
 
48680
49323
  if (!is$1(businessObject, 'bpmn:DataAssociation')) {
48681
49324
 
48682
49325
  var inverseSet = is$1(businessObject, 'bpmn:SequenceFlow');
48683
49326
 
48684
- if (businessObject.sourceRef !== newSource) {
49327
+ if (businessObject.sourceRef !== newSourceBo) {
48685
49328
  if (inverseSet) {
48686
49329
  remove(businessObject.sourceRef && businessObject.sourceRef.get('outgoing'), businessObject);
48687
49330
 
48688
- if (newSource && newSource.get('outgoing')) {
48689
- newSource.get('outgoing').push(businessObject);
49331
+ if (newSourceBo && newSourceBo.get('outgoing')) {
49332
+ newSourceBo.get('outgoing').push(businessObject);
48690
49333
  }
48691
49334
  }
48692
49335
 
48693
- businessObject.sourceRef = newSource;
49336
+ businessObject.sourceRef = newSourceBo;
48694
49337
  }
48695
49338
 
48696
- if (businessObject.targetRef !== newTarget) {
49339
+ if (businessObject.targetRef !== newTargetBo) {
48697
49340
  if (inverseSet) {
48698
49341
  remove(businessObject.targetRef && businessObject.targetRef.get('incoming'), businessObject);
48699
49342
 
48700
- if (newTarget && newTarget.get('incoming')) {
48701
- newTarget.get('incoming').push(businessObject);
49343
+ if (newTargetBo && newTargetBo.get('incoming')) {
49344
+ newTargetBo.get('incoming').push(businessObject);
48702
49345
  }
48703
49346
  }
48704
49347
 
48705
- businessObject.targetRef = newTarget;
49348
+ businessObject.targetRef = newTargetBo;
48706
49349
  }
48707
49350
  } else
48708
49351
 
48709
49352
  if (is$1(businessObject, 'bpmn:DataInputAssociation')) {
48710
49353
 
48711
49354
  // handle obnoxious isMsome sourceRef
48712
- businessObject.get('sourceRef')[0] = newSource;
49355
+ businessObject.get('sourceRef')[0] = newSourceBo;
48713
49356
 
48714
- visualParent = context.parent || context.newParent || newTarget;
49357
+ visualParent = context.parent || context.newParent || newTargetBo;
48715
49358
 
48716
- this.updateSemanticParent(businessObject, newTarget, visualParent);
49359
+ this.updateSemanticParent(businessObject, newTargetBo, visualParent);
48717
49360
  } else
48718
49361
 
48719
49362
  if (is$1(businessObject, 'bpmn:DataOutputAssociation')) {
48720
- visualParent = context.parent || context.newParent || newSource;
49363
+ visualParent = context.parent || context.newParent || newSourceBo;
48721
49364
 
48722
- this.updateSemanticParent(businessObject, newSource, visualParent);
49365
+ this.updateSemanticParent(businessObject, newSourceBo, visualParent);
48723
49366
 
48724
49367
  // targetRef = new target
48725
- businessObject.targetRef = newTarget;
49368
+ businessObject.targetRef = newTargetBo;
48726
49369
  }
48727
49370
 
48728
49371
  this.updateConnectionWaypoints(connection);
48729
49372
 
48730
- this.updateDiConnection(businessObject.di, newSource, newTarget);
49373
+ this.updateDiConnection(connection, newSource, newTarget);
48731
49374
  };
48732
49375
 
48733
49376
 
@@ -48789,7 +49432,8 @@
48789
49432
  // we assume their businessObjects have already been created
48790
49433
  // and wired via attrs
48791
49434
  if (elementType === 'label') {
48792
- return this.baseCreate(elementType, assign({ type: 'label' }, DEFAULT_LABEL_SIZE, attrs));
49435
+ var di = attrs.di || this._bpmnFactory.createDiLabel();
49436
+ return this.baseCreate(elementType, assign({ type: 'label', di: di }, DEFAULT_LABEL_SIZE, attrs));
48793
49437
  }
48794
49438
 
48795
49439
  return this.createBpmnElement(elementType, attrs);
@@ -48801,7 +49445,8 @@
48801
49445
 
48802
49446
  attrs = attrs || {};
48803
49447
 
48804
- var businessObject = attrs.businessObject;
49448
+ var businessObject = attrs.businessObject,
49449
+ di = attrs.di;
48805
49450
 
48806
49451
  if (!businessObject) {
48807
49452
  if (!attrs.type) {
@@ -48809,22 +49454,23 @@
48809
49454
  }
48810
49455
 
48811
49456
  businessObject = this._bpmnFactory.create(attrs.type);
49457
+
49458
+ ensureCompatDiRef(businessObject);
48812
49459
  }
48813
49460
 
48814
- if (!businessObject.di) {
49461
+ if (!isModdleDi(di)) {
49462
+ var diAttrs = assign(
49463
+ di || {},
49464
+ { id: businessObject.id + '_di' }
49465
+ );
49466
+
48815
49467
  if (elementType === 'root') {
48816
- businessObject.di = this._bpmnFactory.createDiPlane(businessObject, [], {
48817
- id: businessObject.id + '_di'
48818
- });
49468
+ di = this._bpmnFactory.createDiPlane(businessObject, diAttrs);
48819
49469
  } else
48820
49470
  if (elementType === 'connection') {
48821
- businessObject.di = this._bpmnFactory.createDiEdge(businessObject, [], {
48822
- id: businessObject.id + '_di'
48823
- });
49471
+ di = this._bpmnFactory.createDiEdge(businessObject, diAttrs);
48824
49472
  } else {
48825
- businessObject.di = this._bpmnFactory.createDiShape(businessObject, {}, {
48826
- id: businessObject.id + '_di'
48827
- });
49473
+ di = this._bpmnFactory.createDiShape(businessObject, diAttrs);
48828
49474
  }
48829
49475
  }
48830
49476
 
@@ -48834,12 +49480,6 @@
48834
49480
  }, attrs);
48835
49481
  }
48836
49482
 
48837
- if (attrs.di) {
48838
- assign(businessObject.di, attrs.di);
48839
-
48840
- delete attrs.di;
48841
- }
48842
-
48843
49483
  applyAttributes(businessObject, attrs, [
48844
49484
  'processRef',
48845
49485
  'isInterrupting',
@@ -48848,11 +49488,11 @@
48848
49488
  ]);
48849
49489
 
48850
49490
  if (attrs.isExpanded) {
48851
- applyAttribute(businessObject.di, attrs, 'isExpanded');
49491
+ applyAttribute(di, attrs, 'isExpanded');
48852
49492
  }
48853
49493
 
48854
49494
  if (is$1(businessObject, 'bpmn:ExclusiveGateway')) {
48855
- businessObject.di.isMarkerVisible = true;
49495
+ di.isMarkerVisible = true;
48856
49496
  }
48857
49497
 
48858
49498
  var eventDefinitions,
@@ -48874,65 +49514,69 @@
48874
49514
  delete attrs.eventDefinitionType;
48875
49515
  }
48876
49516
 
48877
- size = this._getDefaultSize(businessObject);
49517
+ size = this.getDefaultSize(businessObject, di);
48878
49518
 
48879
49519
  attrs = assign({
48880
- businessObject: businessObject,
48881
49520
  id: businessObject.id
48882
- }, size, attrs);
49521
+ }, size, attrs, {
49522
+ businessObject: businessObject,
49523
+ di: di
49524
+ });
48883
49525
 
48884
49526
  return this.baseCreate(elementType, attrs);
48885
49527
  };
48886
49528
 
48887
49529
 
48888
- ElementFactory.prototype._getDefaultSize = function(semantic) {
49530
+ ElementFactory.prototype.getDefaultSize = function(element, di) {
48889
49531
 
48890
- if (is$1(semantic, 'bpmn:SubProcess')) {
49532
+ var bo = getBusinessObject(element);
49533
+ di = di || getDi(element);
48891
49534
 
48892
- if (isExpanded(semantic)) {
49535
+ if (is$1(bo, 'bpmn:SubProcess')) {
49536
+ if (isExpanded(bo, di)) {
48893
49537
  return { width: 350, height: 200 };
48894
49538
  } else {
48895
49539
  return { width: 100, height: 80 };
48896
49540
  }
48897
49541
  }
48898
49542
 
48899
- if (is$1(semantic, 'bpmn:Task')) {
49543
+ if (is$1(bo, 'bpmn:Task')) {
48900
49544
  return { width: 100, height: 80 };
48901
49545
  }
48902
49546
 
48903
- if (is$1(semantic, 'bpmn:Gateway')) {
49547
+ if (is$1(bo, 'bpmn:Gateway')) {
48904
49548
  return { width: 50, height: 50 };
48905
49549
  }
48906
49550
 
48907
- if (is$1(semantic, 'bpmn:Event')) {
49551
+ if (is$1(bo, 'bpmn:Event')) {
48908
49552
  return { width: 36, height: 36 };
48909
49553
  }
48910
49554
 
48911
- if (is$1(semantic, 'bpmn:Participant')) {
48912
- if (isExpanded(semantic)) {
49555
+ if (is$1(bo, 'bpmn:Participant')) {
49556
+ if (isExpanded(bo, di)) {
48913
49557
  return { width: 600, height: 250 };
48914
49558
  } else {
48915
49559
  return { width: 400, height: 60 };
48916
49560
  }
48917
49561
  }
48918
49562
 
48919
- if (is$1(semantic, 'bpmn:Lane')) {
49563
+ if (is$1(bo, 'bpmn:Lane')) {
48920
49564
  return { width: 400, height: 100 };
48921
49565
  }
48922
49566
 
48923
- if (is$1(semantic, 'bpmn:DataObjectReference')) {
49567
+ if (is$1(bo, 'bpmn:DataObjectReference')) {
48924
49568
  return { width: 36, height: 50 };
48925
49569
  }
48926
49570
 
48927
- if (is$1(semantic, 'bpmn:DataStoreReference')) {
49571
+ if (is$1(bo, 'bpmn:DataStoreReference')) {
48928
49572
  return { width: 50, height: 50 };
48929
49573
  }
48930
49574
 
48931
- if (is$1(semantic, 'bpmn:TextAnnotation')) {
49575
+ if (is$1(bo, 'bpmn:TextAnnotation')) {
48932
49576
  return { width: 100, height: 30 };
48933
49577
  }
48934
49578
 
48935
- if (is$1(semantic, 'bpmn:Group')) {
49579
+ if (is$1(bo, 'bpmn:Group')) {
48936
49580
  return { width: 300, height: 300 };
48937
49581
  }
48938
49582
 
@@ -48997,6 +49641,16 @@
48997
49641
  delete attrs[attributeName];
48998
49642
  }
48999
49643
 
49644
+
49645
+ function isModdleDi(element) {
49646
+ return isAny(element, [
49647
+ 'bpmndi:BPMNShape',
49648
+ 'bpmndi:BPMNEdge',
49649
+ 'bpmndi:BPMNDiagram',
49650
+ 'bpmndi:BPMNPlane',
49651
+ ]);
49652
+ }
49653
+
49000
49654
  /**
49001
49655
  * A handler that align elements in a certain way.
49002
49656
  *
@@ -51464,7 +52118,7 @@
51464
52118
 
51465
52119
  var businessObject = element.businessObject,
51466
52120
  properties = unwrapBusinessObjects(context.properties),
51467
- oldProperties = context.oldProperties || getProperties(businessObject, properties);
52121
+ oldProperties = context.oldProperties || getProperties(element, properties);
51468
52122
 
51469
52123
  if (isIdChange(properties, businessObject)) {
51470
52124
  ids.unclaim(businessObject[ID]);
@@ -51487,7 +52141,7 @@
51487
52141
  }
51488
52142
 
51489
52143
  // update properties
51490
- setProperties(businessObject, properties);
52144
+ setProperties(element, properties);
51491
52145
 
51492
52146
  // store old values
51493
52147
  context.oldProperties = oldProperties;
@@ -51532,7 +52186,7 @@
51532
52186
  ids = this._moddle.ids;
51533
52187
 
51534
52188
  // update properties
51535
- setProperties(businessObject, oldProperties);
52189
+ setProperties(element, oldProperties);
51536
52190
 
51537
52191
  if (isIdChange(properties, businessObject)) {
51538
52192
  ids.unclaim(properties[ID]);
@@ -51551,16 +52205,19 @@
51551
52205
  }
51552
52206
 
51553
52207
 
51554
- function getProperties(businessObject, properties) {
51555
- var propertyNames = keys(properties);
52208
+ function getProperties(element, properties) {
52209
+ var propertyNames = keys(properties),
52210
+ businessObject = element.businessObject,
52211
+ di = getDi(element);
51556
52212
 
51557
52213
  return reduce(propertyNames, function(result, key) {
51558
52214
 
51559
52215
  // handle DI separately
51560
52216
  if (key !== DI) {
51561
52217
  result[key] = businessObject.get(key);
52218
+
51562
52219
  } else {
51563
- result[key] = getDiProperties(businessObject.di, keys(properties.di));
52220
+ result[key] = getDiProperties(di, keys(properties.di));
51564
52221
  }
51565
52222
 
51566
52223
  return result;
@@ -51570,23 +52227,26 @@
51570
52227
 
51571
52228
  function getDiProperties(di, propertyNames) {
51572
52229
  return reduce(propertyNames, function(result, key) {
51573
- result[key] = di.get(key);
52230
+ result[key] = di && di.get(key);
51574
52231
 
51575
52232
  return result;
51576
52233
  }, {});
51577
52234
  }
51578
52235
 
51579
52236
 
51580
- function setProperties(businessObject, properties) {
52237
+ function setProperties(element, properties) {
52238
+ var businessObject = element.businessObject,
52239
+ di = getDi(element);
52240
+
51581
52241
  forEach(properties, function(value, key) {
51582
52242
 
51583
52243
  if (key !== DI) {
51584
52244
  businessObject.set(key, value);
51585
52245
  } else {
51586
52246
 
51587
- // only update, if businessObject.di exists
51588
- if (businessObject.di) {
51589
- setDiProperties(businessObject.di, value);
52247
+ // only update, if di exists
52248
+ if (di) {
52249
+ setDiProperties(di, value);
51590
52250
  }
51591
52251
  }
51592
52252
  });
@@ -51644,7 +52304,7 @@
51644
52304
  oldRoot = canvas.getRootElement(),
51645
52305
  oldRootBusinessObject = oldRoot.businessObject,
51646
52306
  bpmnDefinitions = oldRootBusinessObject.$parent,
51647
- diPlane = oldRootBusinessObject.di;
52307
+ diPlane = getDi(oldRoot);
51648
52308
 
51649
52309
  // (1) replace process old <> new root
51650
52310
  canvas.setRootElement(newRoot, true);
@@ -51657,10 +52317,10 @@
51657
52317
  oldRootBusinessObject.$parent = null;
51658
52318
 
51659
52319
  // (3) wire di
51660
- oldRootBusinessObject.di = null;
52320
+ oldRoot.di = null;
51661
52321
 
51662
52322
  diPlane.bpmnElement = newRootBusinessObject;
51663
- newRootBusinessObject.di = diPlane;
52323
+ newRoot.di = diPlane;
51664
52324
 
51665
52325
  context.oldRoot = oldRoot;
51666
52326
 
@@ -51678,7 +52338,7 @@
51678
52338
  oldRoot = context.oldRoot,
51679
52339
  oldRootBusinessObject = oldRoot.businessObject,
51680
52340
  bpmnDefinitions = newRootBusinessObject.$parent,
51681
- diPlane = newRootBusinessObject.di;
52341
+ diPlane = getDi(newRoot);
51682
52342
 
51683
52343
  // (1) replace process old <> new root
51684
52344
  canvas.setRootElement(oldRoot, true);
@@ -51691,10 +52351,10 @@
51691
52351
  oldRootBusinessObject.$parent = bpmnDefinitions;
51692
52352
 
51693
52353
  // (3) wire di
51694
- newRootBusinessObject.di = null;
52354
+ newRoot.di = null;
51695
52355
 
51696
52356
  diPlane.bpmnElement = oldRootBusinessObject;
51697
- oldRootBusinessObject.di = diPlane;
52357
+ oldRoot.di = diPlane;
51698
52358
 
51699
52359
  // TODO(nikku): return changed elements?
51700
52360
  // return [ newRoot, oldRoot ];
@@ -52363,7 +53023,8 @@
52363
53023
 
52364
53024
  modeling.createLabel(element, labelCenter, {
52365
53025
  id: businessObject.id + '_label',
52366
- businessObject: businessObject
53026
+ businessObject: businessObject,
53027
+ di: element.di
52367
53028
  });
52368
53029
  }
52369
53030
  }
@@ -55424,7 +56085,8 @@
55424
56085
  var shape = elementFactory.createShape(assign({ type: type }, options));
55425
56086
 
55426
56087
  if (options) {
55427
- shape.businessObject.di.isExpanded = options.isExpanded;
56088
+ var di = getDi(shape);
56089
+ di.isExpanded = options.isExpanded;
55428
56090
  }
55429
56091
 
55430
56092
  create.start(event, shape);