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