camunda-bpmn-js 3.6.1 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1784,6 +1784,7 @@
1784
1784
  }
1785
1785
 
1786
1786
  var black = 'hsl(225, 10%, 15%)';
1787
+ var white = 'white';
1787
1788
 
1788
1789
  // element utils //////////////////////
1789
1790
 
@@ -1831,39 +1832,42 @@
1831
1832
  /**
1832
1833
  * @param {Element} element
1833
1834
  * @param {string} [defaultColor]
1835
+ * @param {string} [overrideColor]
1834
1836
  *
1835
1837
  * @return {string}
1836
1838
  */
1837
- function getFillColor(element, defaultColor) {
1839
+ function getFillColor(element, defaultColor, overrideColor) {
1838
1840
  var di = getDi(element);
1839
1841
 
1840
- return di.get('color:background-color') || di.get('bioc:fill') || defaultColor || 'white';
1842
+ return overrideColor || di.get('color:background-color') || di.get('bioc:fill') || defaultColor || white;
1841
1843
  }
1842
1844
 
1843
1845
  /**
1844
1846
  * @param {Element} element
1845
1847
  * @param {string} [defaultColor]
1848
+ * @param {string} [overrideColor]
1846
1849
  *
1847
1850
  * @return {string}
1848
1851
  */
1849
- function getStrokeColor(element, defaultColor) {
1852
+ function getStrokeColor(element, defaultColor, overrideColor) {
1850
1853
  var di = getDi(element);
1851
1854
 
1852
- return di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
1855
+ return overrideColor || di.get('color:border-color') || di.get('bioc:stroke') || defaultColor || black;
1853
1856
  }
1854
1857
 
1855
1858
  /**
1856
1859
  * @param {Element} element
1857
1860
  * @param {string} [defaultColor]
1858
1861
  * @param {string} [defaultStrokeColor]
1862
+ * @param {string} [overrideColor]
1859
1863
  *
1860
1864
  * @return {string}
1861
1865
  */
1862
- function getLabelColor(element, defaultColor, defaultStrokeColor) {
1866
+ function getLabelColor(element, defaultColor, defaultStrokeColor, overrideColor) {
1863
1867
  var di = getDi(element),
1864
1868
  label = di.get('label');
1865
1869
 
1866
- return label && label.get('color:color') || defaultColor ||
1870
+ return overrideColor || (label && label.get('color:color')) || defaultColor ||
1867
1871
  getStrokeColor(element, defaultStrokeColor);
1868
1872
  }
1869
1873
 
@@ -1967,6 +1971,45 @@
1967
1971
  return componentsToPath(rectPath);
1968
1972
  }
1969
1973
 
1974
+ /**
1975
+ * Get width and height from element or overrides.
1976
+ *
1977
+ * @param {Dimensions|Rect|Shape} bounds
1978
+ * @param {Object} overrides
1979
+ *
1980
+ * @returns {Dimensions}
1981
+ */
1982
+ function getBounds(bounds, overrides = {}) {
1983
+ return {
1984
+ width: getWidth(bounds, overrides),
1985
+ height: getHeight(bounds, overrides)
1986
+ };
1987
+ }
1988
+
1989
+ /**
1990
+ * Get width from element or overrides.
1991
+ *
1992
+ * @param {Dimensions|Rect|Shape} bounds
1993
+ * @param {Object} overrides
1994
+ *
1995
+ * @returns {number}
1996
+ */
1997
+ function getWidth(bounds, overrides = {}) {
1998
+ return has$1(overrides, 'width') ? overrides.width : bounds.width;
1999
+ }
2000
+
2001
+ /**
2002
+ * Get height from element or overrides.
2003
+ *
2004
+ * @param {Dimensions|Rect|Shape} bounds
2005
+ * @param {Object} overrides
2006
+ *
2007
+ * @returns {number}
2008
+ */
2009
+ function getHeight(bounds, overrides = {}) {
2010
+ return has$1(overrides, 'height') ? overrides.height : bounds.height;
2011
+ }
2012
+
1970
2013
  function _mergeNamespaces$1(n, m) {
1971
2014
  m.forEach(function (e) {
1972
2015
  e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
@@ -2730,15 +2773,16 @@
2730
2773
  }
2731
2774
  };
2732
2775
 
2733
- var RENDERER_IDS = new Ids();
2776
+ var rendererIds = new Ids();
2734
2777
 
2735
- var TASK_BORDER_RADIUS = 10;
2736
- var INNER_OUTER_DIST = 3;
2778
+ var ELEMENT_LABEL_DISTANCE = 10,
2779
+ INNER_OUTER_DIST = 3,
2780
+ PARTICIPANT_STROKE_WIDTH = 1.5,
2781
+ TASK_BORDER_RADIUS = 10;
2737
2782
 
2738
- var DEFAULT_FILL_OPACITY = .95,
2739
- HIGH_FILL_OPACITY = .35;
2740
-
2741
- var ELEMENT_LABEL_DISTANCE = 10;
2783
+ var DEFAULT_OPACITY = 0.95,
2784
+ FULL_OPACITY = 1,
2785
+ LOW_OPACITY = 0.25;
2742
2786
 
2743
2787
  /**
2744
2788
  * @typedef { Partial<{
@@ -2746,6 +2790,13 @@
2746
2790
  * defaultStrokeColor: string,
2747
2791
  * defaultLabelColor: string
2748
2792
  * }> } BpmnRendererConfig
2793
+ *
2794
+ * @typedef { Partial<{
2795
+ * fill: string,
2796
+ * stroke: string,
2797
+ * width: string,
2798
+ * height: string
2799
+ * }> } Attrs
2749
2800
  */
2750
2801
 
2751
2802
  /**
@@ -2773,7 +2824,7 @@
2773
2824
  defaultStrokeColor = config && config.defaultStrokeColor,
2774
2825
  defaultLabelColor = config && config.defaultLabelColor;
2775
2826
 
2776
- var rendererId = RENDERER_IDS.next();
2827
+ var rendererId = rendererIds.next();
2777
2828
 
2778
2829
  var markers = {};
2779
2830
 
@@ -2869,7 +2920,7 @@
2869
2920
  cy: 6,
2870
2921
  r: 3.5,
2871
2922
  ...shapeStyle({
2872
- fill: fill,
2923
+ fill,
2873
2924
  stroke: stroke,
2874
2925
  strokeWidth: 1,
2875
2926
 
@@ -2889,7 +2940,7 @@
2889
2940
  var messageflowEnd = create$1('path', {
2890
2941
  d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
2891
2942
  ...shapeStyle({
2892
- fill: fill,
2943
+ fill,
2893
2944
  stroke: stroke,
2894
2945
  strokeWidth: 1,
2895
2946
 
@@ -2910,7 +2961,7 @@
2910
2961
  d: 'M 11 5 L 1 10 L 11 15',
2911
2962
  ...lineStyle({
2912
2963
  fill: 'none',
2913
- stroke: stroke,
2964
+ stroke,
2914
2965
  strokeWidth: 1.5,
2915
2966
 
2916
2967
  // fix for safari / chrome / firefox bug not correctly
@@ -2931,7 +2982,7 @@
2931
2982
  d: 'M 1 5 L 11 10 L 1 15',
2932
2983
  ...lineStyle({
2933
2984
  fill: 'none',
2934
- stroke: stroke,
2985
+ stroke,
2935
2986
  strokeWidth: 1.5,
2936
2987
 
2937
2988
  // fix for safari / chrome / firefox bug not correctly
@@ -2951,7 +3002,7 @@
2951
3002
  var conditionalFlowMarker = create$1('path', {
2952
3003
  d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
2953
3004
  ...shapeStyle({
2954
- fill: fill,
3005
+ fill,
2955
3006
  stroke: stroke
2956
3007
  })
2957
3008
  });
@@ -2979,7 +3030,7 @@
2979
3030
  }
2980
3031
  }
2981
3032
 
2982
- function drawCircle(parentGfx, width, height, offset, attrs) {
3033
+ function drawCircle(parentGfx, width, height, offset, attrs = {}) {
2983
3034
 
2984
3035
  if (isObject(offset)) {
2985
3036
  attrs = offset;
@@ -2990,10 +3041,6 @@
2990
3041
 
2991
3042
  attrs = shapeStyle(attrs);
2992
3043
 
2993
- if (attrs.fill === 'none') {
2994
- delete attrs.fillOpacity;
2995
- }
2996
-
2997
3044
  var cx = width / 2,
2998
3045
  cy = height / 2;
2999
3046
 
@@ -3093,7 +3140,6 @@
3093
3140
  }
3094
3141
 
3095
3142
  function drawPath(parentGfx, d, attrs) {
3096
-
3097
3143
  attrs = lineStyle(attrs);
3098
3144
 
3099
3145
  var path = create$1('path', {
@@ -3115,171 +3161,13 @@
3115
3161
  }
3116
3162
 
3117
3163
  function as(type) {
3118
- return function(parentGfx, element, options) {
3119
- return renderer(type)(parentGfx, element, options);
3120
- };
3121
- }
3122
-
3123
- function renderEventContent(element, parentGfx) {
3124
-
3125
- var event = getBusinessObject(element);
3126
- var isThrowing = isThrowEvent(event);
3127
-
3128
- if (event.eventDefinitions && event.eventDefinitions.length > 1) {
3129
- if (event.parallelMultiple) {
3130
- return renderer('bpmn:ParallelMultipleEventDefinition')(parentGfx, element, isThrowing);
3131
- }
3132
- else {
3133
- return renderer('bpmn:MultipleEventDefinition')(parentGfx, element, isThrowing);
3134
- }
3135
- }
3136
-
3137
- if (isTypedEvent(event, 'bpmn:MessageEventDefinition')) {
3138
- return renderer('bpmn:MessageEventDefinition')(parentGfx, element, isThrowing);
3139
- }
3140
-
3141
- if (isTypedEvent(event, 'bpmn:TimerEventDefinition')) {
3142
- return renderer('bpmn:TimerEventDefinition')(parentGfx, element, isThrowing);
3143
- }
3144
-
3145
- if (isTypedEvent(event, 'bpmn:ConditionalEventDefinition')) {
3146
- return renderer('bpmn:ConditionalEventDefinition')(parentGfx, element);
3147
- }
3148
-
3149
- if (isTypedEvent(event, 'bpmn:SignalEventDefinition')) {
3150
- return renderer('bpmn:SignalEventDefinition')(parentGfx, element, isThrowing);
3151
- }
3152
-
3153
- if (isTypedEvent(event, 'bpmn:EscalationEventDefinition')) {
3154
- return renderer('bpmn:EscalationEventDefinition')(parentGfx, element, isThrowing);
3155
- }
3156
-
3157
- if (isTypedEvent(event, 'bpmn:LinkEventDefinition')) {
3158
- return renderer('bpmn:LinkEventDefinition')(parentGfx, element, isThrowing);
3159
- }
3160
-
3161
- if (isTypedEvent(event, 'bpmn:ErrorEventDefinition')) {
3162
- return renderer('bpmn:ErrorEventDefinition')(parentGfx, element, isThrowing);
3163
- }
3164
-
3165
- if (isTypedEvent(event, 'bpmn:CancelEventDefinition')) {
3166
- return renderer('bpmn:CancelEventDefinition')(parentGfx, element, isThrowing);
3167
- }
3168
-
3169
- if (isTypedEvent(event, 'bpmn:CompensateEventDefinition')) {
3170
- return renderer('bpmn:CompensateEventDefinition')(parentGfx, element, isThrowing);
3171
- }
3172
-
3173
- if (isTypedEvent(event, 'bpmn:TerminateEventDefinition')) {
3174
- return renderer('bpmn:TerminateEventDefinition')(parentGfx, element, isThrowing);
3175
- }
3176
-
3177
- return null;
3178
- }
3179
-
3180
- function renderLabel(parentGfx, label, options) {
3181
-
3182
- options = assign$1({
3183
- size: {
3184
- width: 100
3185
- }
3186
- }, options);
3187
-
3188
- var text = textRenderer.createText(label || '', options);
3189
-
3190
- classes$1(text).add('djs-label');
3191
-
3192
- append(parentGfx, text);
3193
-
3194
- return text;
3195
- }
3196
-
3197
- function renderEmbeddedLabel(parentGfx, element, align) {
3198
- var semantic = getBusinessObject(element);
3199
-
3200
- return renderLabel(parentGfx, semantic.name, {
3201
- box: element,
3202
- align: align,
3203
- padding: 7,
3204
- style: {
3205
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3206
- }
3207
- });
3208
- }
3209
-
3210
- function renderExternalLabel(parentGfx, element) {
3211
-
3212
- var box = {
3213
- width: 90,
3214
- height: 30,
3215
- x: element.width / 2 + element.x,
3216
- y: element.height / 2 + element.y
3164
+ return function(parentGfx, element, attrs) {
3165
+ return renderer(type)(parentGfx, element, attrs);
3217
3166
  };
3218
-
3219
- return renderLabel(parentGfx, getLabel(element), {
3220
- box: box,
3221
- fitBox: true,
3222
- style: assign$1(
3223
- {},
3224
- textRenderer.getExternalStyle(),
3225
- {
3226
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3227
- }
3228
- )
3229
- });
3230
- }
3231
-
3232
- function renderLaneLabel(parentGfx, text, element) {
3233
- var textBox = renderLabel(parentGfx, text, {
3234
- box: {
3235
- height: 30,
3236
- width: element.height
3237
- },
3238
- align: 'center-middle',
3239
- style: {
3240
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3241
- }
3242
- });
3243
-
3244
- var top = -1 * element.height;
3245
-
3246
- transform(textBox, 0, -top, 270);
3247
3167
  }
3248
3168
 
3249
- var handlers = this.handlers = {
3250
- 'bpmn:Event': function(parentGfx, element, attrs) {
3251
-
3252
- if (!('fillOpacity' in attrs)) {
3253
- attrs.fillOpacity = DEFAULT_FILL_OPACITY;
3254
- }
3255
-
3256
- return drawCircle(parentGfx, element.width, element.height, attrs);
3257
- },
3258
- 'bpmn:StartEvent': function(parentGfx, element, options) {
3259
- var attrs = {
3260
- fill: getFillColor(element, defaultFillColor),
3261
- stroke: getStrokeColor(element, defaultStrokeColor)
3262
- };
3263
-
3264
- var semantic = getBusinessObject(element);
3265
-
3266
- if (!semantic.isInterrupting) {
3267
- attrs = {
3268
- strokeDasharray: '6',
3269
- fill: getFillColor(element, defaultFillColor),
3270
- stroke: getStrokeColor(element, defaultStrokeColor)
3271
- };
3272
- }
3273
-
3274
- var circle = renderer('bpmn:Event')(parentGfx, element, attrs);
3275
-
3276
- if (!options || options.renderIcon !== false) {
3277
- renderEventContent(element, parentGfx);
3278
- }
3279
-
3280
- return circle;
3281
- },
3282
- 'bpmn:MessageEventDefinition': function(parentGfx, element, isThrowing) {
3169
+ var eventIconRenderers = {
3170
+ 'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
3283
3171
  var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
3284
3172
  xScaleFactor: 0.9,
3285
3173
  yScaleFactor: 0.9,
@@ -3291,22 +3179,27 @@
3291
3179
  }
3292
3180
  });
3293
3181
 
3294
- var fill = isThrowing ? getStrokeColor(element, defaultStrokeColor) : getFillColor(element, defaultFillColor);
3295
- var stroke = isThrowing ? getFillColor(element, defaultFillColor) : getStrokeColor(element, defaultStrokeColor);
3182
+ var fill = isThrowing
3183
+ ? getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3184
+ : getFillColor(element, defaultFillColor, attrs.fill);
3185
+
3186
+ var stroke = isThrowing
3187
+ ? getFillColor(element, defaultFillColor, attrs.fill)
3188
+ : getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3296
3189
 
3297
3190
  var messagePath = drawPath(parentGfx, pathData, {
3298
- strokeWidth: 1,
3299
- fill: fill,
3300
- stroke: stroke
3191
+ fill,
3192
+ stroke,
3193
+ strokeWidth: 1
3301
3194
  });
3302
3195
 
3303
3196
  return messagePath;
3304
3197
  },
3305
- 'bpmn:TimerEventDefinition': function(parentGfx, element) {
3198
+ 'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
3306
3199
  var circle = drawCircle(parentGfx, element.width, element.height, 0.2 * element.height, {
3307
- strokeWidth: 2,
3308
- fill: getFillColor(element, defaultFillColor),
3309
- stroke: getStrokeColor(element, defaultStrokeColor)
3200
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3201
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3202
+ strokeWidth: 2
3310
3203
  });
3311
3204
 
3312
3205
  var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
@@ -3321,12 +3214,11 @@
3321
3214
  });
3322
3215
 
3323
3216
  drawPath(parentGfx, pathData, {
3324
- strokeWidth: 2,
3325
- stroke: getStrokeColor(element, defaultStrokeColor)
3217
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3218
+ strokeWidth: 2
3326
3219
  });
3327
3220
 
3328
- for (var i = 0;i < 12; i++) {
3329
-
3221
+ for (var i = 0; i < 12; i++) {
3330
3222
  var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
3331
3223
  xScaleFactor: 0.75,
3332
3224
  yScaleFactor: 0.75,
@@ -3338,19 +3230,19 @@
3338
3230
  }
3339
3231
  });
3340
3232
 
3341
- var width = element.width / 2;
3342
- var height = element.height / 2;
3233
+ var width = element.width / 2,
3234
+ height = element.height / 2;
3343
3235
 
3344
3236
  drawPath(parentGfx, linePathData, {
3345
3237
  strokeWidth: 1,
3346
- transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')',
3347
- stroke: getStrokeColor(element, defaultStrokeColor)
3238
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3239
+ transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
3348
3240
  });
3349
3241
  }
3350
3242
 
3351
3243
  return circle;
3352
3244
  },
3353
- 'bpmn:EscalationEventDefinition': function(parentGfx, event, isThrowing) {
3245
+ 'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3354
3246
  var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
3355
3247
  xScaleFactor: 1,
3356
3248
  yScaleFactor: 1,
@@ -3362,15 +3254,17 @@
3362
3254
  }
3363
3255
  });
3364
3256
 
3365
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3257
+ var fill = isThrowing
3258
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3259
+ : getFillColor(event, defaultFillColor, attrs.fill);
3366
3260
 
3367
3261
  return drawPath(parentGfx, pathData, {
3368
- strokeWidth: 1,
3369
- fill: fill,
3370
- stroke: getStrokeColor(event, defaultStrokeColor)
3262
+ fill,
3263
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3264
+ strokeWidth: 1
3371
3265
  });
3372
3266
  },
3373
- 'bpmn:ConditionalEventDefinition': function(parentGfx, event) {
3267
+ 'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
3374
3268
  var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
3375
3269
  xScaleFactor: 1,
3376
3270
  yScaleFactor: 1,
@@ -3383,11 +3277,12 @@
3383
3277
  });
3384
3278
 
3385
3279
  return drawPath(parentGfx, pathData, {
3386
- strokeWidth: 1,
3387
- stroke: getStrokeColor(event, defaultStrokeColor)
3280
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
3281
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3282
+ strokeWidth: 1
3388
3283
  });
3389
3284
  },
3390
- 'bpmn:LinkEventDefinition': function(parentGfx, event, isThrowing) {
3285
+ 'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3391
3286
  var pathData = pathMap.getScaledPath('EVENT_LINK', {
3392
3287
  xScaleFactor: 1,
3393
3288
  yScaleFactor: 1,
@@ -3399,15 +3294,17 @@
3399
3294
  }
3400
3295
  });
3401
3296
 
3402
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3297
+ var fill = isThrowing
3298
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3299
+ : getFillColor(event, defaultFillColor, attrs.fill);
3403
3300
 
3404
3301
  return drawPath(parentGfx, pathData, {
3405
- strokeWidth: 1,
3406
- fill: fill,
3407
- stroke: getStrokeColor(event, defaultStrokeColor)
3302
+ fill,
3303
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3304
+ strokeWidth: 1
3408
3305
  });
3409
3306
  },
3410
- 'bpmn:ErrorEventDefinition': function(parentGfx, event, isThrowing) {
3307
+ 'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3411
3308
  var pathData = pathMap.getScaledPath('EVENT_ERROR', {
3412
3309
  xScaleFactor: 1.1,
3413
3310
  yScaleFactor: 1.1,
@@ -3419,15 +3316,17 @@
3419
3316
  }
3420
3317
  });
3421
3318
 
3422
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3319
+ var fill = isThrowing
3320
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3321
+ : getFillColor(event, defaultFillColor, attrs.fill);
3423
3322
 
3424
3323
  return drawPath(parentGfx, pathData, {
3425
- strokeWidth: 1,
3426
- fill: fill,
3427
- stroke: getStrokeColor(event, defaultStrokeColor)
3324
+ fill,
3325
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3326
+ strokeWidth: 1
3428
3327
  });
3429
3328
  },
3430
- 'bpmn:CancelEventDefinition': function(parentGfx, event, isThrowing) {
3329
+ 'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3431
3330
  var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
3432
3331
  xScaleFactor: 1.0,
3433
3332
  yScaleFactor: 1.0,
@@ -3439,19 +3338,19 @@
3439
3338
  }
3440
3339
  });
3441
3340
 
3442
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3341
+ var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : 'none';
3443
3342
 
3444
3343
  var path = drawPath(parentGfx, pathData, {
3445
- strokeWidth: 1,
3446
- fill: fill,
3447
- stroke: getStrokeColor(event, defaultStrokeColor)
3344
+ fill,
3345
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3346
+ strokeWidth: 1
3448
3347
  });
3449
3348
 
3450
3349
  rotate(path, 45);
3451
3350
 
3452
3351
  return path;
3453
3352
  },
3454
- 'bpmn:CompensateEventDefinition': function(parentGfx, event, isThrowing) {
3353
+ 'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3455
3354
  var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
3456
3355
  xScaleFactor: 1,
3457
3356
  yScaleFactor: 1,
@@ -3463,15 +3362,17 @@
3463
3362
  }
3464
3363
  });
3465
3364
 
3466
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3365
+ var fill = isThrowing
3366
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3367
+ : getFillColor(event, defaultFillColor, attrs.fill);
3467
3368
 
3468
3369
  return drawPath(parentGfx, pathData, {
3469
- strokeWidth: 1,
3470
- fill: fill,
3471
- stroke: getStrokeColor(event, defaultStrokeColor)
3370
+ fill,
3371
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3372
+ strokeWidth: 1
3472
3373
  });
3473
3374
  },
3474
- 'bpmn:SignalEventDefinition': function(parentGfx, event, isThrowing) {
3375
+ 'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3475
3376
  var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
3476
3377
  xScaleFactor: 0.9,
3477
3378
  yScaleFactor: 0.9,
@@ -3483,15 +3384,17 @@
3483
3384
  }
3484
3385
  });
3485
3386
 
3486
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3387
+ var fill = isThrowing
3388
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3389
+ : getFillColor(event, defaultFillColor, attrs.fill);
3487
3390
 
3488
3391
  return drawPath(parentGfx, pathData, {
3489
3392
  strokeWidth: 1,
3490
- fill: fill,
3491
- stroke: getStrokeColor(event, defaultStrokeColor)
3393
+ fill,
3394
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3492
3395
  });
3493
3396
  },
3494
- 'bpmn:MultipleEventDefinition': function(parentGfx, event, isThrowing) {
3397
+ 'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3495
3398
  var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
3496
3399
  xScaleFactor: 1.1,
3497
3400
  yScaleFactor: 1.1,
@@ -3503,14 +3406,16 @@
3503
3406
  }
3504
3407
  });
3505
3408
 
3506
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor) : 'none';
3409
+ var fill = isThrowing
3410
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3411
+ : getFillColor(event, defaultFillColor, attrs.fill);
3507
3412
 
3508
3413
  return drawPath(parentGfx, pathData, {
3509
- strokeWidth: 1,
3510
- fill: fill
3414
+ fill,
3415
+ strokeWidth: 1
3511
3416
  });
3512
3417
  },
3513
- 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event) {
3418
+ 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
3514
3419
  var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
3515
3420
  xScaleFactor: 1.2,
3516
3421
  yScaleFactor: 1.2,
@@ -3523,445 +3428,640 @@
3523
3428
  });
3524
3429
 
3525
3430
  return drawPath(parentGfx, pathData, {
3526
- strokeWidth: 1,
3527
- fill: getStrokeColor(event, defaultStrokeColor),
3528
- stroke: getStrokeColor(event, defaultStrokeColor)
3431
+ fill: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3432
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3433
+ strokeWidth: 1
3529
3434
  });
3530
3435
  },
3531
- 'bpmn:EndEvent': function(parentGfx, element, options) {
3532
- var circle = renderer('bpmn:Event')(parentGfx, element, {
3533
- strokeWidth: 4,
3534
- fill: getFillColor(element, defaultFillColor),
3535
- stroke: getStrokeColor(element, defaultStrokeColor)
3536
- });
3537
-
3538
- if (!options || options.renderIcon !== false) {
3539
- renderEventContent(element, parentGfx);
3540
- }
3541
-
3542
- return circle;
3543
- },
3544
- 'bpmn:TerminateEventDefinition': function(parentGfx, element) {
3436
+ 'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
3545
3437
  var circle = drawCircle(parentGfx, element.width, element.height, 8, {
3546
- strokeWidth: 4,
3547
- fill: getStrokeColor(element, defaultStrokeColor),
3548
- stroke: getStrokeColor(element, defaultStrokeColor)
3438
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3439
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3440
+ strokeWidth: 4
3549
3441
  });
3550
3442
 
3551
3443
  return circle;
3552
- },
3553
- 'bpmn:IntermediateEvent': function(parentGfx, element, options) {
3554
- var outer = renderer('bpmn:Event')(parentGfx, element, {
3555
- strokeWidth: 1.5,
3556
- fill: getFillColor(element, defaultFillColor),
3557
- stroke: getStrokeColor(element, defaultStrokeColor)
3558
- });
3444
+ }
3445
+ };
3559
3446
 
3560
- /* inner */
3561
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
3562
- strokeWidth: 1.5,
3563
- fill: getFillColor(element, 'none'),
3564
- stroke: getStrokeColor(element, defaultStrokeColor)
3565
- });
3447
+ function renderEventIcon(element, parentGfx, attrs = {}) {
3448
+ var semantic = getBusinessObject(element),
3449
+ isThrowing = isThrowEvent(semantic);
3566
3450
 
3567
- if (!options || options.renderIcon !== false) {
3568
- renderEventContent(element, parentGfx);
3451
+ if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
3452
+ if (semantic.get('parallelMultiple')) {
3453
+ return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
3569
3454
  }
3455
+ else {
3456
+ return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, element, attrs, isThrowing);
3457
+ }
3458
+ }
3570
3459
 
3571
- return outer;
3572
- },
3573
- 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
3574
- 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
3575
-
3576
- 'bpmn:Activity': function(parentGfx, element, attrs) {
3460
+ if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
3461
+ return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, element, attrs, isThrowing);
3462
+ }
3577
3463
 
