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