3578
- attrs = attrs || {};
3464
+ if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
3465
+ return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, element, attrs, isThrowing);
3466
+ }
3579
3467
 
3580
- if (!('fillOpacity' in attrs)) {
3581
- attrs.fillOpacity = DEFAULT_FILL_OPACITY;
3582
- }
3468
+ if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
3469
+ return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, element, attrs, isThrowing);
3470
+ }
3583
3471
 
3584
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, attrs);
3585
- },
3472
+ if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
3473
+ return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, element, attrs, isThrowing);
3474
+ }
3586
3475
 
3587
- 'bpmn:Task': function(parentGfx, element) {
3588
- var attrs = {
3589
- fill: getFillColor(element, defaultFillColor),
3590
- stroke: getStrokeColor(element, defaultStrokeColor)
3591
- };
3476
+ if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
3477
+ return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, element, attrs, isThrowing);
3478
+ }
3592
3479
 
3593
- var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
3480
+ if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
3481
+ return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, element, attrs, isThrowing);
3482
+ }
3594
3483
 
3595
- renderEmbeddedLabel(parentGfx, element, 'center-middle');
3596
- attachTaskMarkers(parentGfx, element);
3484
+ if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
3485
+ return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, element, attrs, isThrowing);
3486
+ }
3597
3487
 
3598
- return rect;
3599
- },
3600
- 'bpmn:ServiceTask': function(parentGfx, element) {
3601
- var task = renderer('bpmn:Task')(parentGfx, element);
3488
+ if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
3489
+ return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, element, attrs, isThrowing);
3490
+ }
3602
3491
 
3603
- var pathDataBG = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
3604
- abspos: {
3605
- x: 12,
3606
- y: 18
3607
- }
3608
- });
3492
+ if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
3493
+ return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, element, attrs, isThrowing);
3494
+ }
3609
3495
 
3610
- /* service bg */ drawPath(parentGfx, pathDataBG, {
3611
- strokeWidth: 1,
3612
- fill: getFillColor(element, defaultFillColor),
3613
- stroke: getStrokeColor(element, defaultStrokeColor)
3614
- });
3496
+ if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
3497
+ return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, element, attrs, isThrowing);
3498
+ }
3615
3499
 
3616
- var fillPathData = pathMap.getScaledPath('TASK_TYPE_SERVICE_FILL', {
3617
- abspos: {
3618
- x: 17.2,
3619
- y: 18
3620
- }
3621
- });
3500
+ return null;
3501
+ }
3622
3502
 
3623
- /* service fill */ drawPath(parentGfx, fillPathData, {
3624
- strokeWidth: 0,
3625
- fill: getFillColor(element, defaultFillColor)
3626
- });
3503
+ var taskMarkerRenderers = {
3504
+ 'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
3505
+ var width = getWidth(element, attrs),
3506
+ height = getHeight(element, attrs);
3627
3507
 
3628
- var pathData = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
3629
- abspos: {
3630
- x: 17,
3631
- y: 22
3508
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3509
+ xScaleFactor: 1,
3510
+ yScaleFactor: 1,
3511
+ containerWidth: width,
3512
+ containerHeight: height,
3513
+ position: {
3514
+ mx: ((width / 2 - 6) / width),
3515
+ my: (height - 15) / height
3632
3516
  }
3633
3517
  });
3634
3518
 
3635
- /* service */ drawPath(parentGfx, pathData, {
3636
- strokeWidth: 1,
3637
- fill: getFillColor(element, defaultFillColor),
3638
- stroke: getStrokeColor(element, defaultStrokeColor)
3519
+ drawMarker('participant-multiplicity', parentGfx, markerPath, {
3520
+ strokeWidth: 2,
3521
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3522
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3639
3523
  });
3640
-
3641
- return task;
3642
3524
  },
3643
- 'bpmn:UserTask': function(parentGfx, element) {
3644
- var task = renderer('bpmn:Task')(parentGfx, element);
3645
-
3646
- var x = 15;
3647
- var y = 12;
3648
-
3649
- var pathData = pathMap.getScaledPath('TASK_TYPE_USER_1', {
3650
- abspos: {
3651
- x: x,
3652
- y: y
3653
- }
3525
+ 'SubProcessMarker': function(parentGfx, element, attrs = {}) {
3526
+ var markerRect = drawRect(parentGfx, 14, 14, 0, {
3527
+ strokeWidth: 1,
3528
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3529
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3654
3530
  });
3655
3531
 
3656
- /* user path */ drawPath(parentGfx, pathData, {
3657
- strokeWidth: 0.5,
3658
- fill: getFillColor(element, defaultFillColor),
3659
- stroke: getStrokeColor(element, defaultStrokeColor)
3660
- });
3532
+ translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
3661
3533
 
3662
- var pathData2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
3663
- abspos: {
3664
- x: x,
3665
- y: y
3534
+ var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
3535
+ xScaleFactor: 1.5,
3536
+ yScaleFactor: 1.5,
3537
+ containerWidth: element.width,
3538
+ containerHeight: element.height,
3539
+ position: {
3540
+ mx: (element.width / 2 - 7.5) / element.width,
3541
+ my: (element.height - 20) / element.height
3666
3542
  }
3667
3543
  });
3668
3544
 
3669
- /* user2 path */ drawPath(parentGfx, pathData2, {
3670
- strokeWidth: 0.5,
3671
- fill: getFillColor(element, defaultFillColor),
3672
- stroke: getStrokeColor(element, defaultStrokeColor)
3545
+ drawMarker('sub-process', parentGfx, markerPath, {
3546
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3547
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3673
3548
  });
3549
+ },
3550
+ 'ParallelMarker': function(parentGfx, element, attrs) {
3551
+ var width = getWidth(element, attrs),
3552
+ height = getHeight(element, attrs);
3674
3553
 
3675
- var pathData3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
3676
- abspos: {
3677
- x: x,
3678
- y: y
3554
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3555
+ xScaleFactor: 1,
3556
+ yScaleFactor: 1,
3557
+ containerWidth: width,
3558
+ containerHeight: height,
3559
+ position: {
3560
+ mx: ((width / 2 + attrs.parallel) / width),
3561
+ my: (height - 20) / height
3679
3562
  }
3680
3563
  });
3681
3564
 
3682
- /* user3 path */ drawPath(parentGfx, pathData3, {
3683
- strokeWidth: 0.5,
3684
- fill: getStrokeColor(element, defaultStrokeColor),
3685
- stroke: getStrokeColor(element, defaultStrokeColor)
3565
+ drawMarker('parallel', parentGfx, markerPath, {
3566
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3567
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3686
3568
  });
3687
-
3688
- return task;
3689
3569
  },
3690
- 'bpmn:ManualTask': function(parentGfx, element) {
3691
- var task = renderer('bpmn:Task')(parentGfx, element);
3692
-
3693
- var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
3694
- abspos: {
3695
- x: 17,
3696
- y: 15
3570
+ 'SequentialMarker': function(parentGfx, element, attrs) {
3571
+ var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
3572
+ xScaleFactor: 1,
3573
+ yScaleFactor: 1,
3574
+ containerWidth: element.width,
3575
+ containerHeight: element.height,
3576
+ position: {
3577
+ mx: ((element.width / 2 + attrs.seq) / element.width),
3578
+ my: (element.height - 19) / element.height
3697
3579
  }
3698
3580
  });
3699
3581
 
3700
- /* manual path */ drawPath(parentGfx, pathData, {
3701
- strokeWidth: 0.5, // 0.25,
3702
- fill: getFillColor(element, defaultFillColor),
3703
- stroke: getStrokeColor(element, defaultStrokeColor)
3582
+ drawMarker('sequential', parentGfx, markerPath, {
3583
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3584
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3704
3585
  });
3705
-
3706
- return task;
3707
3586
  },
3708
- 'bpmn:SendTask': function(parentGfx, element) {
3709
- var task = renderer('bpmn:Task')(parentGfx, element);
3710
-
3711
- var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
3587
+ 'CompensationMarker': function(parentGfx, element, attrs) {
3588
+ var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
3712
3589
  xScaleFactor: 1,
3713
3590
  yScaleFactor: 1,
3714
- containerWidth: 21,
3715
- containerHeight: 14,
3591
+ containerWidth: element.width,
3592
+ containerHeight: element.height,
3716
3593
  position: {
3717
- mx: 0.285,
3718
- my: 0.357
3594
+ mx: ((element.width / 2 + attrs.compensation) / element.width),
3595
+ my: (element.height - 13) / element.height
3719
3596
  }
3720
3597
  });
3721
3598
 
3722
- /* send path */ drawPath(parentGfx, pathData, {
3723
- strokeWidth: 1,
3724
- fill: getStrokeColor(element, defaultStrokeColor),
3725
- stroke: getFillColor(element, defaultFillColor)
3726
- });
3727
-
3728
- return task;
3729
- },
3730
- 'bpmn:ReceiveTask' : function(parentGfx, element) {
3731
- var semantic = getBusinessObject(element);
3732
-
3733
- var task = renderer('bpmn:Task')(parentGfx, element);
3734
- var pathData;
3735
-
3736
- if (semantic.instantiate) {
3737
- drawCircle(parentGfx, 28, 28, 20 * 0.22, { strokeWidth: 1 });
3738
-
3739
- pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
3740
- abspos: {
3741
- x: 7.77,
3742
- y: 9.52
3743
- }
3744
- });
3745
- } else {
3746
-
3747
- pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
3748
- xScaleFactor: 0.9,
3749
- yScaleFactor: 0.9,
3750
- containerWidth: 21,
3751
- containerHeight: 14,
3752
- position: {
3753
- mx: 0.3,
3754
- my: 0.4
3755
- }
3756
- });
3757
- }
3758
-
3759
- /* receive path */ drawPath(parentGfx, pathData, {
3599
+ drawMarker('compensation', parentGfx, markerMath, {
3760
3600
  strokeWidth: 1,
3761
- fill: getFillColor(element, defaultFillColor),
3762
- stroke: getStrokeColor(element, defaultStrokeColor)
3601
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3602
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3763
3603
  });
3764
-
3765
- return task;
3766
3604
  },
3767
- 'bpmn:ScriptTask': function(parentGfx, element) {
3768
- var task = renderer('bpmn:Task')(parentGfx, element);
3605
+ 'LoopMarker': function(parentGfx, element, attrs) {
3606
+ var width = getWidth(element, attrs),
3607
+ height = getHeight(element, attrs);
3769
3608
 
3770
- var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
3771
- abspos: {
3772
- x: 15,
3773
- y: 20
3609
+ var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
3610
+ xScaleFactor: 1,
3611
+ yScaleFactor: 1,
3612
+ containerWidth: width,
3613
+ containerHeight: height,
3614
+ position: {
3615
+ mx: ((width / 2 + attrs.loop) / width),
3616
+ my: (height - 7) / height
3774
3617
  }
3775
3618
  });
3776
3619
 
3777
- /* script path */ drawPath(parentGfx, pathData, {
3778
- strokeWidth: 1,
3779
- stroke: getStrokeColor(element, defaultStrokeColor)
3620
+ drawMarker('loop', parentGfx, markerPath, {
3621
+ strokeWidth: 1.5,
3622
+ fill: 'none',
3623
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3624
+ strokeMiterlimit: 0.5
3780
3625
  });
3781
-
3782
- return task;
3783
3626
  },
3784
- 'bpmn:BusinessRuleTask': function(parentGfx, element) {
3785
- var task = renderer('bpmn:Task')(parentGfx, element);
3627
+ 'AdhocMarker': function(parentGfx, element, attrs) {
3628
+ var width = getWidth(element, attrs),
3629
+ height = getHeight(element, attrs);
3786
3630
 
3787
- var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
3788
- abspos: {
3789
- x: 8,
3790
- y: 8
3631
+ var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
3632
+ xScaleFactor: 1,
3633
+ yScaleFactor: 1,
3634
+ containerWidth: width,
3635
+ containerHeight: height,
3636
+ position: {
3637
+ mx: ((width / 2 + attrs.adhoc) / width),
3638
+ my: (height - 15) / height
3791
3639
  }
3792
3640
  });
3793
3641
 
3794
- var businessHeaderPath = drawPath(parentGfx, headerPathData);
3795
- attr$1(businessHeaderPath, {
3642
+ drawMarker('adhoc', parentGfx, markerPath, {
3796
3643
  strokeWidth: 1,
3797
- fill: getFillColor(element, '#aaaaaa'),
3798
- stroke: getStrokeColor(element, defaultStrokeColor)
3644
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3645
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3799
3646
  });
3647
+ }
3648
+ };
3800
3649
 
3801
- var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
3802
- abspos: {
3803
- x: 8,
3804
- y: 8
3805
- }
3806
- });
3650
+ function renderTaskMarker(type, parentGfx, element, attrs) {
3651
+ taskMarkerRenderers[ type ](parentGfx, element, attrs);
3652
+ }
3807
3653
 
3808
- var businessPath = drawPath(parentGfx, headerData);
3809
- attr$1(businessPath, {
3810
- strokeWidth: 1,
3811
- stroke: getStrokeColor(element, defaultStrokeColor)
3812
- });
3654
+ function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) {
3655
+ attrs = {
3656
+ fill: attrs.fill,
3657
+ stroke: attrs.stroke,
3658
+ width: getWidth(element, attrs),
3659
+ height: getHeight(element, attrs)
3660
+ };
3813
3661
 
3814
- return task;
3815
- },
3816
- 'bpmn:SubProcess': function(parentGfx, element, attrs) {
3662
+ var semantic = getBusinessObject(element);
3663
+
3664
+ var subprocess = taskMarkers && taskMarkers.includes('SubProcessMarker');
3665
+
3666
+ if (subprocess) {
3817
3667
  attrs = {
3818
- fill: getFillColor(element, defaultFillColor),
3819
- stroke: getStrokeColor(element, defaultStrokeColor),
3820
- ...attrs
3668
+ ...attrs,
3669
+ seq: -21,
3670
+ parallel: -22,
3671
+ compensation: -42,
3672
+ loop: -18,
3673
+ adhoc: 10
3821
3674
  };
3675
+ } else {
3676
+ attrs = {
3677
+ ...attrs,
3678
+ seq: -5,
3679
+ parallel: -6,
3680
+ compensation: -27,
3681
+ loop: 0,
3682
+ adhoc: 10
3683
+ };
3684
+ }
3822
3685
 
3823
- var rect = renderer('bpmn:Activity')(parentGfx, element, attrs);
3686
+ forEach$1(taskMarkers, function(marker) {
3687
+ renderTaskMarker(marker, parentGfx, element, attrs);
3688
+ });
3824
3689
 
3825
- var expanded = isExpanded(element);
3690
+ if (semantic.get('isForCompensation')) {
3691
+ renderTaskMarker('CompensationMarker', parentGfx, element, attrs);
3692
+ }
3826
3693
 
3827
- if (isEventSubProcess(element)) {
3828
- attr$1(rect, {
3829
- strokeDasharray: '0, 5.5',
3830
- strokeWidth: 2.5
3831
- });
3694
+ if (is$1(semantic, 'bpmn:AdHocSubProcess')) {
3695
+ renderTaskMarker('AdhocMarker', parentGfx, element, attrs);
3696
+ }
3697
+
3698
+ var loopCharacteristics = semantic.get('loopCharacteristics'),
3699
+ isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
3700
+
3701
+ if (loopCharacteristics) {
3702
+
3703
+ if (isSequential === undefined) {
3704
+ renderTaskMarker('LoopMarker', parentGfx, element, attrs);
3832
3705
  }
3833
3706
 
3834
- renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle');
3707
+ if (isSequential === false) {
3708
+ renderTaskMarker('ParallelMarker', parentGfx, element, attrs);
3709
+ }
3835
3710
 
3836
- if (expanded) {
3837
- attachTaskMarkers(parentGfx, element);
3838
- } else {
3839
- attachTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ]);
3711
+ if (isSequential === true) {
3712
+ renderTaskMarker('SequentialMarker', parentGfx, element, attrs);
3840
3713
  }
3714
+ }
3715
+ }
3841
3716
 
3842
- return rect;
3843
- },
3844
- 'bpmn:AdHocSubProcess': function(parentGfx, element) {
3845
- return renderer('bpmn:SubProcess')(parentGfx, element);
3846
- },
3847
- 'bpmn:Transaction': function(parentGfx, element) {
3848
- var outer = renderer('bpmn:SubProcess')(parentGfx, element, { strokeWidth: 1.5 });
3717
+ function renderLabel(parentGfx, label, attrs = {}) {
3718
+ attrs = assign$1({
3719
+ size: {
3720
+ width: 100
3721
+ }
3722
+ }, attrs);
3849
3723
 
3850
- var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
3851
- stroke: getStrokeColor(element, defaultStrokeColor),
3852
- strokeWidth: 1.5
3724
+ var text = textRenderer.createText(label || '', attrs);
3725
+
3726
+ classes$1(text).add('djs-label');
3727
+
3728
+ append(parentGfx, text);
3729
+
3730
+ return text;
3731
+ }
3732
+
3733
+ function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
3734
+ var semantic = getBusinessObject(element);
3735
+
3736
+ var box = getBounds({
3737
+ x: element.x,
3738
+ y: element.y,
3739
+ width: element.width,
3740
+ height: element.height
3741
+ }, attrs);
3742
+
3743
+ return renderLabel(parentGfx, semantic.name, {
3744
+ align,
3745
+ box,
3746
+ padding: 7,
3747
+ style: {
3748
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3749
+ }
3750
+ });
3751
+ }
3752
+
3753
+ function renderExternalLabel(parentGfx, element, attrs = {}) {
3754
+ var box = {
3755
+ width: 90,
3756
+ height: 30,
3757
+ x: element.width / 2 + element.x,
3758
+ y: element.height / 2 + element.y
3759
+ };
3760
+
3761
+ return renderLabel(parentGfx, getLabel(element), {
3762
+ box: box,
3763
+ fitBox: true,
3764
+ style: assign$1(
3765
+ {},
3766
+ textRenderer.getExternalStyle(),
3767
+ {
3768
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3769
+ }
3770
+ )
3771
+ });
3772
+ }
3773
+
3774
+ function renderLaneLabel(parentGfx, text, element, attrs = {}) {
3775
+ var textBox = renderLabel(parentGfx, text, {
3776
+ box: {
3777
+ height: 30,
3778
+ width: getHeight(element, attrs),
3779
+ },
3780
+ align: 'center-middle',
3781
+ style: {
3782
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3783
+ }
3784
+ });
3785
+
3786
+ var top = -1 * getHeight(element, attrs);
3787
+
3788
+ transform(textBox, 0, -top, 270);
3789
+ }
3790
+
3791
+ function renderActivity(parentGfx, element, attrs = {}) {
3792
+ var {
3793
+ width,
3794
+ height
3795
+ } = getBounds(element, attrs);
3796
+
3797
+ return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
3798
+ ...attrs,
3799
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3800
+ fillOpacity: DEFAULT_OPACITY,
3801
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3802
+ });
3803
+ }
3804
+
3805
+ function renderAssociation(parentGfx, element, attrs = {}) {
3806
+ var semantic = getBusinessObject(element);
3807
+
3808
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
3809
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3810
+
3811
+ if (semantic.get('associationDirection') === 'One' ||
3812
+ semantic.get('associationDirection') === 'Both') {
3813
+ attrs.markerEnd = marker('association-end', fill, stroke);
3814
+ }
3815
+
3816
+ if (semantic.get('associationDirection') === 'Both') {
3817
+ attrs.markerStart = marker('association-start', fill, stroke);
3818
+ }
3819
+
3820
+ attrs = pickAttrs(attrs, [
3821
+ 'markerStart',
3822
+ 'markerEnd'
3823
+ ]);
3824
+
3825
+ return drawConnectionSegments(parentGfx, element.waypoints, {
3826
+ ...attrs,
3827
+ stroke,
3828
+ strokeDasharray: '0, 5'
3829
+ });
3830
+ }
3831
+
3832
+ function renderDataObject(parentGfx, element, attrs = {}) {
3833
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
3834
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3835
+
3836
+ var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
3837
+ xScaleFactor: 1,
3838
+ yScaleFactor: 1,
3839
+ containerWidth: element.width,
3840
+ containerHeight: element.height,
3841
+ position: {
3842
+ mx: 0.474,
3843
+ my: 0.296
3844
+ }
3845
+ });
3846
+
3847
+ var dataObject = drawPath(parentGfx, pathData, {
3848
+ fill,
3849
+ fillOpacity: DEFAULT_OPACITY,
3850
+ stroke
3851
+ });
3852
+
3853
+ var semantic = getBusinessObject(element);
3854
+
3855
+ if (isCollection(semantic)) {
3856
+ var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
3857
+ xScaleFactor: 1,
3858
+ yScaleFactor: 1,
3859
+ containerWidth: element.width,
3860
+ containerHeight: element.height,
3861
+ position: {
3862
+ mx: 0.33,
3863
+ my: (element.height - 18) / element.height
3864
+ }
3853
3865
  });
3854
3866
 
3855
- /* inner path */ drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS - 3, INNER_OUTER_DIST, innerAttrs);
3867
+ drawPath(parentGfx, collectionPathData, {
3868
+ strokeWidth: 2,
3869
+ fill,
3870
+ stroke
3871
+ });
3872
+ }
3856
3873
 
3857
- return outer;
3858
- },
3859
- 'bpmn:CallActivity': function(parentGfx, element) {
3860
- return renderer('bpmn:SubProcess')(parentGfx, element, {
3861
- strokeWidth: 5
3874
+ return dataObject;
3875
+ }
3876
+
3877
+ function renderEvent(parentGfx, element, attrs = {}) {
3878
+ return drawCircle(parentGfx, element.width, element.height, {
3879
+ fillOpacity: DEFAULT_OPACITY,
3880
+ ...attrs,
3881
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3882
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3883
+ });
3884
+ }
3885
+
3886
+ function renderGateway(parentGfx, element, attrs = {}) {
3887
+ return drawDiamond(parentGfx, element.width, element.height, {
3888
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3889
+ fillOpacity: DEFAULT_OPACITY,
3890
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3891
+ });
3892
+ }
3893
+
3894
+ function renderLane(parentGfx, element, attrs = {}) {
3895
+ var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
3896
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3897
+ fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
3898
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3899
+ strokeWidth: 1.5
3900
+ });
3901
+
3902
+ var semantic = getBusinessObject(element);
3903
+
3904
+ if (is$1(semantic, 'bpmn:Lane')) {
3905
+ var text = semantic.get('name');
3906
+
3907
+ renderLaneLabel(parentGfx, text, element, attrs);
3908
+ }
3909
+
3910
+ return lane;
3911
+ }
3912
+
3913
+ function renderSubProcess(parentGfx, element, attrs = {}) {
3914
+ var activity = renderActivity(parentGfx, element, attrs);
3915
+
3916
+ if (isEventSubProcess(element)) {
3917
+ attr$1(activity, {
3918
+ strokeDasharray: '0, 5.5',
3919
+ strokeWidth: 2.5
3862
3920
  });
3863
- },
3864
- 'bpmn:Participant': function(parentGfx, element) {
3921
+ }
3865
3922
 
3866
- var strokeWidth = 1.5;
3923
+ var expanded = isExpanded(element);
3867
3924
 
3868
- var attrs = {
3869
- fillOpacity: DEFAULT_FILL_OPACITY,
3870
- fill: getFillColor(element, defaultFillColor),
3871
- stroke: getStrokeColor(element, defaultStrokeColor),
3872
- strokeWidth
3873
- };
3925
+ renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
3926
+
3927
+ if (expanded) {
3928
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
3929
+ } else {
3930
+ renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs);
3931
+ }
3874
3932
 
3875
- var lane = renderer('bpmn:Lane')(parentGfx, element, attrs);
3933
+ return activity;
3934
+ }
3876
3935
 
3877
- var expandedPool = isExpanded(element);
3936
+ function renderTask(parentGfx, element, attrs = {}) {
3937
+ var activity = renderActivity(parentGfx, element, attrs);
3878
3938
 
3879
- if (expandedPool) {
3880
- drawLine(parentGfx, [
3881
- { x: 30, y: 0 },
3882
- { x: 30, y: element.height }
3883
- ], {
3884
- stroke: getStrokeColor(element, defaultStrokeColor),
3885
- strokeWidth
3886
- });
3887
- var text = getBusinessObject(element).name;
3888
- renderLaneLabel(parentGfx, text, element);
3889
- } else {
3939
+ renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs);
3890
3940
 
3891
- // collapsed pool draw text inline
3892
- var text2 = getBusinessObject(element).name;
3893
- renderLabel(parentGfx, text2, {
3894
- box: element, align: 'center-middle',
3895
- style: {
3896
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
3897
- }
3898
- });
3899
- }
3941
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
3900
3942
 
3901
- var participantMultiplicity = !!(getBusinessObject(element).participantMultiplicity);
3943
+ return activity;
3944
+ }
3902
3945
 
3903
- if (participantMultiplicity) {
3904
- renderer('ParticipantMultiplicityMarker')(parentGfx, element);
3946
+ var handlers = this.handlers = {
3947
+ 'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) {
3948
+ if (isExpanded(element)) {
3949
+ attrs = pickAttrs(attrs, [
3950
+ 'fill',
3951
+ 'stroke',
3952
+ 'width',
3953
+ 'height'
3954
+ ]);
3955
+ } else {
3956
+ attrs = pickAttrs(attrs, [
3957
+ 'fill',
3958
+ 'stroke'
3959
+ ]);
3905
3960
  }
3906
3961
 
3907
- return lane;
3962
+ return renderSubProcess(parentGfx, element, attrs);
3908
3963
  },
3909
- 'bpmn:Lane': function(parentGfx, element, attrs) {
3910
- var rect = drawRect(parentGfx, element.width, element.height, 0, {
3911
- fill: getFillColor(element, defaultFillColor),
3912
- fillOpacity: HIGH_FILL_OPACITY,
3913
- stroke: getStrokeColor(element, defaultStrokeColor),
3964
+ 'bpmn:Association': function(parentGfx, element, attrs = {}) {
3965
+ attrs = pickAttrs(attrs, [
3966
+ 'fill',
3967
+ 'stroke'
3968
+ ]);
3969
+
3970
+ return renderAssociation(parentGfx, element, attrs);
3971
+ },
3972
+ 'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) {
3973
+ var { renderIcon = true } = attrs;
3974
+
3975
+ attrs = pickAttrs(attrs, [
3976
+ 'fill',
3977
+ 'stroke'
3978
+ ]);
3979
+
3980
+ var semantic = getBusinessObject(element),
3981
+ cancelActivity = semantic.get('cancelActivity');
3982
+
3983
+ attrs = {
3914
3984
  strokeWidth: 1.5,
3915
- ...attrs
3916
- });
3985
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3986
+ fillOpacity: FULL_OPACITY,
3987
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3988
+ };
3917
3989
 
3918
- var semantic = getBusinessObject(element);
3990
+ if (!cancelActivity) {
3991
+ attrs.strokeDasharray = '6';
3992
+ }
3919
3993
 
3920
- if (semantic.$type === 'bpmn:Lane') {
3921
- var text = semantic.name;
3922
- renderLaneLabel(parentGfx, text, element);
3994
+ var event = renderEvent(parentGfx, element, attrs);
3995
+
3996
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
3997
+ ...attrs,
3998
+ fill: 'none'
3999
+ });
4000
+
4001
+ if (renderIcon) {
4002
+ renderEventIcon(element, parentGfx, attrs);
3923
4003
  }
3924
4004
 
3925
- return rect;
4005
+ return event;
3926
4006
  },
3927
- 'bpmn:InclusiveGateway': function(parentGfx, element) {
3928
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4007
+ 'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) {
4008
+ attrs = pickAttrs(attrs, [
4009
+ 'fill',
4010
+ 'stroke'
4011
+ ]);
3929
4012
 
3930
- /* circle path */
3931
- drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
3932
- strokeWidth: 2.5,
3933
- fill: getFillColor(element, defaultFillColor),
3934
- stroke: getStrokeColor(element, defaultStrokeColor)
4013
+ var task = renderTask(parentGfx, element, attrs);
4014
+
4015
+ var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
4016
+ abspos: {
4017
+ x: 8,
4018
+ y: 8
4019
+ }
3935
4020
  });
3936
4021
 
3937
- return diamond;
3938
- },
3939
- 'bpmn:ExclusiveGateway': function(parentGfx, element) {
3940
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4022
+ var businessPath = drawPath(parentGfx, headerData);
3941
4023
 
3942
- var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
3943
- xScaleFactor: 0.4,
3944
- yScaleFactor: 0.4,
3945
- containerWidth: element.width,
3946
- containerHeight: element.height,
3947
- position: {
3948
- mx: 0.32,
3949
- my: 0.3
4024
+ attr$1(businessPath, {
4025
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4026
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4027
+ strokeWidth: 1
4028
+ });
4029
+
4030
+ var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
4031
+ abspos: {
4032
+ x: 8,
4033
+ y: 8
3950
4034
  }
3951
4035
  });
3952
4036
 
3953
- if ((getDi(element).isMarkerVisible)) {
3954
- drawPath(parentGfx, pathData, {
3955
- strokeWidth: 1,
3956
- fill: getStrokeColor(element, defaultStrokeColor),
3957
- stroke: getStrokeColor(element, defaultStrokeColor)
3958
- });
3959
- }
4037
+ var businessHeaderPath = drawPath(parentGfx, headerPathData);
3960
4038
 
3961
- return diamond;
4039
+ attr$1(businessHeaderPath, {
4040
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4041
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4042
+ strokeWidth: 1
4043
+ });
4044
+
4045
+ return task;
4046
+ },
4047
+ 'bpmn:CallActivity': function(parentGfx, element, attrs = {}) {
4048
+ attrs = pickAttrs(attrs, [
4049
+ 'fill',
4050
+ 'stroke'
4051
+ ]);
4052
+
4053
+ return renderSubProcess(parentGfx, element, {
4054
+ strokeWidth: 5,
4055
+ ...attrs
4056
+ });
3962
4057
  },
3963
- 'bpmn:ComplexGateway': function(parentGfx, element) {
3964
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4058
+ 'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) {
4059
+ attrs = pickAttrs(attrs, [
4060
+ 'fill',
4061
+ 'stroke'
4062
+ ]);
4063
+
4064
+ var gateway = renderGateway(parentGfx, element, attrs);
3965
4065
 
3966
4066
  var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
3967
4067
  xScaleFactor: 0.5,
@@ -3974,50 +4074,142 @@
3974
4074
  }
3975
4075
  });
3976
4076
 
3977
- /* complex path */ drawPath(parentGfx, pathData, {
4077
+ drawPath(parentGfx, pathData, {
4078
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4079
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4080
+ strokeWidth: 1
4081
+ });
4082
+
4083
+ return gateway;
4084
+ },
4085
+ 'bpmn:DataInput': function(parentGfx, element, attrs = {}) {
4086
+ attrs = pickAttrs(attrs, [
4087
+ 'fill',
4088
+ 'stroke'
4089
+ ]);
4090
+
4091
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4092
+
4093
+ var dataObject = renderDataObject(parentGfx, element, attrs);
4094
+
4095
+ drawPath(parentGfx, arrowPathData, {
4096
+ fill: 'none',
4097
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4098
+ strokeWidth: 1
4099
+ });
4100
+
4101
+ return dataObject;
4102
+ },
4103
+ 'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) {
4104
+ attrs = pickAttrs(attrs, [
4105
+ 'fill',
4106
+ 'stroke'
4107
+ ]);
4108
+
4109
+ return renderAssociation(parentGfx, element, {
4110
+ ...attrs,
4111
+ markerEnd: marker('association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
4112
+ });
4113
+ },
4114
+ 'bpmn:DataObject': function(parentGfx, element, attrs = {}) {
4115
+ attrs = pickAttrs(attrs, [
4116
+ 'fill',
4117
+ 'stroke'
4118
+ ]);
4119
+
4120
+ return renderDataObject(parentGfx, element, attrs);
4121
+ },
4122
+ 'bpmn:DataObjectReference': as('bpmn:DataObject'),
4123
+ 'bpmn:DataOutput': function(parentGfx, element, attrs = {}) {
4124
+ attrs = pickAttrs(attrs, [
4125
+ 'fill',
4126
+ 'stroke'
4127
+ ]);
4128
+
4129
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4130
+
4131
+ var dataObject = renderDataObject(parentGfx, element, attrs);
4132
+
4133
+ drawPath(parentGfx, arrowPathData, {
3978
4134
  strokeWidth: 1,
3979
- fill: getStrokeColor(element, defaultStrokeColor),
3980
- stroke: getStrokeColor(element, defaultStrokeColor)
4135
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4136
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3981
4137
  });
3982
4138
 
3983
- return diamond;
4139
+ return dataObject;
3984
4140
  },
3985
- 'bpmn:ParallelGateway': function(parentGfx, element) {
3986
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4141
+ 'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) {
4142
+ attrs = pickAttrs(attrs, [
4143
+ 'fill',
4144
+ 'stroke'
4145
+ ]);
3987
4146
 
3988
- var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
3989
- xScaleFactor: 0.6,
3990
- yScaleFactor:0.6,
4147
+ return renderAssociation(parentGfx, element, {
4148
+ ...attrs,
4149
+ markerEnd: marker('association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
4150
+ });
4151
+ },
4152
+ 'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) {
4153
+ attrs = pickAttrs(attrs, [
4154
+ 'fill',
4155
+ 'stroke'
4156
+ ]);
4157
+
4158
+ var dataStorePath = pathMap.getScaledPath('DATA_STORE', {
4159
+ xScaleFactor: 1,
4160
+ yScaleFactor: 1,
3991
4161
  containerWidth: element.width,
3992
4162
  containerHeight: element.height,
3993
4163
  position: {
3994
- mx: 0.46,
3995
- my: 0.2
4164
+ mx: 0,
4165
+ my: 0.133
3996
4166
  }
3997
4167
  });
3998
4168
 
3999
- /* parallel path */ drawPath(parentGfx, pathData, {
4000
- strokeWidth: 1,
4001
- fill: getStrokeColor(element, defaultStrokeColor),
4002
- stroke: getStrokeColor(element, defaultStrokeColor)
4169
+ return drawPath(parentGfx, dataStorePath, {
4170
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4171
+ fillOpacity: DEFAULT_OPACITY,
4172
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4173
+ strokeWidth: 2
4003
4174
  });
4175
+ },
4176
+ 'bpmn:EndEvent': function(parentGfx, element, attrs = {}) {
4177
+ var { renderIcon = true } = attrs;
4004
4178
 
4005
- return diamond;
4179
+ attrs = pickAttrs(attrs, [
4180
+ 'fill',
4181
+ 'stroke'
4182
+ ]);
4183
+
4184
+ var event = renderEvent(parentGfx, element, {
4185
+ ...attrs,
4186
+ strokeWidth: 4
4187
+ });
4188
+
4189
+ if (renderIcon) {
4190
+ renderEventIcon(element, parentGfx, attrs);
4191
+ }
4192
+
4193
+ return event;
4006
4194
  },
4007
- 'bpmn:EventBasedGateway': function(parentGfx, element) {
4195
+ 'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) {
4196
+ attrs = pickAttrs(attrs, [
4197
+ 'fill',
4198
+ 'stroke'
4199
+ ]);
4008
4200
 
4009
4201
  var semantic = getBusinessObject(element);
4010
4202
 
4011
- var diamond = renderer('bpmn:Gateway')(parentGfx, element);
4203
+ var diamond = renderGateway(parentGfx, element, attrs);
4012
4204
 
4013
- /* outer circle path */ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
4014
- strokeWidth: 1,
4015
- fill: 'none',
4016
- stroke: getStrokeColor(element, defaultStrokeColor)
4205
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
4206
+ fill: getFillColor(element, 'none', attrs.fill),
4207
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4208
+ strokeWidth: 1
4017
4209
  });
4018
4210
 
4019
- var type = semantic.eventGatewayType;
4020
- var instantiate = !!semantic.instantiate;
4211
+ var type = semantic.get('eventGatewayType'),
4212
+ instantiate = !!semantic.get('instantiate');
4021
4213
 
4022
4214
  function drawEvent() {
4023
4215
 
@@ -4032,18 +4224,17 @@
4032
4224
  }
4033
4225
  });
4034
4226
 
4035
- /* event path */ drawPath(parentGfx, pathData, {
4036
- strokeWidth: 2,
4037
- fill: getFillColor(element, 'none'),
4038
- stroke: getStrokeColor(element, defaultStrokeColor)
4227
+ drawPath(parentGfx, pathData, {
4228
+ fill: 'none',
4229
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4230
+ strokeWidth: 2
4039
4231
  });
4040
4232
  }
4041
4233
 
4042
4234
  if (type === 'Parallel') {
4043
-
4044
4235
  var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4045
4236
  xScaleFactor: 0.4,
4046
- yScaleFactor:0.4,
4237
+ yScaleFactor: 0.4,
4047
4238
  containerWidth: element.width,
4048
4239
  containerHeight: element.height,
4049
4240
  position: {
@@ -4053,16 +4244,16 @@
4053
4244
  });
4054
4245
 
4055
4246
  drawPath(parentGfx, pathData, {
4056
- strokeWidth: 1,
4057
- fill: 'none'
4247
+ fill: 'none',
4248
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4249
+ strokeWidth: 1
4058
4250
  });
4059
4251
  } else if (type === 'Exclusive') {
4060
-
4061
4252
  if (!instantiate) {
4062
4253
  drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
4063
- strokeWidth: 1,
4064
4254
  fill: 'none',
4065
- stroke: getStrokeColor(element, defaultStrokeColor)
4255
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4256
+ strokeWidth: 1
4066
4257
  });
4067
4258
  }
4068
4259
 
@@ -4072,104 +4263,163 @@
4072
4263
 
4073
4264
  return diamond;
4074
4265
  },
4075
- 'bpmn:Gateway': function(parentGfx, element) {
4076
- return drawDiamond(parentGfx, element.width, element.height, {
4077
- fill: getFillColor(element, defaultFillColor),
4078
- fillOpacity: DEFAULT_FILL_OPACITY,
4079
- stroke: getStrokeColor(element, defaultStrokeColor)
4080
- });
4081
- },
4082
- 'bpmn:SequenceFlow': function(parentGfx, element) {
4083
- var fill = getFillColor(element, defaultFillColor),
4084
- stroke = getStrokeColor(element, defaultStrokeColor);
4266
+ 'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) {
4267
+ attrs = pickAttrs(attrs, [
4268
+ 'fill',
4269
+ 'stroke'
4270
+ ]);
4085
4271
 
4086
- var path = drawConnectionSegments(parentGfx, element.waypoints, {
4087
- markerEnd: marker('sequenceflow-end', fill, stroke),
4088
- stroke: getStrokeColor(element, defaultStrokeColor)
4089
- });
4272
+ var gateway = renderGateway(parentGfx, element, attrs);
4090
4273
 
4091
- var sequenceFlow = getBusinessObject(element);
4274
+ var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
4275
+ xScaleFactor: 0.4,
4276
+ yScaleFactor: 0.4,
4277
+ containerWidth: element.width,
4278
+ containerHeight: element.height,
4279
+ position: {
4280
+ mx: 0.32,
4281
+ my: 0.3
4282
+ }
4283
+ });
4092
4284
 
4093
- var source;
4285
+ var di = getDi(element);
4094
4286
 
4095
- if (element.source) {
4096
- source = element.source.businessObject;
4287
+ if (di.get('isMarkerVisible')) {
4288
+ drawPath(parentGfx, pathData, {
4289
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4290
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4291
+ strokeWidth: 1
4292
+ });
4293
+ }
4097
4294
 
4098
- // conditional flow marker
4099
- if (sequenceFlow.conditionExpression && source.$instanceOf('bpmn:Activity')) {
4100
- attr$1(path, {
4101
- markerStart: marker('conditional-flow-marker', fill, stroke)
4102
- });
4103
- }
4295
+ return gateway;
4296
+ },
4297
+ 'bpmn:Gateway': function(parentGfx, element, attrs = {}) {
4298
+ attrs = pickAttrs(attrs, [
4299
+ 'fill',
4300
+ 'stroke'
4301
+ ]);
4104
4302
 
4105
- // default marker
4106
- if (source.default && (source.$instanceOf('bpmn:Gateway') || source.$instanceOf('bpmn:Activity')) &&
4107
- source.default === sequenceFlow) {
4108
- attr$1(path, {
4109
- markerStart: marker('conditional-default-flow-marker', fill, stroke)
4110
- });
4111
- }
4112
- }
4303
+ return renderGateway(parentGfx, element, attrs);
4304
+ },
4305
+ 'bpmn:Group': function(parentGfx, element, attrs = {}) {
4306
+ attrs = pickAttrs(attrs, [
4307
+ 'fill',
4308
+ 'stroke',
4309
+ 'width',
4310
+ 'height'
4311
+ ]);
4113
4312
 
4114
- return path;
4313
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
4314
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4315
+ strokeWidth: 1.5,
4316
+ strokeDasharray: '10, 6, 0, 6',
4317
+ fill: 'none',
4318
+ pointerEvents: 'none',
4319
+ width: getWidth(element, attrs),
4320
+ height: getHeight(element, attrs)
4321
+ });
4115
4322
  },
4116
- 'bpmn:Association': function(parentGfx, element, attrs) {
4323
+ 'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) {
4324
+ attrs = pickAttrs(attrs, [
4325
+ 'fill',
4326
+ 'stroke'
4327
+ ]);
4117
4328
 
4118
- var semantic = getBusinessObject(element);
4329
+ var gateway = renderGateway(parentGfx, element, attrs);
4119
4330
 
4120
- var fill = getFillColor(element, defaultFillColor),
4121
- stroke = getStrokeColor(element, defaultStrokeColor);
4331
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
4332
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4333
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4334
+ strokeWidth: 2.5
4335
+ });
4122
4336
 
4123
- attrs = {
4124
- strokeDasharray: '0, 5',
4125
- stroke: getStrokeColor(element, defaultStrokeColor),
4126
- ...attrs
4127
- };
4337
+ return gateway;
4338
+ },
4339
+ 'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) {
4340
+ var { renderIcon = true } = attrs;
4128
4341
 
4129
- if (semantic.associationDirection === 'One' ||
4130
- semantic.associationDirection === 'Both') {
4131
- attrs.markerEnd = marker('association-end', fill, stroke);
4132
- }
4342
+ attrs = pickAttrs(attrs, [
4343
+ 'fill',
4344
+ 'stroke'
4345
+ ]);
4133
4346
 
4134
- if (semantic.associationDirection === 'Both') {
4135
- attrs.markerStart = marker('association-start', fill, stroke);
4347
+ var outer = renderEvent(parentGfx, element, {
4348
+ ...attrs,
4349
+ strokeWidth: 1.5
4350
+ });
4351
+
4352
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4353
+ fill: 'none',
4354
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4355
+ strokeWidth: 1.5
4356
+ });
4357
+
4358
+ if (renderIcon) {
4359
+ renderEventIcon(element, parentGfx, attrs);
4136
4360
  }
4137
4361
 
4138
- return drawConnectionSegments(parentGfx, element.waypoints, attrs);
4362
+ return outer;
4139
4363
  },
4140
- 'bpmn:DataInputAssociation': function(parentGfx, element) {
4141
- var fill = getFillColor(element, defaultFillColor),
4142
- stroke = getStrokeColor(element, defaultStrokeColor);
4143
-
4144
- return renderer('bpmn:Association')(parentGfx, element, {
4145
- markerEnd: marker('association-end', fill, stroke)
4364
+ 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
4365
+ 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
4366
+ 'bpmn:Lane': function(parentGfx, element, attrs = {}) {
4367
+ attrs = pickAttrs(attrs, [
4368
+ 'fill',
4369
+ 'stroke',
4370
+ 'width',
4371
+ 'height'
4372
+ ]);
4373
+
4374
+ return renderLane(parentGfx, element, {
4375
+ ...attrs,
4376
+ fillOpacity: LOW_OPACITY
4146
4377
  });
4147
4378
  },
4148
- 'bpmn:DataOutputAssociation': function(parentGfx, element) {
4149
- var fill = getFillColor(element, defaultFillColor),
4150
- stroke = getStrokeColor(element, defaultStrokeColor);
4379
+ 'bpmn:ManualTask': function(parentGfx, element, attrs = {}) {
4380
+ attrs = pickAttrs(attrs, [
4381
+ 'fill',
4382
+ 'stroke'
4383
+ ]);
4384
+
4385
+ var task = renderTask(parentGfx, element, attrs);
4386
+
4387
+ var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
4388
+ abspos: {
4389
+ x: 17,
4390
+ y: 15
4391
+ }
4392
+ });
4151
4393
 
4152
- return renderer('bpmn:Association')(parentGfx, element, {
4153
- markerEnd: marker('association-end', fill, stroke)
4394
+ drawPath(parentGfx, pathData, {
4395
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4396
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4397
+ strokeWidth: 0.5
4154
4398
  });
4399
+
4400
+ return task;
4155
4401
  },
4156
- 'bpmn:MessageFlow': function(parentGfx, element) {
4402
+ 'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) {
4403
+ attrs = pickAttrs(attrs, [
4404
+ 'fill',
4405
+ 'stroke'
4406
+ ]);
4157
4407
 
4158
4408
  var semantic = getBusinessObject(element),
4159
4409
  di = getDi(element);
4160
4410
 
4161
- var fill = getFillColor(element, defaultFillColor),
4162
- stroke = getStrokeColor(element, defaultStrokeColor);
4411
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
4412
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4163
4413
 
4164
4414
  var path = drawConnectionSegments(parentGfx, element.waypoints, {
4165
4415
  markerEnd: marker('messageflow-end', fill, stroke),
4166
4416
  markerStart: marker('messageflow-start', fill, stroke),
4417
+ stroke,
4167
4418
  strokeDasharray: '10, 11',
4168
- strokeWidth: 1.5,
4169
- stroke: getStrokeColor(element, defaultStrokeColor)
4419
+ strokeWidth: 1.5
4170
4420
  });
4171
4421
 
4172
- if (semantic.messageRef) {
4422
+ if (semantic.get('messageRef')) {
4173
4423
  var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
4174
4424
 
4175
4425
  var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
@@ -4179,24 +4429,28 @@
4179
4429
  }
4180
4430
  });
4181
4431
 
4182
- var messageAttrs = { strokeWidth: 1 };
4432
+ var messageAttrs = {
4433
+ strokeWidth: 1
4434
+ };
4183
4435
 
4184
- if (di.messageVisibleKind === 'initiating') {
4185
- messageAttrs.fill = 'white';
4186
- messageAttrs.stroke = black;
4436
+ if (di.get('messageVisibleKind') === 'initiating') {
4437
+ messageAttrs.fill = fill;
4438
+ messageAttrs.stroke = stroke;
4187
4439
  } else {
4188
- messageAttrs.fill = '#888';
4189
- messageAttrs.stroke = 'white';
4440
+ messageAttrs.fill = stroke;
4441
+ messageAttrs.stroke = fill;
4190
4442
  }
4191
4443
 
4192
4444
  var message = drawPath(parentGfx, markerPathData, messageAttrs);
4193
4445
 
4194
- var labelText = semantic.messageRef.name;
4195
- var label = renderLabel(parentGfx, labelText, {
4446
+ var messageRef = semantic.get('messageRef'),
4447
+ name = messageRef.get('name');
4448
+
4449
+ var label = renderLabel(parentGfx, name, {
4196
4450
  align: 'center-top',
4197
4451
  fitBox: true,
4198
4452
  style: {
4199
- fill: getStrokeColor(element, defaultLabelColor)
4453
+ fill: stroke
4200
4454
  }
4201
4455
  });
4202
4456
 
@@ -4207,143 +4461,340 @@
4207
4461
  translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
4208
4462
 
4209
4463
  transform(label, translateX, translateY, 0);
4210
-
4211
4464
  }
4212
4465
 
4213
4466
  return path;
4214
4467
  },
4215
- 'bpmn:DataObject': function(parentGfx, element) {
4216
- var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
4217
- xScaleFactor: 1,
4218
- yScaleFactor: 1,
4468
+ 'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) {
4469
+ attrs = pickAttrs(attrs, [
4470
+ 'fill',
4471
+ 'stroke'
4472
+ ]);
4473
+
4474
+ var diamond = renderGateway(parentGfx, element, attrs);
4475
+
4476
+ var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4477
+ xScaleFactor: 0.6,
4478
+ yScaleFactor: 0.6,
4219
4479
  containerWidth: element.width,
4220
4480
  containerHeight: element.height,
4221
4481
  position: {
4222
- mx: 0.474,
4223
- my: 0.296
4482
+ mx: 0.46,
4483
+ my: 0.2
4224
4484
  }
4225
4485
  });
4226
4486
 
4227
- var elementObject = drawPath(parentGfx, pathData, {
4228
- fill: getFillColor(element, defaultFillColor),
4229
- fillOpacity: DEFAULT_FILL_OPACITY,
4230
- stroke: getStrokeColor(element, defaultStrokeColor)
4487
+ drawPath(parentGfx, pathData, {
4488
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4489
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4490
+ strokeWidth: 1
4231
4491
  });
4232
4492
 
4233
- var semantic = getBusinessObject(element);
4493
+ return diamond;
4494
+ },
4495
+ 'bpmn:Participant': function(parentGfx, element, attrs = {}) {
4496
+ attrs = pickAttrs(attrs, [
4497
+ 'fill',
4498
+ 'stroke',
4499
+ 'width',
4500
+ 'height'
4501
+ ]);
4502
+
4503
+ var participant = renderLane(parentGfx, element, attrs);
4504
+
4505
+ var expandedParticipant = isExpanded(element);
4506
+
4507
+ var semantic = getBusinessObject(element),
4508
+ name = semantic.get('name');
4509
+
4510
+ if (expandedParticipant) {
4511
+ drawLine(parentGfx, [
4512
+ {
4513
+ x: 30,
4514
+ y: 0
4515
+ },
4516
+ {
4517
+ x: 30,
4518
+ y: getHeight(element, attrs)
4519
+ }
4520
+ ], {
4521
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4522
+ strokeWidth: PARTICIPANT_STROKE_WIDTH
4523
+ });
4524
+
4525
+ renderLaneLabel(parentGfx, name, element, attrs);
4526
+ } else {
4527
+ renderLabel(parentGfx, name, {
4528
+ box: getBounds(element, attrs),
4529
+ align: 'center-middle',
4530
+ style: {
4531
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4532
+ }
4533
+ });
4534
+ }
4234
4535
 
4235
- if (isCollection(semantic)) {
4236
- renderDataItemCollection(parentGfx, element);
4536
+ if (semantic.get('participantMultiplicity')) {
4537
+ renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs);
4237
4538
  }
4238
4539
 
4239
- return elementObject;
4540
+ return participant;
4240
4541
  },
4241
- 'bpmn:DataObjectReference': as('bpmn:DataObject'),
4242
- 'bpmn:DataInput': function(parentGfx, element) {
4542
+ 'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) {
4543
+ attrs = pickAttrs(attrs, [
4544
+ 'fill',
4545
+ 'stroke'
4546
+ ]);
4243
4547
 
4244
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4548
+ var semantic = getBusinessObject(element);
4549
+
4550
+ var task = renderTask(parentGfx, element, attrs);
4245
4551
 
4246
- // page
4247
- var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
4552
+ var pathData;
4553
+
4554
+ if (semantic.get('instantiate')) {
4555
+ drawCircle(parentGfx, 28, 28, 20 * 0.22, {
4556
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4557
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4558
+ strokeWidth: 1
4559
+ });
4560
+
4561
+ pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
4562
+ abspos: {
4563
+ x: 7.77,
4564
+ y: 9.52
4565
+ }
4566
+ });
4567
+ } else {
4568
+ pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4569
+ xScaleFactor: 0.9,
4570
+ yScaleFactor: 0.9,
4571
+ containerWidth: 21,
4572
+ containerHeight: 14,
4573
+ position: {
4574
+ mx: 0.3,
4575
+ my: 0.4
4576
+ }
4577
+ });
4578
+ }
4248
4579
 
4249
- /* input arrow path */ drawPath(parentGfx, arrowPathData, { strokeWidth: 1 });
4580
+ drawPath(parentGfx, pathData, {
4581
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4582
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4583
+ strokeWidth: 1
4584
+ });
4250
4585
 
4251
- return elementObject;
4586
+ return task;
4252
4587
  },
4253
- 'bpmn:DataOutput': function(parentGfx, element) {
4254
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4588
+ 'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) {
4589
+ attrs = pickAttrs(attrs, [
4590
+ 'fill',
4591
+ 'stroke'
4592
+ ]);
4255
4593
 
4256
- // page
4257
- var elementObject = renderer('bpmn:DataObject')(parentGfx, element);
4594
+ var task = renderTask(parentGfx, element, attrs);
4258
4595
 
4259
- /* output arrow path */ drawPath(parentGfx, arrowPathData, {
4260
- strokeWidth: 1,
4261
- fill: black
4596
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
4597
+ abspos: {
4598
+ x: 15,
4599
+ y: 20
4600
+ }
4601
+ });
4602
+
4603
+ drawPath(parentGfx, pathData, {
4604
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4605
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4606
+ strokeWidth: 1
4262
4607
  });
4263
4608
 
4264
- return elementObject;
4609
+ return task;
4265
4610
  },
4266
- 'bpmn:DataStoreReference': function(parentGfx, element) {
4267
- var DATA_STORE_PATH = pathMap.getScaledPath('DATA_STORE', {
4611
+ 'bpmn:SendTask': function(parentGfx, element, attrs = {}) {
4612
+ attrs = pickAttrs(attrs, [
4613
+ 'fill',
4614
+ 'stroke'
4615
+ ]);
4616
+
4617
+ var task = renderTask(parentGfx, element, attrs);
4618
+
4619
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4268
4620
  xScaleFactor: 1,
4269
4621
  yScaleFactor: 1,
4270
- containerWidth: element.width,
4271
- containerHeight: element.height,
4622
+ containerWidth: 21,
4623
+ containerHeight: 14,
4272
4624
  position: {
4273
- mx: 0,
4274
- my: 0.133
4625
+ mx: 0.285,
4626
+ my: 0.357
4627
+ }
4628
+ });
4629
+
4630
+ drawPath(parentGfx, pathData, {
4631
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4632
+ stroke: getFillColor(element, defaultFillColor, attrs.fill),
4633
+ strokeWidth: 1
4634
+ });
4635
+
4636
+ return task;
4637
+ },
4638
+ 'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) {
4639
+ attrs = pickAttrs(attrs, [
4640
+ 'fill',
4641
+ 'stroke'
4642
+ ]);
4643
+
4644
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
4645
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4646
+
4647
+ var connection = drawConnectionSegments(parentGfx, element.waypoints, {
4648
+ markerEnd: marker('sequenceflow-end', fill, stroke),
4649
+ stroke
4650
+ });
4651
+
4652
+ var semantic = getBusinessObject(element);
4653
+
4654
+ var { source } = element;
4655
+
4656
+ if (source) {
4657
+ var sourceSemantic = getBusinessObject(source);
4658
+
4659
+ // conditional flow marker
4660
+ if (semantic.get('conditionExpression') && is$1(sourceSemantic, 'bpmn:Activity')) {
4661
+ attr$1(connection, {
4662
+ markerStart: marker('conditional-flow-marker', fill, stroke)
4663
+ });
4664
+ }
4665
+
4666
+ // default marker
4667
+ if (sourceSemantic.get('default') && (is$1(sourceSemantic, 'bpmn:Gateway') || is$1(sourceSemantic, 'bpmn:Activity')) &&
4668
+ sourceSemantic.get('default') === semantic) {
4669
+ attr$1(connection, {
4670
+ markerStart: marker('conditional-default-flow-marker', fill, stroke)
4671
+ });
4672
+ }
4673
+ }
4674
+
4675
+ return connection;
4676
+ },
4677
+ 'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) {
4678
+ attrs = pickAttrs(attrs, [
4679
+ 'fill',
4680
+ 'stroke'
4681
+ ]);
4682
+
4683
+ var task = renderTask(parentGfx, element, attrs);
4684
+
4685
+ drawCircle(parentGfx, 10, 10, {
4686
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4687
+ stroke: 'none',
4688
+ transform: 'translate(6, 6)'
4689
+ });
4690
+
4691
+ var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4692
+ abspos: {
4693
+ x: 12,
4694
+ y: 18
4275
4695
  }
4276
4696
  });
4277
4697
 
4278
- var elementStore = drawPath(parentGfx, DATA_STORE_PATH, {
4279
- strokeWidth: 2,
4280
- fill: getFillColor(element, defaultFillColor),
4281
- fillOpacity: DEFAULT_FILL_OPACITY,
4282
- stroke: getStrokeColor(element, defaultStrokeColor)
4698
+ drawPath(parentGfx, pathDataService1, {
4699
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4700
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4701
+ strokeWidth: 1
4283
4702
  });
4284
4703
 
4285
- return elementStore;
4286
- },
4287
- 'bpmn:BoundaryEvent': function(parentGfx, element, options) {
4704
+ drawCircle(parentGfx, 10, 10, {
4705
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4706
+ stroke: 'none',
4707
+ transform: 'translate(11, 10)'
4708
+ });
4288
4709
 
4289
- var semantic = getBusinessObject(element),
4290
- cancel = semantic.cancelActivity;
4710
+ var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4711
+ abspos: {
4712
+ x: 17,
4713
+ y: 22
4714
+ }
4715
+ });
4291
4716
 
4292
- var attrs = {
4293
- strokeWidth: 1.5,
4294
- fill: getFillColor(element, defaultFillColor),
4295
- stroke: getStrokeColor(element, defaultStrokeColor)
4296
- };
4717
+ drawPath(parentGfx, pathDataService2, {
4718
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4719
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4720
+ strokeWidth: 1
4721
+ });
4297
4722
 
4298
- if (!cancel) {
4299
- attrs.strokeDasharray = '6';
4300
- }
4723
+ return task;
4724
+ },
4725
+ 'bpmn:StartEvent': function(parentGfx, element, attrs = {}) {
4726
+ var { renderIcon = true } = attrs;
4301
4727
 
4302
- // apply fillOpacity
4303
- var outerAttrs = {
4304
- ...attrs,
4305
- fillOpacity: 1
4306
- };
4728
+ attrs = pickAttrs(attrs, [
4729
+ 'fill',
4730
+ 'stroke'
4731
+ ]);
4307
4732
 
4308
- // apply no-fill
4309
- var innerAttrs = {
4310
- ...attrs,
4311
- fill: 'none'
4312
- };
4733
+ var semantic = getBusinessObject(element);
4313
4734
 
4314
- var outer = renderer('bpmn:Event')(parentGfx, element, outerAttrs);
4735
+ if (!semantic.get('isInterrupting')) {
4736
+ attrs = {
4737
+ ...attrs,
4738
+ strokeDasharray: '6'
4739
+ };
4740
+ }
4315
4741
 
4316
- /* inner path */ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, innerAttrs);
4742
+ var event = renderEvent(parentGfx, element, attrs);
4317
4743
 
4318
- if (!options || options.renderIcon !== false) {
4319
- renderEventContent(element, parentGfx);
4744
+ if (renderIcon) {
4745
+ renderEventIcon(element, parentGfx, attrs);
4320
4746
  }
4321
4747
 
4322
- return outer;
4748
+ return event;
4323
4749
  },
4324
- 'bpmn:Group': function(parentGfx, element) {
4325
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
4326
- stroke: getStrokeColor(element, defaultStrokeColor),
4327
- strokeWidth: 1.5,
4328
- strokeDasharray: '10,6,0,6',
4329
- fill: 'none',
4330
- pointerEvents: 'none'
4331
- });
4750
+ 'bpmn:SubProcess': function(parentGfx, element, attrs = {}) {
4751
+ if (isExpanded(element)) {
4752
+ attrs = pickAttrs(attrs, [
4753
+ 'fill',
4754
+ 'stroke',
4755
+ 'width',
4756
+ 'height'
4757
+ ]);
4758
+ } else {
4759
+ attrs = pickAttrs(attrs, [
4760
+ 'fill',
4761
+ 'stroke'
4762
+ ]);
4763
+ }
4764
+
4765
+ return renderSubProcess(parentGfx, element, attrs);
4332
4766
  },
4333
- 'label': function(parentGfx, element) {
4334
- return renderExternalLabel(parentGfx, element);
4767
+ 'bpmn:Task': function(parentGfx, element, attrs = {}) {
4768
+ attrs = pickAttrs(attrs, [
4769
+ 'fill',
4770
+ 'stroke'
4771
+ ]);
4772
+
4773
+ return renderTask(parentGfx, element, attrs);
4335
4774
  },
4336
- 'bpmn:TextAnnotation': function(parentGfx, element) {
4337
- var textElement = drawRect(parentGfx, element.width, element.height, 0, 0, {
4338
- 'fill': 'none',
4339
- 'stroke': 'none'
4775
+ 'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
4776
+ attrs = pickAttrs(attrs, [
4777
+ 'fill',
4778
+ 'stroke',
4779
+ 'width',
4780
+ 'height'
4781
+ ]);
4782
+
4783
+ var {
4784
+ width,
4785
+ height
4786
+ } = getBounds(element, attrs);
4787
+
4788
+ var textElement = drawRect(parentGfx, width, height, 0, 0, {
4789
+ fill: 'none',
4790
+ stroke: 'none'
4340
4791
  });
4341
4792
 
4342
4793
  var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
4343
4794
  xScaleFactor: 1,
4344
4795
  yScaleFactor: 1,
4345
- containerWidth: element.width,
4346
- containerHeight: element.height,
4796
+ containerWidth: width,
4797
+ containerHeight: height,
4347
4798
  position: {
4348
4799
  mx: 0.0,
4349
4800
  my: 0.0
@@ -4351,232 +4802,121 @@
4351
4802
  });
4352
4803
 
4353
4804
  drawPath(parentGfx, textPathData, {
4354
- stroke: getStrokeColor(element, defaultStrokeColor)
4805
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4355
4806
  });
4356
4807
 
4357
- var text = getBusinessObject(element).text || '';
4808
+ var semantic = getBusinessObject(element),
4809
+ text = semantic.get('text') || '';
4810
+
4358
4811
  renderLabel(parentGfx, text, {
4359
- box: element,
4360
4812
  align: 'left-top',
4813
+ box: getBounds(element, attrs),
4361
4814
  padding: 7,
4362
4815
  style: {
4363
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor)
4816
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4364
4817
  }
4365
4818
  });
4366
4819
 
4367
4820
  return textElement;
4368
4821
  },
4369
- 'ParticipantMultiplicityMarker': function(parentGfx, element) {
4370
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
4371
- xScaleFactor: 1,
4372
- yScaleFactor: 1,
4373
- containerWidth: element.width,
4374
- containerHeight: element.height,
4375
- position: {
4376
- mx: ((element.width / 2) / element.width),
4377
- my: (element.height - 15) / element.height
4378
- }
4379
- });
4822
+ 'bpmn:Transaction': function(parentGfx, element, attrs = {}) {
4823
+ if (isExpanded(element)) {
4824
+ attrs = pickAttrs(attrs, [
4825
+ 'fill',
4826
+ 'stroke',
4827
+ 'width',
4828
+ 'height'
4829
+ ]);
4830
+ } else {
4831
+ attrs = pickAttrs(attrs, [
4832
+ 'fill',
4833
+ 'stroke'
4834
+ ]);
4835
+ }
4380
4836
 
4381
- drawMarker('participant-multiplicity', parentGfx, markerPath, {
4382
- strokeWidth: 2,
4383
- fill: getFillColor(element, defaultFillColor),
4384
- stroke: getStrokeColor(element, defaultStrokeColor)
4837
+ var outer = renderSubProcess(parentGfx, element, {
4838
+ strokeWidth: 1.5,
4839
+ ...attrs
4385
4840
  });
4386
- },
4387
- 'SubProcessMarker': function(parentGfx, element) {
4388
- var markerRect = drawRect(parentGfx, 14, 14, 0, {
4389
- strokeWidth: 1,
4390
- fill: getFillColor(element, defaultFillColor),
4391
- stroke: getStrokeColor(element, defaultStrokeColor)
4841
+
4842
+ var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
4843
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4844
+ strokeWidth: 1.5
4392
4845
  });
4393
4846
 
4394
- // Process marker is placed in the middle of the box
4395
- // therefore fixed values can be used here
4396
- translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
4847
+ var expanded = isExpanded(element);
4397
4848
 
4398
- var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
4399
- xScaleFactor: 1.5,
4400
- yScaleFactor: 1.5,
4401
- containerWidth: element.width,
4402
- containerHeight: element.height,
4403
- position: {
4404
- mx: (element.width / 2 - 7.5) / element.width,
4405
- my: (element.height - 20) / element.height
4406
- }
4407
- });
4849
+ if (!expanded) {
4850
+ attrs = {};
4851
+ }
4408
4852
 
4409
- drawMarker('sub-process', parentGfx, markerPath, {
4410
- fill: getFillColor(element, defaultFillColor),
4411
- stroke: getStrokeColor(element, defaultStrokeColor)
4412
- });
4413
- },
4414
- 'ParallelMarker': function(parentGfx, element, position) {
4415
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
4416
- xScaleFactor: 1,
4417
- yScaleFactor: 1,
4418
- containerWidth: element.width,
4419
- containerHeight: element.height,
4420
- position: {
4421
- mx: ((element.width / 2 + position.parallel) / element.width),
4422
- my: (element.height - 20) / element.height
4423
- }
4424
- });
4853
+ drawRect(
4854
+ parentGfx,
4855
+ getWidth(element, attrs),
4856
+ getHeight(element, attrs),
4857
+ TASK_BORDER_RADIUS - INNER_OUTER_DIST,
4858
+ INNER_OUTER_DIST,
4859
+ innerAttrs
4860
+ );
4425
4861
 
4426
- drawMarker('parallel', parentGfx, markerPath, {
4427
- fill: getFillColor(element, defaultFillColor),
4428
- stroke: getStrokeColor(element, defaultStrokeColor)
4429
- });
4862
+ return outer;
4430
4863
  },
4431
- 'SequentialMarker': function(parentGfx, element, position) {
4432
- var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
4433
- xScaleFactor: 1,
4434
- yScaleFactor: 1,
4435
- containerWidth: element.width,
4436
- containerHeight: element.height,
4437
- position: {
4438
- mx: ((element.width / 2 + position.seq) / element.width),
4439
- my: (element.height - 19) / element.height
4440
- }
4441
- });
4864
+ 'bpmn:UserTask': function(parentGfx, element, attrs = {}) {
4865
+ attrs = pickAttrs(attrs, [
4866
+ 'fill',
4867
+ 'stroke'
4868
+ ]);
4442
4869
 
4443
- drawMarker('sequential', parentGfx, markerPath, {
4444
- fill: getFillColor(element, defaultFillColor),
4445
- stroke: getStrokeColor(element, defaultStrokeColor)
4446
- });
4447
- },
4448
- 'CompensationMarker': function(parentGfx, element, position) {
4449
- var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
4450
- xScaleFactor: 1,
4451
- yScaleFactor: 1,
4452
- containerWidth: element.width,
4453
- containerHeight: element.height,
4454
- position: {
4455
- mx: ((element.width / 2 + position.compensation) / element.width),
4456
- my: (element.height - 13) / element.height
4870
+ var task = renderTask(parentGfx, element, attrs);
4871
+
4872
+ var x = 15;
4873
+ var y = 12;
4874
+
4875
+ var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
4876
+ abspos: {
4877
+ x: x,
4878
+ y: y
4457
4879
  }
4458
4880
  });
4459
4881
 
4460
- drawMarker('compensation', parentGfx, markerMath, {
4461
- strokeWidth: 1,
4462
- fill: getFillColor(element, defaultFillColor),
4463
- stroke: getStrokeColor(element, defaultStrokeColor)
4882
+ drawPath(parentGfx, pathDataUser1, {
4883
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4884
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4885
+ strokeWidth: 0.5
4464
4886
  });
4465
- },
4466
- 'LoopMarker': function(parentGfx, element, position) {
4467
- var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
4468
- xScaleFactor: 1,
4469
- yScaleFactor: 1,
4470
- containerWidth: element.width,
4471
- containerHeight: element.height,
4472
- position: {
4473
- mx: ((element.width / 2 + position.loop) / element.width),
4474
- my: (element.height - 7) / element.height
4887
+
4888
+ var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
4889
+ abspos: {
4890
+ x: x,
4891
+ y: y
4475
4892
  }
4476
4893
  });
4477
4894
 
4478
- drawMarker('loop', parentGfx, markerPath, {
4479
- strokeWidth: 1.5,
4480
- fill: getFillColor(element, defaultFillColor),
4481
- stroke: getStrokeColor(element, defaultStrokeColor),
4482
- strokeMiterlimit: 0.5
4895
+ drawPath(parentGfx, pathDataUser2, {
4896
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4897
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4898
+ strokeWidth: 0.5
4483
4899
  });
4484
- },
4485
- 'AdhocMarker': function(parentGfx, element, position) {
4486
- var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
4487
- xScaleFactor: 1,
4488
- yScaleFactor: 1,
4489
- containerWidth: element.width,
4490
- containerHeight: element.height,
4491
- position: {
4492
- mx: ((element.width / 2 + position.adhoc) / element.width),
4493
- my: (element.height - 15) / element.height
4900
+
4901
+ var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
4902
+ abspos: {
4903
+ x: x,
4904
+ y: y
4494
4905
  }
4495
4906
  });
4496
4907
 
4497
- drawMarker('adhoc', parentGfx, markerPath, {
4498
- strokeWidth: 1,
4499
- fill: getStrokeColor(element, defaultStrokeColor),
4500
- stroke: getStrokeColor(element, defaultStrokeColor)
4908
+ drawPath(parentGfx, pathDataUser3, {
4909
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4910
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4911
+ strokeWidth: 0.5
4501
4912
  });
4502
- }
4503
- };
4504
-
4505
- function attachTaskMarkers(parentGfx, element, taskMarkers) {
4506
- var obj = getBusinessObject(element);
4507
-
4508
- var subprocess = taskMarkers && taskMarkers.indexOf('SubProcessMarker') !== -1;
4509
- var position;
4510
-
4511
- if (subprocess) {
4512
- position = {
4513
- seq: -21,
4514
- parallel: -22,
4515
- compensation: -42,
4516
- loop: -18,
4517
- adhoc: 10
4518
- };
4519
- } else {
4520
- position = {
4521
- seq: -3,
4522
- parallel: -6,
4523
- compensation: -27,
4524
- loop: 0,
4525
- adhoc: 10
4526
- };
4527
- }
4528
-
4529
- forEach$1(taskMarkers, function(marker) {
4530
- renderer(marker)(parentGfx, element, position);
4531
- });
4532
-
4533
- if (obj.isForCompensation) {
4534
- renderer('CompensationMarker')(parentGfx, element, position);
4535
- }
4536
-
4537
- if (obj.$type === 'bpmn:AdHocSubProcess') {
4538
- renderer('AdhocMarker')(parentGfx, element, position);
4539
- }
4540
-
4541
- var loopCharacteristics = obj.loopCharacteristics,
4542
- isSequential = loopCharacteristics && loopCharacteristics.isSequential;
4543
-
4544
- if (loopCharacteristics) {
4545
-
4546
- if (isSequential === undefined) {
4547
- renderer('LoopMarker')(parentGfx, element, position);
4548
- }
4549
-
4550
- if (isSequential === false) {
4551
- renderer('ParallelMarker')(parentGfx, element, position);
4552
- }
4553
4913
 
4554
- if (isSequential === true) {
4555
- renderer('SequentialMarker')(parentGfx, element, position);
4556
- }
4914
+ return task;
4915
+ },
4916
+ 'label': function(parentGfx, element, attrs = {}) {
4917
+ return renderExternalLabel(parentGfx, element, attrs);
4557
4918
  }
4558
- }
4559
-
4560
- function renderDataItemCollection(parentGfx, element) {
4561
-
4562
- var yPosition = (element.height - 18) / element.height;
4563
-
4564
- var pathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
4565
- xScaleFactor: 1,
4566
- yScaleFactor: 1,
4567
- containerWidth: element.width,
4568
- containerHeight: element.height,
4569
- position: {
4570
- mx: 0.33,
4571
- my: yPosition
4572
- }
4573
- });
4574
-
4575
- /* collection path */ drawPath(parentGfx, pathData, {
4576
- strokeWidth: 2
4577
- });
4578
- }
4579
-
4919
+ };
4580
4920
 
4581
4921
  // extension API, use at your own risk
4582
4922
  this._drawPath = drawPath;
@@ -4611,15 +4951,16 @@
4611
4951
  *
4612
4952
  * @param {SVGElement} parentGfx
4613
4953
  * @param {Element} element
4954
+ * @param {Attrs} [attrs]
4614
4955
  *
4615
4956
  * @return {SVGElement} mainGfx
4616
4957
  */
4617
- BpmnRenderer.prototype.drawShape = function(parentGfx, element) {
4618
- var type = element.type;
4619
- var h = this._renderer(type);
4958
+ BpmnRenderer.prototype.drawShape = function(parentGfx, element, attrs = {}) {
4959
+ var { type } = element;
4960
+
4961
+ var handler = this._renderer(type);
4620
4962
 
4621
- /* jshint -W040 */
4622
- return h(parentGfx, element);
4963
+ return handler(parentGfx, element, attrs);
4623
4964
  };
4624
4965
 
4625
4966
  /**
@@ -4627,15 +4968,16 @@
4627
4968
  *
4628
4969
  * @param {SVGElement} parentGfx
4629
4970
  * @param {Element} element
4971
+ * @param {Attrs} [attrs]
4630
4972
  *
4631
4973
  * @return {SVGElement} mainGfx
4632
4974
  */
4633
- BpmnRenderer.prototype.drawConnection = function(parentGfx, element) {
4634
- var type = element.type;
4635
- var h = this._renderer(type);
4975
+ BpmnRenderer.prototype.drawConnection = function(parentGfx, element, attrs = {}) {
4976
+ var { type } = element;
4636
4977
 
4637
- /* jshint -W040 */
4638
- return h(parentGfx, element);
4978
+ var handler = this._renderer(type);
4979
+
4980
+ return handler(parentGfx, element, attrs);
4639
4981
  };
4640
4982
 
4641
4983
  /**
@@ -4646,7 +4988,6 @@
4646
4988
  * @return {string} path
4647
4989
  */
4648
4990
  BpmnRenderer.prototype.getShapePath = function(element) {
4649
-
4650
4991
  if (is$1(element, 'bpmn:Event')) {
4651
4992
  return getCirclePath(element);
4652
4993
  }
@@ -4662,6 +5003,24 @@
4662
5003
  return getRectPath(element);
4663
5004
  };
4664
5005
 
5006
+ /**
5007
+ * Pick attributes if they exist.
5008
+ *
5009
+ * @param {Object} attrs
5010
+ * @param {string[]} keys
5011
+ *
5012
+ * @returns {Object}
5013
+ */
5014
+ function pickAttrs(attrs, keys = []) {
5015
+ return keys.reduce((pickedAttrs, key) => {
5016
+ if (attrs[ key ]) {
5017
+ pickedAttrs[ key ] = attrs[ key ];
5018
+ }
5019
+
5020
+ return pickedAttrs;
5021
+ }, {});
5022
+ }
5023
+
4665
5024
  /**
4666
5025
  * @typedef {import('../util/Types').Dimensions} Dimensions
4667
5026
  *
@@ -6949,6 +7308,8 @@
6949
7308
 
6950
7309
  var LOW_PRIORITY$2 = 500;
6951
7310
 
7311
+ var DEFAULT_PRIORITY$2 = 1000;
7312
+
6952
7313
  /**
6953
7314
  * @typedef {import('../../model/Types').Element} Element
6954
7315
  *
@@ -6967,25 +7328,25 @@
6967
7328
  */
6968
7329
  function Outline(eventBus, styles) {
6969
7330
 
6970
- this.offset = 6;
7331
+ this._eventBus = eventBus;
7332
+
7333
+ this.offset = 5;
6971
7334
 
6972
7335
  var OUTLINE_STYLE = styles.cls('djs-outline', [ 'no-fill' ]);
6973
7336
 
6974
7337
  var self = this;
6975
7338
 
6976
- function createOutline(gfx, bounds) {
7339
+ function createOutline(gfx, element) {
6977
7340
  var outline = create$1('rect');
6978
7341
 
6979
7342
  attr$1(outline, assign$1({
6980
- x: 10,
6981
- y: 10,
7343
+ x: - self.offset,
7344
+ y: - self.offset,
6982
7345
  rx: 4,
6983
- width: 100,
6984
- height: 100
7346
+ width: element.width + self.offset * 2,
7347
+ height: element.height + self.offset * 2
6985
7348
  }, OUTLINE_STYLE));
6986
7349
 
6987
- append(gfx, outline);
6988
-
6989
7350
  return outline;
6990
7351
  }
6991
7352
 
@@ -6998,10 +7359,12 @@
6998
7359
  var outline = query('.djs-outline', gfx);
6999
7360
 
7000
7361
  if (!outline) {
7001
- outline = createOutline(gfx);
7002
- }
7362
+ outline = self.getOutline(element) || createOutline(gfx, element);
7363
+ append(gfx, outline);
7003
7364
 
7004
- self.updateShapeOutline(outline, element);
7365
+ } else {
7366
+ self.updateShapeOutline(outline, element);
7367
+ }
7005
7368
  });
7006
7369
 
7007
7370
  eventBus.on([ 'connection.added', 'connection.changed' ], function(event) {
@@ -7011,7 +7374,8 @@
7011
7374
  var outline = query('.djs-outline', gfx);
7012
7375
 
7013
7376
  if (!outline) {
7014
- outline = createOutline(gfx);
7377
+ outline = createOutline(gfx, element);
7378
+ append(gfx, outline);
7015
7379
  }
7016
7380
 
7017
7381
  self.updateConnectionOutline(outline, element);
@@ -7028,25 +7392,34 @@
7028
7392
  */
7029
7393
  Outline.prototype.updateShapeOutline = function(outline, element) {
7030
7394
 
7031
- attr$1(outline, {
7032
- x: -this.offset,
7033
- y: -this.offset,
7034
- width: element.width + this.offset * 2,
7035
- height: element.height + this.offset * 2
7036
- });
7395
+ var updated = false;
7396
+ var providers = this._getProviders();
7037
7397
 
7038
- };
7398
+ if (providers.length) {
7399
+ forEach$1(providers, function(provider) {
7400
+ updated = updated || provider.updateOutline(element, outline);
7401
+ });
7402
+ }
7039
7403
 
7404
+ if (!updated) {
7405
+ attr$1(outline, {
7406
+ x: -this.offset,
7407
+ y: -this.offset,
7408
+ width: element.width + this.offset * 2,
7409
+ height: element.height + this.offset * 2
7410
+ });
7411
+ }
7412
+ };
7040
7413
 
7041
7414
  /**
7042
7415
  * Updates the outline of a connection respecting the bounding box of
7043
7416
  * the connection and an outline offset.
7417
+ * Register an outline provider with the given priority.
7044
7418
  *
7045
7419
  * @param {SVGElement} outline
7046
7420
  * @param {Element} connection
7047
- */
7421
+ **/
7048
7422
  Outline.prototype.updateConnectionOutline = function(outline, connection) {
7049
-
7050
7423
  var bbox = getBBox(connection);
7051
7424
 
7052
7425
  attr$1(outline, {
@@ -7055,9 +7428,61 @@
7055
7428
  width: bbox.width + this.offset * 2,
7056
7429
  height: bbox.height + this.offset * 2
7057
7430
  });
7431
+ };
7432
+
7433
+ /**
7434
+ * Register an outline provider with the given priority.
7435
+ *
7436
+ * @param {number} priority
7437
+ * @param {OutlineProvider} provider
7438
+ */
7439
+ Outline.prototype.registerProvider = function(priority, provider) {
7440
+ if (!provider) {
7441
+ provider = priority;
7442
+ priority = DEFAULT_PRIORITY$2;
7443
+ }
7444
+
7445
+ this._eventBus.on('outline.getProviders', priority, function(event) {
7446
+ event.providers.push(provider);
7447
+ });
7448
+ };
7449
+
7450
+ /**
7451
+ * Returns the registered outline providers.
7452
+ *
7453
+ * @returns {OutlineProvider[]}
7454
+ */
7455
+ Outline.prototype._getProviders = function() {
7456
+ var event = this._eventBus.createEvent({
7457
+ type: 'outline.getProviders',
7458
+ providers: []
7459
+ });
7058
7460
 
7461
+ this._eventBus.fire(event);
7462
+
7463
+ return event.providers;
7059
7464
  };
7060
7465
 
7466
+ /**
7467
+ * Returns the outline for an element.
7468
+ *
7469
+ * @param {Element} element
7470
+ **/
7471
+ Outline.prototype.getOutline = function(element) {
7472
+ var outline;
7473
+ var providers = this._getProviders();
7474
+
7475
+ forEach$1(providers, function(provider) {
7476
+
7477
+ if (!isFunction(provider.getOutline)) {
7478
+ return;
7479
+ }
7480
+
7481
+ outline = outline || provider.getOutline(element);
7482
+ });
7483
+
7484
+ return outline;
7485
+ };
7061
7486
 
7062
7487
  Outline.$inject = [ 'eventBus', 'styles', 'elementRegistry' ];
7063
7488