bpmn-js 18.6.1 → 18.6.3

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 v18.6.1
2
+ * bpmn-js - bpmn-navigated-viewer v18.6.3
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: 2025-04-25
11
+ * Date: 2025-08-19
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -2785,2329 +2785,2351 @@
2785
2785
  }
2786
2786
  };
2787
2787
 
2788
- var markerIds = new Ids();
2789
-
2790
- var ELEMENT_LABEL_DISTANCE = 10,
2791
- INNER_OUTER_DIST = 3,
2792
- PARTICIPANT_STROKE_WIDTH = 1.5,
2793
- TASK_BORDER_RADIUS = 10;
2794
-
2795
- var DEFAULT_OPACITY = 0.95,
2796
- FULL_OPACITY = 1,
2797
- LOW_OPACITY = 0.25;
2798
-
2799
- /**
2800
- * @typedef { Partial<{
2801
- * defaultFillColor: string,
2802
- * defaultStrokeColor: string,
2803
- * defaultLabelColor: string
2804
- * }> } BpmnRendererConfig
2805
- *
2806
- * @typedef { Partial<{
2807
- * fill: string,
2808
- * stroke: string,
2809
- * width: string,
2810
- * height: string
2811
- * }> } Attrs
2812
- */
2813
-
2814
- /**
2815
- * @typedef { import('../model/Types').Element } Element
2816
- * @typedef { import('../model/Types').Shape } Shape
2817
- * @typedef { import('../model/Types').Connection } Connection
2818
- */
2819
-
2820
- /**
2821
- * A renderer for BPMN elements
2822
- *
2823
- * @param {BpmnRendererConfig} config
2824
- * @param {import('diagram-js/lib/core/EventBus').default} eventBus
2825
- * @param {import('diagram-js/lib/draw/Styles').default} styles
2826
- * @param {import('./PathMap').default} pathMap
2827
- * @param {import('diagram-js/lib/core/Canvas').default} canvas
2828
- * @param {import('./TextRenderer').default} textRenderer
2829
- * @param {number} [priority]
2830
- */
2831
- function BpmnRenderer(
2832
- config, eventBus, styles, pathMap,
2833
- canvas, textRenderer, priority) {
2834
-
2835
- BaseRenderer.call(this, eventBus, priority);
2836
-
2837
- var defaultFillColor = config && config.defaultFillColor,
2838
- defaultStrokeColor = config && config.defaultStrokeColor,
2839
- defaultLabelColor = config && config.defaultLabelColor;
2840
-
2841
- function shapeStyle(attrs) {
2842
- return styles.computeStyle(attrs, {
2843
- strokeLinecap: 'round',
2844
- strokeLinejoin: 'round',
2845
- stroke: black,
2846
- strokeWidth: 2,
2847
- fill: 'white'
2848
- });
2849
- }
2850
-
2851
- function lineStyle(attrs) {
2852
- return styles.computeStyle(attrs, [ 'no-fill' ], {
2853
- strokeLinecap: 'round',
2854
- strokeLinejoin: 'round',
2855
- stroke: black,
2856
- strokeWidth: 2
2857
- });
2858
- }
2859
-
2860
- function addMarker(id, options) {
2861
- var {
2862
- ref = { x: 0, y: 0 },
2863
- scale = 1,
2864
- element,
2865
- parentGfx = canvas._svg
2866
- } = options;
2867
-
2868
- var marker = create$1('marker', {
2869
- id: id,
2870
- viewBox: '0 0 20 20',
2871
- refX: ref.x,
2872
- refY: ref.y,
2873
- markerWidth: 20 * scale,
2874
- markerHeight: 20 * scale,
2875
- orient: 'auto'
2876
- });
2877
-
2878
- append(marker, element);
2879
-
2880
- var defs = query(':scope > defs', parentGfx);
2881
-
2882
- if (!defs) {
2883
- defs = create$1('defs');
2884
-
2885
- append(parentGfx, defs);
2886
- }
2887
-
2888
- append(defs, marker);
2889
- }
2890
-
2891
- function marker(parentGfx, type, fill, stroke) {
2892
-
2893
-
2894
- var id = markerIds.nextPrefixed('marker-');
2895
-
2896
- createMarker(parentGfx, id, type, fill, stroke);
2897
-
2898
- return 'url(#' + id + ')';
2899
- }
2900
-
2901
- function createMarker(parentGfx, id, type, fill, stroke) {
2902
-
2903
- if (type === 'sequenceflow-end') {
2904
- var sequenceflowEnd = create$1('path', {
2905
- d: 'M 1 5 L 11 10 L 1 15 Z',
2906
- ...shapeStyle({
2907
- fill: stroke,
2908
- stroke: stroke,
2909
- strokeWidth: 1
2910
- })
2911
- });
2912
-
2913
- addMarker(id, {
2914
- element: sequenceflowEnd,
2915
- ref: { x: 11, y: 10 },
2916
- scale: 0.5,
2917
- parentGfx
2918
- });
2919
- }
2920
-
2921
- if (type === 'messageflow-start') {
2922
- var messageflowStart = create$1('circle', {
2923
- cx: 6,
2924
- cy: 6,
2925
- r: 3.5,
2926
- ...shapeStyle({
2927
- fill,
2928
- stroke: stroke,
2929
- strokeWidth: 1,
2930
-
2931
- // fix for safari / chrome / firefox bug not correctly
2932
- // resetting stroke dash array
2933
- strokeDasharray: [ 10000, 1 ]
2934
- })
2935
- });
2936
-
2937
- addMarker(id, {
2938
- element: messageflowStart,
2939
- ref: { x: 6, y: 6 },
2940
- parentGfx
2941
- });
2942
- }
2943
-
2944
- if (type === 'messageflow-end') {
2945
- var messageflowEnd = create$1('path', {
2946
- d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
2947
- ...shapeStyle({
2948
- fill,
2949
- stroke: stroke,
2950
- strokeWidth: 1,
2951
-
2952
- // fix for safari / chrome / firefox bug not correctly
2953
- // resetting stroke dash array
2954
- strokeDasharray: [ 10000, 1 ]
2955
- })
2956
- });
2957
-
2958
- addMarker(id, {
2959
- element: messageflowEnd,
2960
- ref: { x: 8.5, y: 5 },
2961
- parentGfx
2962
- });
2963
- }
2964
-
2965
- if (type === 'association-start') {
2966
- var associationStart = create$1('path', {
2967
- d: 'M 11 5 L 1 10 L 11 15',
2968
- ...lineStyle({
2969
- fill: 'none',
2970
- stroke,
2971
- strokeWidth: 1.5,
2972
-
2973
- // fix for safari / chrome / firefox bug not correctly
2974
- // resetting stroke dash array
2975
- strokeDasharray: [ 10000, 1 ]
2976
- })
2977
- });
2978
-
2979
- addMarker(id, {
2980
- element: associationStart,
2981
- ref: { x: 1, y: 10 },
2982
- scale: 0.5,
2983
- parentGfx
2984
- });
2985
- }
2986
-
2987
- if (type === 'association-end') {
2988
- var associationEnd = create$1('path', {
2989
- d: 'M 1 5 L 11 10 L 1 15',
2990
- ...lineStyle({
2991
- fill: 'none',
2992
- stroke,
2993
- strokeWidth: 1.5,
2994
-
2995
- // fix for safari / chrome / firefox bug not correctly
2996
- // resetting stroke dash array
2997
- strokeDasharray: [ 10000, 1 ]
2998
- })
2999
- });
3000
-
3001
- addMarker(id, {
3002
- element: associationEnd,
3003
- ref: { x: 11, y: 10 },
3004
- scale: 0.5,
3005
- parentGfx
3006
- });
3007
- }
3008
-
3009
- if (type === 'conditional-flow-marker') {
3010
- var conditionalFlowMarker = create$1('path', {
3011
- d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
3012
- ...shapeStyle({
3013
- fill,
3014
- stroke: stroke
3015
- })
3016
- });
3017
-
3018
- addMarker(id, {
3019
- element: conditionalFlowMarker,
3020
- ref: { x: -1, y: 10 },
3021
- scale: 0.5,
3022
- parentGfx
3023
- });
3024
- }
3025
-
3026
- if (type === 'conditional-default-flow-marker') {
3027
- var defaultFlowMarker = create$1('path', {
3028
- d: 'M 6 4 L 10 16',
3029
- ...shapeStyle({
3030
- stroke: stroke,
3031
- fill: 'none'
3032
- })
3033
- });
3034
-
3035
- addMarker(id, {
3036
- element: defaultFlowMarker,
3037
- ref: { x: 0, y: 10 },
3038
- scale: 0.5,
3039
- parentGfx
3040
- });
3041
- }
3042
- }
3043
-
3044
- function drawCircle(parentGfx, width, height, offset, attrs = {}) {
3045
-
3046
- if (isObject(offset)) {
3047
- attrs = offset;
3048
- offset = 0;
3049
- }
3050
-
3051
- offset = offset || 0;
3052
-
3053
- attrs = shapeStyle(attrs);
3054
-
3055
- var cx = width / 2,
3056
- cy = height / 2;
3057
-
3058
- var circle = create$1('circle', {
3059
- cx: cx,
3060
- cy: cy,
3061
- r: Math.round((width + height) / 4 - offset),
3062
- ...attrs
3063
- });
3064
-
3065
- append(parentGfx, circle);
3066
-
3067
- return circle;
3068
- }
3069
-
3070
- function drawRect(parentGfx, width, height, r, offset, attrs) {
3071
-
3072
- if (isObject(offset)) {
3073
- attrs = offset;
3074
- offset = 0;
3075
- }
3076
-
3077
- offset = offset || 0;
3078
-
3079
- attrs = shapeStyle(attrs);
3080
-
3081
- var rect = create$1('rect', {
3082
- x: offset,
3083
- y: offset,
3084
- width: width - offset * 2,
3085
- height: height - offset * 2,
3086
- rx: r,
3087
- ry: r,
3088
- ...attrs
3089
- });
3090
-
3091
- append(parentGfx, rect);
3092
-
3093
- return rect;
3094
- }
3095
-
3096
- function drawDiamond(parentGfx, width, height, attrs) {
3097
-
3098
- var x_2 = width / 2;
3099
- var y_2 = height / 2;
3100
-
3101
- var points = [
3102
- { x: x_2, y: 0 },
3103
- { x: width, y: y_2 },
3104
- { x: x_2, y: height },
3105
- { x: 0, y: y_2 }
3106
- ];
3107
-
3108
- var pointsString = points.map(function(point) {
3109
- return point.x + ',' + point.y;
3110
- }).join(' ');
3111
-
3112
- attrs = shapeStyle(attrs);
3113
-
3114
- var polygon = create$1('polygon', {
3115
- ...attrs,
3116
- points: pointsString
3117
- });
3118
-
3119
- append(parentGfx, polygon);
3120
-
3121
- return polygon;
3122
- }
3123
-
3124
- /**
3125
- * @param {SVGElement} parentGfx
3126
- * @param {Point[]} waypoints
3127
- * @param {any} attrs
3128
- * @param {number} [radius]
3129
- *
3130
- * @return {SVGElement}
3131
- */
3132
- function drawLine(parentGfx, waypoints, attrs, radius) {
3133
- attrs = lineStyle(attrs);
3134
-
3135
- var line = createLine(waypoints, attrs, radius);
3136
-
3137
- append(parentGfx, line);
3138
-
3139
- return line;
3140
- }
3141
-
3142
- /**
3143
- * @param {SVGElement} parentGfx
3144
- * @param {Point[]} waypoints
3145
- * @param {any} attrs
3146
- *
3147
- * @return {SVGElement}
3148
- */
3149
- function drawConnectionSegments(parentGfx, waypoints, attrs) {
3150
- return drawLine(parentGfx, waypoints, attrs, 5);
3151
- }
3152
-
3153
- function drawPath(parentGfx, d, attrs) {
3154
- attrs = lineStyle(attrs);
3155
-
3156
- var path = create$1('path', {
3157
- ...attrs,
3158
- d
3159
- });
3160
-
3161
- append(parentGfx, path);
3162
-
3163
- return path;
3164
- }
3165
-
3166
- function drawMarker(type, parentGfx, path, attrs) {
3167
- return drawPath(parentGfx, path, assign$1({ 'data-marker': type }, attrs));
3168
- }
3169
-
3170
- function renderer(type) {
3171
- return handlers[type];
3172
- }
3173
-
3174
- function as(type) {
3175
- return function(parentGfx, element, attrs) {
3176
- return renderer(type)(parentGfx, element, attrs);
3177
- };
3178
- }
3179
-
3180
- var eventIconRenderers = {
3181
- 'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
3182
- var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
3183
- xScaleFactor: 0.9,
3184
- yScaleFactor: 0.9,
3185
- containerWidth: attrs.width || element.width,
3186
- containerHeight: attrs.height || element.height,
3187
- position: {
3188
- mx: 0.235,
3189
- my: 0.315
3190
- }
3191
- });
3192
-
3193
- var fill = isThrowing
3194
- ? getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3195
- : getFillColor(element, defaultFillColor, attrs.fill);
3196
-
3197
- var stroke = isThrowing
3198
- ? getFillColor(element, defaultFillColor, attrs.fill)
3199
- : getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3200
-
3201
- var messagePath = drawPath(parentGfx, pathData, {
3202
- fill,
3203
- stroke,
3204
- strokeWidth: 1
3205
- });
3206
-
3207
- return messagePath;
3208
- },
3209
- 'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
3210
- var baseWidth = attrs.width || element.width;
3211
- var baseHeight = attrs.height || element.height;
3212
-
3213
- // use a lighter stroke for event suprocess icons
3214
- var strokeWidth = attrs.width ? 1 : 2;
3215
-
3216
- var circle = drawCircle(parentGfx, baseWidth, baseHeight, 0.2 * baseHeight, {
3217
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3218
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3219
- strokeWidth: strokeWidth
3220
- });
3221
-
3222
- var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
3223
- xScaleFactor: 0.75,
3224
- yScaleFactor: 0.75,
3225
- containerWidth: baseWidth,
3226
- containerHeight: baseHeight,
3227
- position: {
3228
- mx: 0.5,
3229
- my: 0.5
3230
- }
3231
- });
3232
-
3233
- drawPath(parentGfx, pathData, {
3234
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3235
- strokeWidth: strokeWidth
3236
- });
3237
-
3238
- for (var i = 0; i < 12; i++) {
3239
- var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
3240
- xScaleFactor: 0.75,
3241
- yScaleFactor: 0.75,
3242
- containerWidth: baseWidth,
3243
- containerHeight: baseHeight,
3244
- position: {
3245
- mx: 0.5,
3246
- my: 0.5
3247
- }
3248
- });
3249
-
3250
- var width = baseWidth / 2,
3251
- height = baseHeight / 2;
3252
-
3253
- drawPath(parentGfx, linePathData, {
3254
- strokeWidth: 1,
3255
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3256
- transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
3257
- });
3258
- }
3259
-
3260
- return circle;
3261
- },
3262
- 'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3263
- var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
3264
- xScaleFactor: 1,
3265
- yScaleFactor: 1,
3266
- containerWidth: attrs.width || event.width,
3267
- containerHeight: attrs.height || event.height,
3268
- position: {
3269
- mx: 0.5,
3270
- my: 0.2
3271
- }
3272
- });
3273
-
3274
- var fill = isThrowing
3275
- ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3276
- : getFillColor(event, defaultFillColor, attrs.fill);
3277
-
3278
- return drawPath(parentGfx, pathData, {
3279
- fill,
3280
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3281
- strokeWidth: 1
3282
- });
3283
- },
3284
- 'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
3285
- var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
3286
- xScaleFactor: 1,
3287
- yScaleFactor: 1,
3288
- containerWidth: attrs.width || event.width,
3289
- containerHeight: attrs.height || event.height,
3290
- position: {
3291
- mx: 0.5,
3292
- my: 0.222
3293
- }
3294
- });
3295
-
3296
- return drawPath(parentGfx, pathData, {
3297
- fill: getFillColor(event, defaultFillColor, attrs.fill),
3298
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3299
- strokeWidth: 1
3300
- });
3301
- },
3302
- 'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3303
- var pathData = pathMap.getScaledPath('EVENT_LINK', {
3304
- xScaleFactor: 1,
3305
- yScaleFactor: 1,
3306
- containerWidth: event.width,
3307
- containerHeight: event.height,
3308
- position: {
3309
- mx: 0.57,
3310
- my: 0.263
3311
- }
3312
- });
3313
-
3314
- var fill = isThrowing
3315
- ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3316
- : getFillColor(event, defaultFillColor, attrs.fill);
3317
-
3318
- return drawPath(parentGfx, pathData, {
3319
- fill,
3320
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3321
- strokeWidth: 1
3322
- });
3323
- },
3324
- 'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3325
- var pathData = pathMap.getScaledPath('EVENT_ERROR', {
3326
- xScaleFactor: 1.1,
3327
- yScaleFactor: 1.1,
3328
- containerWidth: attrs.width || event.width,
3329
- containerHeight: attrs.height || event.height,
3330
- position: {
3331
- mx: 0.2,
3332
- my: 0.722
3333
- }
3334
- });
3335
-
3336
- var fill = isThrowing
3337
- ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3338
- : getFillColor(event, defaultFillColor, attrs.fill);
3339
-
3340
- return drawPath(parentGfx, pathData, {
3341
- fill,
3342
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3343
- strokeWidth: 1
3344
- });
3345
- },
3346
- 'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3347
- var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
3348
- xScaleFactor: 1.0,
3349
- yScaleFactor: 1.0,
3350
- containerWidth: event.width,
3351
- containerHeight: event.height,
3352
- position: {
3353
- mx: 0.638,
3354
- my: -0.055
3355
- }
3356
- });
3357
-
3358
- var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : 'none';
3359
-
3360
- var path = drawPath(parentGfx, pathData, {
3361
- fill,
3362
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3363
- strokeWidth: 1
3364
- });
3365
-
3366
- rotate(path, 45);
3367
-
3368
- return path;
3369
- },
3370
- 'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3371
- var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
3372
- xScaleFactor: 1,
3373
- yScaleFactor: 1,
3374
- containerWidth: attrs.width || event.width,
3375
- containerHeight: attrs.height || event.height,
3376
- position: {
3377
- mx: 0.22,
3378
- my: 0.5
3379
- }
3380
- });
3381
-
3382
- var fill = isThrowing
3383
- ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3384
- : getFillColor(event, defaultFillColor, attrs.fill);
3385
-
3386
- return drawPath(parentGfx, pathData, {
3387
- fill,
3388
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3389
- strokeWidth: 1
3390
- });
3391
- },
3392
- 'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3393
- var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
3394
- xScaleFactor: 0.9,
3395
- yScaleFactor: 0.9,
3396
- containerWidth: attrs.width || event.width,
3397
- containerHeight: attrs.height || event.height,
3398
- position: {
3399
- mx: 0.5,
3400
- my: 0.2
3401
- }
3402
- });
3403
-
3404
- var fill = isThrowing
3405
- ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3406
- : getFillColor(event, defaultFillColor, attrs.fill);
3407
-
3408
- return drawPath(parentGfx, pathData, {
3409
- strokeWidth: 1,
3410
- fill,
3411
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3412
- });
3413
- },
3414
- 'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3415
- var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
3416
- xScaleFactor: 1.1,
3417
- yScaleFactor: 1.1,
3418
- containerWidth: attrs.width || event.width,
3419
- containerHeight: attrs.height || event.height,
3420
- position: {
3421
- mx: 0.211,
3422
- my: 0.36
3423
- }
3424
- });
3425
-
3426
- var fill = isThrowing
3427
- ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3428
- : getFillColor(event, defaultFillColor, attrs.fill);
3429
-
3430
- return drawPath(parentGfx, pathData, {
3431
- fill,
3432
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3433
- strokeWidth: 1
3434
- });
3435
- },
3436
- 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
3437
- var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
3438
- xScaleFactor: 1.2,
3439
- yScaleFactor: 1.2,
3440
- containerWidth: attrs.width || event.width,
3441
- containerHeight: attrs.height || event.height,
3442
- position: {
3443
- mx: 0.458,
3444
- my: 0.194
3445
- }
3446
- });
3447
-
3448
- return drawPath(parentGfx, pathData, {
3449
- fill: getFillColor(event, defaultFillColor, attrs.fill),
3450
- stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3451
- strokeWidth: 1
3452
- });
3453
- },
3454
- 'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
3455
- var circle = drawCircle(parentGfx, element.width, element.height, 8, {
3456
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3457
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3458
- strokeWidth: 4
3459
- });
3460
-
3461
- return circle;
3462
- }
3463
- };
3464
-
3465
- function renderEventIcon(element, parentGfx, attrs = {}, proxyElement) {
3466
- var semantic = getBusinessObject(element),
3467
- isThrowing = isThrowEvent(semantic);
3468
-
3469
- var nodeElement = proxyElement || element;
3470
-
3471
- if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
3472
- if (semantic.get('parallelMultiple')) {
3473
- return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3474
- }
3475
- else {
3476
- return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3477
- }
3478
- }
3479
-
3480
- if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
3481
- return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3482
- }
3483
-
3484
- if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
3485
- return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3486
- }
3487
-
3488
- if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
3489
- return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3490
- }
3491
-
3492
- if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
3493
- return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3494
- }
3495
-
3496
- if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
3497
- return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3498
- }
3499
-
3500
- if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
3501
- return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3502
- }
3503
-
3504
- if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
3505
- return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3506
- }
3507
-
3508
- if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
3509
- return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3510
- }
3511
-
3512
- if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
3513
- return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3514
- }
3515
-
3516
- if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
3517
- return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3518
- }
3519
-
3520
- return null;
3521
- }
3522
-
3523
- var taskMarkerRenderers = {
3524
- 'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
3525
- var width = getWidth(element, attrs),
3526
- height = getHeight(element, attrs);
3527
-
3528
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3529
- xScaleFactor: 1,
3530
- yScaleFactor: 1,
3531
- containerWidth: width,
3532
- containerHeight: height,
3533
- position: {
3534
- mx: ((width / 2 - 6) / width),
3535
- my: (height - 15) / height
3536
- }
3537
- });
3538
-
3539
- drawMarker('participant-multiplicity', parentGfx, markerPath, {
3540
- strokeWidth: 2,
3541
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3542
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3543
- });
3544
- },
3545
- 'SubProcessMarker': function(parentGfx, element, attrs = {}) {
3546
- var markerRect = drawRect(parentGfx, 14, 14, 0, {
3547
- strokeWidth: 1,
3548
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3549
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3550
- });
3551
-
3552
- translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
3553
-
3554
- var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
3555
- xScaleFactor: 1.5,
3556
- yScaleFactor: 1.5,
3557
- containerWidth: element.width,
3558
- containerHeight: element.height,
3559
- position: {
3560
- mx: (element.width / 2 - 7.5) / element.width,
3561
- my: (element.height - 20) / element.height
3562
- }
3563
- });
3564
-
3565
- drawMarker('sub-process', parentGfx, markerPath, {
3566
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3567
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3568
- });
3569
- },
3570
- 'ParallelMarker': function(parentGfx, element, attrs) {
3571
- var width = getWidth(element, attrs),
3572
- height = getHeight(element, attrs);
3573
-
3574
- var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3575
- xScaleFactor: 1,
3576
- yScaleFactor: 1,
3577
- containerWidth: width,
3578
- containerHeight: height,
3579
- position: {
3580
- mx: ((width / 2 + attrs.parallel) / width),
3581
- my: (height - 20) / height
3582
- }
3583
- });
3584
-
3585
- drawMarker('parallel', parentGfx, markerPath, {
3586
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3587
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3588
- });
3589
- },
3590
- 'SequentialMarker': function(parentGfx, element, attrs) {
3591
- var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
3592
- xScaleFactor: 1,
3593
- yScaleFactor: 1,
3594
- containerWidth: element.width,
3595
- containerHeight: element.height,
3596
- position: {
3597
- mx: ((element.width / 2 + attrs.seq) / element.width),
3598
- my: (element.height - 19) / element.height
3599
- }
3600
- });
3601
-
3602
- drawMarker('sequential', parentGfx, markerPath, {
3603
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3604
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3605
- });
3606
- },
3607
- 'CompensationMarker': function(parentGfx, element, attrs) {
3608
- var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
3609
- xScaleFactor: 1,
3610
- yScaleFactor: 1,
3611
- containerWidth: element.width,
3612
- containerHeight: element.height,
3613
- position: {
3614
- mx: ((element.width / 2 + attrs.compensation) / element.width),
3615
- my: (element.height - 13) / element.height
3616
- }
3617
- });
3618
-
3619
- drawMarker('compensation', parentGfx, markerMath, {
3620
- strokeWidth: 1,
3621
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3622
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3623
- });
3624
- },
3625
- 'LoopMarker': function(parentGfx, element, attrs) {
3626
- var width = getWidth(element, attrs),
3627
- height = getHeight(element, attrs);
3628
-
3629
- var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
3630
- xScaleFactor: 1,
3631
- yScaleFactor: 1,
3632
- containerWidth: width,
3633
- containerHeight: height,
3634
- position: {
3635
- mx: ((width / 2 + attrs.loop) / width),
3636
- my: (height - 7) / height
3637
- }
3638
- });
3639
-
3640
- drawMarker('loop', parentGfx, markerPath, {
3641
- strokeWidth: 1.5,
3642
- fill: 'none',
3643
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3644
- strokeMiterlimit: 0.5
3645
- });
3646
- },
3647
- 'AdhocMarker': function(parentGfx, element, attrs) {
3648
- var width = getWidth(element, attrs),
3649
- height = getHeight(element, attrs);
3650
-
3651
- var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
3652
- xScaleFactor: 1,
3653
- yScaleFactor: 1,
3654
- containerWidth: width,
3655
- containerHeight: height,
3656
- position: {
3657
- mx: ((width / 2 + attrs.adhoc) / width),
3658
- my: (height - 15) / height
3659
- }
3660
- });
3661
-
3662
- drawMarker('adhoc', parentGfx, markerPath, {
3663
- strokeWidth: 1,
3664
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3665
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3666
- });
3667
- }
3668
- };
3669
-
3670
- function renderTaskMarker(type, parentGfx, element, attrs) {
3671
- taskMarkerRenderers[ type ](parentGfx, element, attrs);
3672
- }
3673
-
3674
- function renderTaskMarkers(parentGfx, element, taskMarkers, attrs = {}) {
3675
- attrs = {
3676
- fill: attrs.fill,
3677
- stroke: attrs.stroke,
3678
- width: getWidth(element, attrs),
3679
- height: getHeight(element, attrs)
3680
- };
3681
-
3682
- var semantic = getBusinessObject(element);
3683
-
3684
- var subprocess = taskMarkers && taskMarkers.includes('SubProcessMarker');
3685
-
3686
- if (subprocess) {
3687
- attrs = {
3688
- ...attrs,
3689
- seq: -21,
3690
- parallel: -22,
3691
- compensation: -42,
3692
- loop: -18,
3693
- adhoc: 10
3694
- };
3695
- } else {
3696
- attrs = {
3697
- ...attrs,
3698
- seq: -5,
3699
- parallel: -6,
3700
- compensation: -27,
3701
- loop: 0,
3702
- adhoc: 10
3703
- };
3704
- }
3705
-
3706
- forEach$1(taskMarkers, function(marker) {
3707
- renderTaskMarker(marker, parentGfx, element, attrs);
3708
- });
3709
-
3710
- if (semantic.get('isForCompensation')) {
3711
- renderTaskMarker('CompensationMarker', parentGfx, element, attrs);
3712
- }
3713
-
3714
- if (is$1(semantic, 'bpmn:AdHocSubProcess')) {
3715
- renderTaskMarker('AdhocMarker', parentGfx, element, attrs);
3716
- }
3717
-
3718
- var loopCharacteristics = semantic.get('loopCharacteristics'),
3719
- isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
3720
-
3721
- if (loopCharacteristics) {
3722
-
3723
- if (isSequential === undefined) {
3724
- renderTaskMarker('LoopMarker', parentGfx, element, attrs);
3725
- }
3726
-
3727
- if (isSequential === false) {
3728
- renderTaskMarker('ParallelMarker', parentGfx, element, attrs);
3729
- }
3730
-
3731
- if (isSequential === true) {
3732
- renderTaskMarker('SequentialMarker', parentGfx, element, attrs);
3733
- }
3734
- }
3735
- }
3736
-
3737
- function renderLabel(parentGfx, label, attrs = {}) {
3738
- attrs = assign$1({
3739
- size: {
3740
- width: 100
3741
- }
3742
- }, attrs);
3743
-
3744
- var text = textRenderer.createText(label || '', attrs);
3745
-
3746
- classes$1(text).add('djs-label');
3747
-
3748
- append(parentGfx, text);
3749
-
3750
- return text;
3751
- }
3752
-
3753
- function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
3754
- var semantic = getBusinessObject(element);
3755
-
3756
- var box = getBounds({
3757
- x: element.x,
3758
- y: element.y,
3759
- width: element.width,
3760
- height: element.height
3761
- }, attrs);
3762
-
3763
- return renderLabel(parentGfx, semantic.name, {
3764
- align,
3765
- box,
3766
- padding: 7,
3767
- style: {
3768
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3769
- }
3770
- });
3771
- }
3772
-
3773
- function renderExternalLabel(parentGfx, element, attrs = {}) {
3774
- var box = {
3775
- width: 90,
3776
- height: 30,
3777
- x: element.width / 2 + element.x,
3778
- y: element.height / 2 + element.y
3779
- };
3780
-
3781
- return renderLabel(parentGfx, getLabel(element), {
3782
- box: box,
3783
- fitBox: true,
3784
- style: assign$1(
3785
- {},
3786
- textRenderer.getExternalStyle(),
3787
- {
3788
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3789
- }
3790
- )
3791
- });
3792
- }
3793
-
3794
- function renderLaneLabel(parentGfx, text, element, attrs = {}) {
3795
- var isHorizontalLane = isHorizontal(element);
3796
-
3797
- var textBox = renderLabel(parentGfx, text, {
3798
- box: {
3799
- height: 30,
3800
- width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs),
3801
- },
3802
- align: 'center-middle',
3803
- style: {
3804
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3805
- }
3806
- });
3807
-
3808
- if (isHorizontalLane) {
3809
- var top = -1 * getHeight(element, attrs);
3810
- transform(textBox, 0, -top, 270);
3811
- }
3812
- }
3813
-
3814
- function renderActivity(parentGfx, element, attrs = {}) {
3815
- var {
3816
- width,
3817
- height
3818
- } = getBounds(element, attrs);
3819
-
3820
- return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
3821
- ...attrs,
3822
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3823
- fillOpacity: DEFAULT_OPACITY,
3824
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3825
- });
3826
- }
3827
-
3828
- function renderAssociation(parentGfx, element, attrs = {}) {
3829
- var semantic = getBusinessObject(element);
3830
-
3831
- var fill = getFillColor(element, defaultFillColor, attrs.fill),
3832
- stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3833
-
3834
- if (semantic.get('associationDirection') === 'One' ||
3835
- semantic.get('associationDirection') === 'Both') {
3836
- attrs.markerEnd = marker(parentGfx, 'association-end', fill, stroke);
3837
- }
3838
-
3839
- if (semantic.get('associationDirection') === 'Both') {
3840
- attrs.markerStart = marker(parentGfx, 'association-start', fill, stroke);
3841
- }
3842
-
3843
- attrs = pickAttrs(attrs, [
3844
- 'markerStart',
3845
- 'markerEnd'
3846
- ]);
3847
-
3848
- return drawConnectionSegments(parentGfx, element.waypoints, {
3849
- ...attrs,
3850
- stroke,
3851
- strokeDasharray: '0, 5'
3852
- });
3853
- }
3854
-
3855
- function renderDataObject(parentGfx, element, attrs = {}) {
3856
- var fill = getFillColor(element, defaultFillColor, attrs.fill),
3857
- stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3858
-
3859
- var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
3860
- xScaleFactor: 1,
3861
- yScaleFactor: 1,
3862
- containerWidth: element.width,
3863
- containerHeight: element.height,
3864
- position: {
3865
- mx: 0.474,
3866
- my: 0.296
3867
- }
3868
- });
3869
-
3870
- var dataObject = drawPath(parentGfx, pathData, {
3871
- fill,
3872
- fillOpacity: DEFAULT_OPACITY,
3873
- stroke
3874
- });
3875
-
3876
- var semantic = getBusinessObject(element);
3877
-
3878
- if (isCollection(semantic)) {
3879
- var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
3880
- xScaleFactor: 1,
3881
- yScaleFactor: 1,
3882
- containerWidth: element.width,
3883
- containerHeight: element.height,
3884
- position: {
3885
- mx: 0.33,
3886
- my: (element.height - 18) / element.height
3887
- }
3888
- });
3889
-
3890
- drawPath(parentGfx, collectionPathData, {
3891
- strokeWidth: 2,
3892
- fill,
3893
- stroke
3894
- });
3895
- }
3896
-
3897
- return dataObject;
3898
- }
3899
-
3900
- function renderEvent(parentGfx, element, attrs = {}) {
3901
- return drawCircle(parentGfx, element.width, element.height, {
3902
- fillOpacity: DEFAULT_OPACITY,
3903
- ...attrs,
3904
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3905
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3906
- });
3907
- }
3908
-
3909
- function renderGateway(parentGfx, element, attrs = {}) {
3910
- return drawDiamond(parentGfx, element.width, element.height, {
3911
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3912
- fillOpacity: DEFAULT_OPACITY,
3913
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3914
- });
3915
- }
3916
-
3917
- function renderLane(parentGfx, element, attrs = {}) {
3918
- var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
3919
- fill: getFillColor(element, defaultFillColor, attrs.fill),
3920
- fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
3921
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3922
- strokeWidth: 1.5
3923
- });
3924
-
3925
- var semantic = getBusinessObject(element);
3926
-
3927
- if (is$1(semantic, 'bpmn:Lane')) {
3928
- var text = semantic.get('name');
3929
-
3930
- renderLaneLabel(parentGfx, text, element, attrs);
3931
- }
3932
-
3933
- return lane;
3934
- }
3935
-
3936
- function renderSubProcess(parentGfx, element, attrs = {}) {
3937
- var activity = renderActivity(parentGfx, element, attrs);
3938
-
3939
- var expanded = isExpanded(element);
3940
-
3941
- if (isEventSubProcess(element)) {
3942
- attr$1(activity, {
3943
- strokeDasharray: '0, 5.5',
3944
- strokeWidth: 2.5
3945
- });
3946
-
3947
- if (!expanded) {
3948
- var flowElements = getBusinessObject(element).flowElements || [];
3949
- var startEvents = flowElements.filter(e => is$1(e, 'bpmn:StartEvent'));
3950
-
3951
- if (startEvents.length === 1) {
3952
- renderEventSubProcessIcon(startEvents[0], parentGfx, attrs, element);
3953
- }
3954
- }
3955
- }
3956
-
3957
- renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
3958
-
3959
- if (expanded) {
3960
- renderTaskMarkers(parentGfx, element, undefined, attrs);
3961
- } else {
3962
- renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs);
3963
- }
3964
-
3965
- return activity;
3966
- }
3967
-
3968
- function renderEventSubProcessIcon(startEvent, parentGfx, attrs, proxyElement) {
3969
- var iconSize = 22;
3970
-
3971
- // match the colors of the enclosing subprocess
3972
- var proxyAttrs = {
3973
- fill: getFillColor(proxyElement, defaultFillColor, attrs.fill),
3974
- stroke: getStrokeColor(proxyElement, defaultStrokeColor, attrs.stroke),
3975
- width: iconSize,
3976
- height: iconSize
3977
- };
3978
-
3979
- var interrupting = getBusinessObject(startEvent).isInterrupting;
3980
- var strokeDasharray = interrupting ? 0 : 3;
3981
-
3982
- // better visibility for non-interrupting events
3983
- var strokeWidth = interrupting ? 1 : 1.2;
3984
-
3985
- // make the icon look larger by drawing a smaller circle
3986
- var circleSize = 20;
3987
- var shift = (iconSize - circleSize) / 2;
3988
- var transform = 'translate(' + shift + ',' + shift + ')';
3989
-
3990
- drawCircle(parentGfx, circleSize, circleSize, {
3991
- fill: proxyAttrs.fill,
3992
- stroke: proxyAttrs.stroke,
3993
- strokeWidth,
3994
- strokeDasharray,
3995
- transform
3996
- });
3997
-
3998
- renderEventIcon(startEvent, parentGfx, proxyAttrs, proxyElement);
3999
- }
4000
-
4001
- function renderTask(parentGfx, element, attrs = {}) {
4002
- var activity = renderActivity(parentGfx, element, attrs);
4003
-
4004
- renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs);
4005
-
4006
- renderTaskMarkers(parentGfx, element, undefined, attrs);
4007
-
4008
- return activity;
4009
- }
4010
-
4011
- var handlers = this.handlers = {
4012
- 'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) {
4013
- if (isExpanded(element)) {
4014
- attrs = pickAttrs(attrs, [
4015
- 'fill',
4016
- 'stroke',
4017
- 'width',
4018
- 'height'
4019
- ]);
4020
- } else {
4021
- attrs = pickAttrs(attrs, [
4022
- 'fill',
4023
- 'stroke'
4024
- ]);
4025
- }
4026
-
4027
- return renderSubProcess(parentGfx, element, attrs);
4028
- },
4029
- 'bpmn:Association': function(parentGfx, element, attrs = {}) {
4030
- attrs = pickAttrs(attrs, [
4031
- 'fill',
4032
- 'stroke'
4033
- ]);
4034
-
4035
- return renderAssociation(parentGfx, element, attrs);
4036
- },
4037
- 'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) {
4038
- var { renderIcon = true } = attrs;
4039
-
4040
- attrs = pickAttrs(attrs, [
4041
- 'fill',
4042
- 'stroke'
4043
- ]);
4044
-
4045
- var semantic = getBusinessObject(element),
4046
- cancelActivity = semantic.get('cancelActivity');
4047
-
4048
- attrs = {
4049
- strokeWidth: 1.5,
4050
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4051
- fillOpacity: FULL_OPACITY,
4052
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4053
- };
4054
-
4055
- if (!cancelActivity) {
4056
- attrs.strokeDasharray = '6';
4057
- }
4058
-
4059
- var event = renderEvent(parentGfx, element, attrs);
4060
-
4061
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4062
- ...attrs,
4063
- fill: 'none'
4064
- });
4065
-
4066
- if (renderIcon) {
4067
- renderEventIcon(element, parentGfx, attrs);
4068
- }
4069
-
4070
- return event;
4071
- },
4072
- 'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) {
4073
- attrs = pickAttrs(attrs, [
4074
- 'fill',
4075
- 'stroke'
4076
- ]);
4077
-
4078
- var task = renderTask(parentGfx, element, attrs);
4079
-
4080
- var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
4081
- abspos: {
4082
- x: 8,
4083
- y: 8
4084
- }
4085
- });
4086
-
4087
- var businessPath = drawPath(parentGfx, headerData);
4088
-
4089
- attr$1(businessPath, {
4090
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4091
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4092
- strokeWidth: 1
4093
- });
4094
-
4095
- var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
4096
- abspos: {
4097
- x: 8,
4098
- y: 8
4099
- }
4100
- });
4101
-
4102
- var businessHeaderPath = drawPath(parentGfx, headerPathData);
4103
-
4104
- attr$1(businessHeaderPath, {
4105
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4106
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4107
- strokeWidth: 1
4108
- });
4109
-
4110
- return task;
4111
- },
4112
- 'bpmn:CallActivity': function(parentGfx, element, attrs = {}) {
4113
- attrs = pickAttrs(attrs, [
4114
- 'fill',
4115
- 'stroke'
4116
- ]);
4117
-
4118
- return renderSubProcess(parentGfx, element, {
4119
- strokeWidth: 5,
4120
- ...attrs
4121
- });
4122
- },
4123
- 'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) {
4124
- attrs = pickAttrs(attrs, [
4125
- 'fill',
4126
- 'stroke'
4127
- ]);
4128
-
4129
- var gateway = renderGateway(parentGfx, element, attrs);
4130
-
4131
- var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
4132
- xScaleFactor: 0.5,
4133
- yScaleFactor:0.5,
4134
- containerWidth: element.width,
4135
- containerHeight: element.height,
4136
- position: {
4137
- mx: 0.46,
4138
- my: 0.26
4139
- }
4140
- });
4141
-
4142
- drawPath(parentGfx, pathData, {
4143
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4144
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4145
- strokeWidth: 1
4146
- });
4147
-
4148
- return gateway;
4149
- },
4150
- 'bpmn:DataInput': function(parentGfx, element, attrs = {}) {
4151
- attrs = pickAttrs(attrs, [
4152
- 'fill',
4153
- 'stroke'
4154
- ]);
4155
-
4156
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4157
-
4158
- var dataObject = renderDataObject(parentGfx, element, attrs);
4159
-
4160
- drawPath(parentGfx, arrowPathData, {
4161
- fill: 'none',
4162
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4163
- strokeWidth: 1
4164
- });
4165
-
4166
- return dataObject;
4167
- },
4168
- 'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) {
4169
- attrs = pickAttrs(attrs, [
4170
- 'fill',
4171
- 'stroke'
4172
- ]);
4173
-
4174
- return renderAssociation(parentGfx, element, {
4175
- ...attrs,
4176
- markerEnd: marker(parentGfx, 'association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
4177
- });
4178
- },
4179
- 'bpmn:DataObject': function(parentGfx, element, attrs = {}) {
4180
- attrs = pickAttrs(attrs, [
4181
- 'fill',
4182
- 'stroke'
4183
- ]);
4184
-
4185
- return renderDataObject(parentGfx, element, attrs);
4186
- },
4187
- 'bpmn:DataObjectReference': as('bpmn:DataObject'),
4188
- 'bpmn:DataOutput': function(parentGfx, element, attrs = {}) {
4189
- attrs = pickAttrs(attrs, [
4190
- 'fill',
4191
- 'stroke'
4192
- ]);
4193
-
4194
- var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4195
-
4196
- var dataObject = renderDataObject(parentGfx, element, attrs);
4197
-
4198
- drawPath(parentGfx, arrowPathData, {
4199
- strokeWidth: 1,
4200
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4201
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4202
- });
4203
-
4204
- return dataObject;
4205
- },
4206
- 'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) {
4207
- attrs = pickAttrs(attrs, [
4208
- 'fill',
4209
- 'stroke'
4210
- ]);
4211
-
4212
- return renderAssociation(parentGfx, element, {
4213
- ...attrs,
4214
- markerEnd: marker(parentGfx, 'association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
4215
- });
4216
- },
4217
- 'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) {
4218
- attrs = pickAttrs(attrs, [
4219
- 'fill',
4220
- 'stroke'
4221
- ]);
4222
-
4223
- var dataStorePath = pathMap.getScaledPath('DATA_STORE', {
4224
- xScaleFactor: 1,
4225
- yScaleFactor: 1,
4226
- containerWidth: element.width,
4227
- containerHeight: element.height,
4228
- position: {
4229
- mx: 0,
4230
- my: 0.133
4231
- }
4232
- });
4233
-
4234
- return drawPath(parentGfx, dataStorePath, {
4235
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4236
- fillOpacity: DEFAULT_OPACITY,
4237
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4238
- strokeWidth: 2
4239
- });
4240
- },
4241
- 'bpmn:EndEvent': function(parentGfx, element, attrs = {}) {
4242
- var { renderIcon = true } = attrs;
4243
-
4244
- attrs = pickAttrs(attrs, [
4245
- 'fill',
4246
- 'stroke'
4247
- ]);
4248
-
4249
- var event = renderEvent(parentGfx, element, {
4250
- ...attrs,
4251
- strokeWidth: 4
4252
- });
4253
-
4254
- if (renderIcon) {
4255
- renderEventIcon(element, parentGfx, attrs);
4256
- }
4257
-
4258
- return event;
4259
- },
4260
- 'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) {
4261
- attrs = pickAttrs(attrs, [
4262
- 'fill',
4263
- 'stroke'
4264
- ]);
4265
-
4266
- var semantic = getBusinessObject(element);
4267
-
4268
- var diamond = renderGateway(parentGfx, element, attrs);
4269
-
4270
- drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
4271
- fill: getFillColor(element, 'none', attrs.fill),
4272
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4273
- strokeWidth: 1
4274
- });
4275
-
4276
- var type = semantic.get('eventGatewayType'),
4277
- instantiate = !!semantic.get('instantiate');
4278
-
4279
- function drawEvent() {
4280
-
4281
- var pathData = pathMap.getScaledPath('GATEWAY_EVENT_BASED', {
4282
- xScaleFactor: 0.18,
4283
- yScaleFactor: 0.18,
4284
- containerWidth: element.width,
4285
- containerHeight: element.height,
4286
- position: {
4287
- mx: 0.36,
4288
- my: 0.44
4289
- }
4290
- });
4291
-
4292
- drawPath(parentGfx, pathData, {
4293
- fill: 'none',
4294
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4295
- strokeWidth: 2
4296
- });
4297
- }
4298
-
4299
- if (type === 'Parallel') {
4300
- var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4301
- xScaleFactor: 0.4,
4302
- yScaleFactor: 0.4,
4303
- containerWidth: element.width,
4304
- containerHeight: element.height,
4305
- position: {
4306
- mx: 0.474,
4307
- my: 0.296
4308
- }
4309
- });
4310
-
4311
- drawPath(parentGfx, pathData, {
4312
- fill: 'none',
4313
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4314
- strokeWidth: 1
4315
- });
4316
- } else if (type === 'Exclusive') {
4317
- if (!instantiate) {
4318
- drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
4319
- fill: 'none',
4320
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4321
- strokeWidth: 1
4322
- });
4323
- }
4324
-
4325
- drawEvent();
4326
- }
4327
-
4328
-
4329
- return diamond;
4330
- },
4331
- 'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) {
4332
- attrs = pickAttrs(attrs, [
4333
- 'fill',
4334
- 'stroke'
4335
- ]);
4336
-
4337
- var gateway = renderGateway(parentGfx, element, attrs);
4338
-
4339
- var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
4340
- xScaleFactor: 0.4,
4341
- yScaleFactor: 0.4,
4342
- containerWidth: element.width,
4343
- containerHeight: element.height,
4344
- position: {
4345
- mx: 0.32,
4346
- my: 0.3
4347
- }
4348
- });
4349
-
4350
- var di = getDi(element);
4351
-
4352
- if (di.get('isMarkerVisible')) {
4353
- drawPath(parentGfx, pathData, {
4354
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4355
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4356
- strokeWidth: 1
4357
- });
4358
- }
4359
-
4360
- return gateway;
4361
- },
4362
- 'bpmn:Gateway': function(parentGfx, element, attrs = {}) {
4363
- attrs = pickAttrs(attrs, [
4364
- 'fill',
4365
- 'stroke'
4366
- ]);
4367
-
4368
- return renderGateway(parentGfx, element, attrs);
4369
- },
4370
- 'bpmn:Group': function(parentGfx, element, attrs = {}) {
4371
- attrs = pickAttrs(attrs, [
4372
- 'fill',
4373
- 'stroke',
4374
- 'width',
4375
- 'height'
4376
- ]);
4377
-
4378
- return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
4379
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4380
- strokeWidth: 1.5,
4381
- strokeDasharray: '10, 6, 0, 6',
4382
- fill: 'none',
4383
- pointerEvents: 'none',
4384
- width: getWidth(element, attrs),
4385
- height: getHeight(element, attrs)
4386
- });
4387
- },
4388
- 'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) {
4389
- attrs = pickAttrs(attrs, [
4390
- 'fill',
4391
- 'stroke'
4392
- ]);
4393
-
4394
- var gateway = renderGateway(parentGfx, element, attrs);
4395
-
4396
- drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
4397
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4398
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4399
- strokeWidth: 2.5
4400
- });
4401
-
4402
- return gateway;
4403
- },
4404
- 'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) {
4405
- var { renderIcon = true } = attrs;
4406
-
4407
- attrs = pickAttrs(attrs, [
4408
- 'fill',
4409
- 'stroke'
4410
- ]);
4411
-
4412
- var outer = renderEvent(parentGfx, element, {
4413
- ...attrs,
4414
- strokeWidth: 1.5
4415
- });
4416
-
4417
- drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4418
- fill: 'none',
4419
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4420
- strokeWidth: 1.5
4421
- });
4422
-
4423
- if (renderIcon) {
4424
- renderEventIcon(element, parentGfx, attrs);
4425
- }
4426
-
4427
- return outer;
4428
- },
4429
- 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
4430
- 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
4431
- 'bpmn:Lane': function(parentGfx, element, attrs = {}) {
4432
- attrs = pickAttrs(attrs, [
4433
- 'fill',
4434
- 'stroke',
4435
- 'width',
4436
- 'height'
4437
- ]);
4438
-
4439
- return renderLane(parentGfx, element, {
4440
- ...attrs,
4441
- fillOpacity: LOW_OPACITY
4442
- });
4443
- },
4444
- 'bpmn:ManualTask': function(parentGfx, element, attrs = {}) {
4445
- attrs = pickAttrs(attrs, [
4446
- 'fill',
4447
- 'stroke'
4448
- ]);
4449
-
4450
- var task = renderTask(parentGfx, element, attrs);
4451
-
4452
- var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
4453
- abspos: {
4454
- x: 17,
4455
- y: 15
4456
- }
4457
- });
4458
-
4459
- drawPath(parentGfx, pathData, {
4460
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4461
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4462
- strokeWidth: 0.5
4463
- });
4464
-
4465
- return task;
4466
- },
4467
- 'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) {
4468
- attrs = pickAttrs(attrs, [
4469
- 'fill',
4470
- 'stroke'
4471
- ]);
4472
-
4473
- var semantic = getBusinessObject(element),
4474
- di = getDi(element);
4475
-
4476
- var fill = getFillColor(element, defaultFillColor, attrs.fill),
4477
- stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4478
-
4479
- var path = drawConnectionSegments(parentGfx, element.waypoints, {
4480
- markerEnd: marker(parentGfx, 'messageflow-end', fill, stroke),
4481
- markerStart: marker(parentGfx, 'messageflow-start', fill, stroke),
4482
- stroke,
4483
- strokeDasharray: '10, 11',
4484
- strokeWidth: 1.5
4485
- });
4486
-
4487
- if (semantic.get('messageRef')) {
4488
- var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
4489
-
4490
- var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
4491
- abspos: {
4492
- x: midPoint.x,
4493
- y: midPoint.y
4494
- }
4495
- });
4496
-
4497
- var messageAttrs = {
4498
- strokeWidth: 1
4499
- };
4500
-
4501
- if (di.get('messageVisibleKind') === 'initiating') {
4502
- messageAttrs.fill = fill;
4503
- messageAttrs.stroke = stroke;
4504
- } else {
4505
- messageAttrs.fill = stroke;
4506
- messageAttrs.stroke = fill;
4507
- }
4508
-
4509
- var message = drawPath(parentGfx, markerPathData, messageAttrs);
4510
-
4511
- var messageRef = semantic.get('messageRef'),
4512
- name = messageRef.get('name');
4513
-
4514
- var label = renderLabel(parentGfx, name, {
4515
- align: 'center-top',
4516
- fitBox: true,
4517
- style: {
4518
- fill: stroke
4519
- }
4520
- });
4521
-
4522
- var messageBounds = message.getBBox(),
4523
- labelBounds = label.getBBox();
4524
-
4525
- var translateX = midPoint.x - labelBounds.width / 2,
4526
- translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
4527
-
4528
- transform(label, translateX, translateY, 0);
4529
- }
4530
-
4531
- return path;
4532
- },
4533
- 'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) {
4534
- attrs = pickAttrs(attrs, [
4535
- 'fill',
4536
- 'stroke'
4537
- ]);
4538
-
4539
- var diamond = renderGateway(parentGfx, element, attrs);
4540
-
4541
- var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4542
- xScaleFactor: 0.6,
4543
- yScaleFactor: 0.6,
4544
- containerWidth: element.width,
4545
- containerHeight: element.height,
4546
- position: {
4547
- mx: 0.46,
4548
- my: 0.2
4549
- }
4550
- });
4551
-
4552
- drawPath(parentGfx, pathData, {
4553
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4554
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4555
- strokeWidth: 1
4556
- });
4557
-
4558
- return diamond;
4559
- },
4560
- 'bpmn:Participant': function(parentGfx, element, attrs = {}) {
4561
- attrs = pickAttrs(attrs, [
4562
- 'fill',
4563
- 'stroke',
4564
- 'width',
4565
- 'height'
4566
- ]);
4567
-
4568
- var participant = renderLane(parentGfx, element, attrs);
4569
-
4570
- var expandedParticipant = isExpanded(element);
4571
- var horizontalParticipant = isHorizontal(element);
4572
-
4573
- var semantic = getBusinessObject(element),
4574
- name = semantic.get('name');
4575
-
4576
- if (expandedParticipant) {
4577
- var waypoints = horizontalParticipant ? [
4578
- {
4579
- x: 30,
4580
- y: 0
4581
- },
4582
- {
4583
- x: 30,
4584
- y: getHeight(element, attrs)
4585
- }
4586
- ] : [
4587
- {
4588
- x: 0,
4589
- y: 30
4590
- },
4591
- {
4592
- x: getWidth(element, attrs),
4593
- y: 30
4594
- }
4595
- ];
4596
-
4597
- drawLine(parentGfx, waypoints, {
4598
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4599
- strokeWidth: PARTICIPANT_STROKE_WIDTH
4600
- });
4601
-
4602
- renderLaneLabel(parentGfx, name, element, attrs);
4603
- } else {
4604
- var bounds = getBounds(element, attrs);
4605
-
4606
- if (!horizontalParticipant) {
4607
- bounds.height = getWidth(element, attrs);
4608
- bounds.width = getHeight(element, attrs);
4609
- }
4610
-
4611
- var textBox = renderLabel(parentGfx, name, {
4612
- box: bounds,
4613
- align: 'center-middle',
4614
- style: {
4615
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4616
- }
4617
- });
4618
-
4619
- if (!horizontalParticipant) {
4620
- var top = -1 * getHeight(element, attrs);
4621
- transform(textBox, 0, -top, 270);
4622
- }
4623
- }
4624
-
4625
- if (semantic.get('participantMultiplicity')) {
4626
- renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs);
4627
- }
4628
-
4629
- return participant;
4630
- },
4631
- 'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) {
4632
- attrs = pickAttrs(attrs, [
4633
- 'fill',
4634
- 'stroke'
4635
- ]);
4636
-
4637
- var semantic = getBusinessObject(element);
4638
-
4639
- var task = renderTask(parentGfx, element, attrs);
4640
-
4641
- var pathData;
4642
-
4643
- if (semantic.get('instantiate')) {
4644
- drawCircle(parentGfx, 28, 28, 20 * 0.22, {
4645
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4646
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4647
- strokeWidth: 1
4648
- });
4649
-
4650
- pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
4651
- abspos: {
4652
- x: 7.77,
4653
- y: 9.52
4654
- }
4655
- });
4656
- } else {
4657
- pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4658
- xScaleFactor: 0.9,
4659
- yScaleFactor: 0.9,
4660
- containerWidth: 21,
4661
- containerHeight: 14,
4662
- position: {
4663
- mx: 0.3,
4664
- my: 0.4
4665
- }
4666
- });
4667
- }
4668
-
4669
- drawPath(parentGfx, pathData, {
4670
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4671
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4672
- strokeWidth: 1
4673
- });
4674
-
4675
- return task;
4676
- },
4677
- 'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) {
4678
- attrs = pickAttrs(attrs, [
4679
- 'fill',
4680
- 'stroke'
4681
- ]);
4682
-
4683
- var task = renderTask(parentGfx, element, attrs);
4684
-
4685
- var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
4686
- abspos: {
4687
- x: 15,
4688
- y: 20
4689
- }
4690
- });
4691
-
4692
- drawPath(parentGfx, pathData, {
4693
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4694
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4695
- strokeWidth: 1
4696
- });
4697
-
4698
- return task;
4699
- },
4700
- 'bpmn:SendTask': function(parentGfx, element, attrs = {}) {
4701
- attrs = pickAttrs(attrs, [
4702
- 'fill',
4703
- 'stroke'
4704
- ]);
4705
-
4706
- var task = renderTask(parentGfx, element, attrs);
4707
-
4708
- var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4709
- xScaleFactor: 1,
4710
- yScaleFactor: 1,
4711
- containerWidth: 21,
4712
- containerHeight: 14,
4713
- position: {
4714
- mx: 0.285,
4715
- my: 0.357
4716
- }
4717
- });
4718
-
4719
- drawPath(parentGfx, pathData, {
4720
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4721
- stroke: getFillColor(element, defaultFillColor, attrs.fill),
4722
- strokeWidth: 1
4723
- });
4724
-
4725
- return task;
4726
- },
4727
- 'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) {
4728
- attrs = pickAttrs(attrs, [
4729
- 'fill',
4730
- 'stroke'
4731
- ]);
4732
-
4733
- var fill = getFillColor(element, defaultFillColor, attrs.fill),
4734
- stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4735
-
4736
- var connection = drawConnectionSegments(parentGfx, element.waypoints, {
4737
- markerEnd: marker(parentGfx, 'sequenceflow-end', fill, stroke),
4738
- stroke
4739
- });
4740
-
4741
- var semantic = getBusinessObject(element);
4742
-
4743
- var { source } = element;
4744
-
4745
- if (source) {
4746
- var sourceSemantic = getBusinessObject(source);
4747
-
4748
- // conditional flow marker
4749
- if (semantic.get('conditionExpression') && is$1(sourceSemantic, 'bpmn:Activity')) {
4750
- attr$1(connection, {
4751
- markerStart: marker(parentGfx, 'conditional-flow-marker', fill, stroke)
4752
- });
4753
- }
4754
-
4755
- // default marker
4756
- if (sourceSemantic.get('default') && (is$1(sourceSemantic, 'bpmn:Gateway') || is$1(sourceSemantic, 'bpmn:Activity')) &&
4757
- sourceSemantic.get('default') === semantic) {
4758
- attr$1(connection, {
4759
- markerStart: marker(parentGfx, 'conditional-default-flow-marker', fill, stroke)
4760
- });
4761
- }
4762
- }
4763
-
4764
- return connection;
4765
- },
4766
- 'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) {
4767
- attrs = pickAttrs(attrs, [
4768
- 'fill',
4769
- 'stroke'
4770
- ]);
4771
-
4772
- var task = renderTask(parentGfx, element, attrs);
4773
-
4774
- drawCircle(parentGfx, 10, 10, {
4775
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4776
- stroke: 'none',
4777
- transform: 'translate(6, 6)'
4778
- });
4779
-
4780
- var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4781
- abspos: {
4782
- x: 12,
4783
- y: 18
4784
- }
4785
- });
4786
-
4787
- drawPath(parentGfx, pathDataService1, {
4788
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4789
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4790
- strokeWidth: 1
4791
- });
4792
-
4793
- drawCircle(parentGfx, 10, 10, {
4794
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4795
- stroke: 'none',
4796
- transform: 'translate(11, 10)'
4797
- });
4798
-
4799
- var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4800
- abspos: {
4801
- x: 17,
4802
- y: 22
4803
- }
4804
- });
4805
-
4806
- drawPath(parentGfx, pathDataService2, {
4807
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4808
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4809
- strokeWidth: 1
4810
- });
4811
-
4812
- return task;
4813
- },
4814
- 'bpmn:StartEvent': function(parentGfx, element, attrs = {}) {
4815
- var { renderIcon = true } = attrs;
4816
-
4817
- attrs = pickAttrs(attrs, [
4818
- 'fill',
4819
- 'stroke'
4820
- ]);
4821
-
4822
- var semantic = getBusinessObject(element);
4823
-
4824
- if (!semantic.get('isInterrupting')) {
4825
- attrs = {
4826
- ...attrs,
4827
- strokeDasharray: '6'
4828
- };
4829
- }
4830
-
4831
- var event = renderEvent(parentGfx, element, attrs);
4832
-
4833
- if (renderIcon) {
4834
- renderEventIcon(element, parentGfx, attrs);
4835
- }
4836
-
4837
- return event;
4838
- },
4839
- 'bpmn:SubProcess': function(parentGfx, element, attrs = {}) {
4840
- if (isExpanded(element)) {
4841
- attrs = pickAttrs(attrs, [
4842
- 'fill',
4843
- 'stroke',
4844
- 'width',
4845
- 'height'
4846
- ]);
4847
- } else {
4848
- attrs = pickAttrs(attrs, [
4849
- 'fill',
4850
- 'stroke'
4851
- ]);
4852
- }
4853
-
4854
- return renderSubProcess(parentGfx, element, attrs);
4855
- },
4856
- 'bpmn:Task': function(parentGfx, element, attrs = {}) {
4857
- attrs = pickAttrs(attrs, [
4858
- 'fill',
4859
- 'stroke'
4860
- ]);
4861
-
4862
- return renderTask(parentGfx, element, attrs);
4863
- },
4864
- 'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
4865
- attrs = pickAttrs(attrs, [
4866
- 'fill',
4867
- 'stroke',
4868
- 'width',
4869
- 'height'
4870
- ]);
4871
-
4872
- var {
4873
- width,
4874
- height
4875
- } = getBounds(element, attrs);
4876
-
4877
- var textElement = drawRect(parentGfx, width, height, 0, 0, {
4878
- fill: 'none',
4879
- stroke: 'none'
4880
- });
4881
-
4882
- var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
4883
- xScaleFactor: 1,
4884
- yScaleFactor: 1,
4885
- containerWidth: width,
4886
- containerHeight: height,
4887
- position: {
4888
- mx: 0.0,
4889
- my: 0.0
4890
- }
4891
- });
4892
-
4893
- drawPath(parentGfx, textPathData, {
4894
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4895
- });
4896
-
4897
- var semantic = getBusinessObject(element),
4898
- text = semantic.get('text') || '';
4899
-
4900
- renderLabel(parentGfx, text, {
4901
- align: 'left-top',
4902
- box: getBounds(element, attrs),
4903
- padding: 7,
4904
- style: {
4905
- fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4906
- }
4907
- });
4908
-
4909
- return textElement;
4910
- },
4911
- 'bpmn:Transaction': function(parentGfx, element, attrs = {}) {
4912
- if (isExpanded(element)) {
4913
- attrs = pickAttrs(attrs, [
4914
- 'fill',
4915
- 'stroke',
4916
- 'width',
4917
- 'height'
4918
- ]);
4919
- } else {
4920
- attrs = pickAttrs(attrs, [
4921
- 'fill',
4922
- 'stroke'
4923
- ]);
4924
- }
4925
-
4926
- var outer = renderSubProcess(parentGfx, element, {
4927
- strokeWidth: 1.5,
4928
- ...attrs
4929
- });
4930
-
4931
- var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
4932
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4933
- strokeWidth: 1.5
4934
- });
4935
-
4936
- var expanded = isExpanded(element);
4937
-
4938
- if (!expanded) {
4939
- attrs = {};
4940
- }
4941
-
4942
- drawRect(
4943
- parentGfx,
4944
- getWidth(element, attrs),
4945
- getHeight(element, attrs),
4946
- TASK_BORDER_RADIUS - INNER_OUTER_DIST,
4947
- INNER_OUTER_DIST,
4948
- innerAttrs
4949
- );
4950
-
4951
- return outer;
4952
- },
4953
- 'bpmn:UserTask': function(parentGfx, element, attrs = {}) {
4954
- attrs = pickAttrs(attrs, [
4955
- 'fill',
4956
- 'stroke'
4957
- ]);
4958
-
4959
- var task = renderTask(parentGfx, element, attrs);
4960
-
4961
- var x = 15;
4962
- var y = 12;
4963
-
4964
- var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
4965
- abspos: {
4966
- x: x,
4967
- y: y
4968
- }
4969
- });
4970
-
4971
- drawPath(parentGfx, pathDataUser1, {
4972
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4973
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4974
- strokeWidth: 0.5
4975
- });
4976
-
4977
- var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
4978
- abspos: {
4979
- x: x,
4980
- y: y
4981
- }
4982
- });
4983
-
4984
- drawPath(parentGfx, pathDataUser2, {
4985
- fill: getFillColor(element, defaultFillColor, attrs.fill),
4986
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4987
- strokeWidth: 0.5
4988
- });
4989
-
4990
- var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
4991
- abspos: {
4992
- x: x,
4993
- y: y
4994
- }
4995
- });
4996
-
4997
- drawPath(parentGfx, pathDataUser3, {
4998
- fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4999
- stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5000
- strokeWidth: 0.5
5001
- });
5002
-
5003
- return task;
5004
- },
5005
- 'label': function(parentGfx, element, attrs = {}) {
5006
- return renderExternalLabel(parentGfx, element, attrs);
5007
- }
5008
- };
5009
-
5010
- // extension API, use at your own risk
5011
- this._drawPath = drawPath;
5012
-
5013
- this._renderer = renderer;
5014
- }
5015
-
5016
-
5017
- e(BpmnRenderer, BaseRenderer);
5018
-
5019
- BpmnRenderer.$inject = [
5020
- 'config.bpmnRenderer',
5021
- 'eventBus',
5022
- 'styles',
5023
- 'pathMap',
5024
- 'canvas',
5025
- 'textRenderer'
5026
- ];
5027
-
5028
-
5029
- /**
5030
- * @param {Element} element
5031
- *
5032
- * @return {boolean}
5033
- */
5034
- BpmnRenderer.prototype.canRender = function(element) {
5035
- return is$1(element, 'bpmn:BaseElement');
5036
- };
5037
-
5038
- /**
5039
- * Draw shape into parentGfx.
5040
- *
5041
- * @param {SVGElement} parentGfx
5042
- * @param {Shape} shape
5043
- * @param {Attrs} [attrs]
5044
- *
5045
- * @return {SVGElement} mainGfx
5046
- */
5047
- BpmnRenderer.prototype.drawShape = function(parentGfx, shape, attrs = {}) {
5048
- var { type } = shape;
5049
-
5050
- var handler = this._renderer(type);
5051
-
5052
- return handler(parentGfx, shape, attrs);
5053
- };
5054
-
5055
- /**
5056
- * Draw connection into parentGfx.
5057
- *
5058
- * @param {SVGElement} parentGfx
5059
- * @param {Connection} connection
5060
- * @param {Attrs} [attrs]
5061
- *
5062
- * @return {SVGElement} mainGfx
5063
- */
5064
- BpmnRenderer.prototype.drawConnection = function(parentGfx, connection, attrs = {}) {
5065
- var { type } = connection;
5066
-
5067
- var handler = this._renderer(type);
5068
-
5069
- return handler(parentGfx, connection, attrs);
5070
- };
5071
-
5072
- /**
5073
- * Get shape path.
5074
- *
5075
- * @param {Shape} shape
5076
- *
5077
- * @return {string} path
5078
- */
5079
- BpmnRenderer.prototype.getShapePath = function(shape) {
5080
- if (is$1(shape, 'bpmn:Event')) {
5081
- return getCirclePath(shape);
5082
- }
5083
-
5084
- if (is$1(shape, 'bpmn:Activity')) {
5085
- return getRoundRectPath(shape, TASK_BORDER_RADIUS);
5086
- }
5087
-
5088
- if (is$1(shape, 'bpmn:Gateway')) {
5089
- return getDiamondPath(shape);
5090
- }
5091
-
5092
- return getRectPath(shape);
5093
- };
5094
-
5095
- /**
5096
- * Pick attributes if they exist.
5097
- *
5098
- * @param {Object} attrs
5099
- * @param {string[]} keys
5100
- *
5101
- * @returns {Object}
5102
- */
5103
- function pickAttrs(attrs, keys = []) {
5104
- return keys.reduce((pickedAttrs, key) => {
5105
- if (attrs[ key ]) {
5106
- pickedAttrs[ key ] = attrs[ key ];
5107
- }
5108
-
5109
- return pickedAttrs;
5110
- }, {});
2788
+ var markerIds = new Ids();
2789
+
2790
+ var ELEMENT_LABEL_DISTANCE = 10,
2791
+ INNER_OUTER_DIST = 3,
2792
+ PARTICIPANT_STROKE_WIDTH = 1.5,
2793
+ TASK_BORDER_RADIUS = 10;
2794
+
2795
+ var DEFAULT_OPACITY = 0.95,
2796
+ FULL_OPACITY = 1,
2797
+ LOW_OPACITY = 0.25;
2798
+
2799
+ /**
2800
+ * @typedef { Partial<{
2801
+ * defaultFillColor: string,
2802
+ * defaultStrokeColor: string,
2803
+ * defaultLabelColor: string
2804
+ * }> } BpmnRendererConfig
2805
+ *
2806
+ * @typedef { Partial<{
2807
+ * fill: string,
2808
+ * stroke: string,
2809
+ * width: string,
2810
+ * height: string
2811
+ * }> } Attrs
2812
+ */
2813
+
2814
+ /**
2815
+ * @typedef { import('../model/Types').Element } Element
2816
+ * @typedef { import('../model/Types').Shape } Shape
2817
+ * @typedef { import('../model/Types').Connection } Connection
2818
+ */
2819
+
2820
+ /**
2821
+ * A renderer for BPMN elements
2822
+ *
2823
+ * @param {BpmnRendererConfig} config
2824
+ * @param {import('diagram-js/lib/core/EventBus').default} eventBus
2825
+ * @param {import('diagram-js/lib/draw/Styles').default} styles
2826
+ * @param {import('./PathMap').default} pathMap
2827
+ * @param {import('diagram-js/lib/core/Canvas').default} canvas
2828
+ * @param {import('./TextRenderer').default} textRenderer
2829
+ * @param {number} [priority]
2830
+ */
2831
+ function BpmnRenderer(
2832
+ config, eventBus, styles, pathMap,
2833
+ canvas, textRenderer, priority) {
2834
+
2835
+ BaseRenderer.call(this, eventBus, priority);
2836
+
2837
+ var defaultFillColor = config && config.defaultFillColor,
2838
+ defaultStrokeColor = config && config.defaultStrokeColor,
2839
+ defaultLabelColor = config && config.defaultLabelColor;
2840
+
2841
+ function shapeStyle(attrs) {
2842
+ return styles.computeStyle(attrs, {
2843
+ strokeLinecap: 'round',
2844
+ strokeLinejoin: 'round',
2845
+ stroke: black,
2846
+ strokeWidth: 2,
2847
+ fill: 'white'
2848
+ });
2849
+ }
2850
+
2851
+ function lineStyle(attrs) {
2852
+ return styles.computeStyle(attrs, [ 'no-fill' ], {
2853
+ strokeLinecap: 'round',
2854
+ strokeLinejoin: 'round',
2855
+ stroke: black,
2856
+ strokeWidth: 2
2857
+ });
2858
+ }
2859
+
2860
+ function addMarker(id, options) {
2861
+ var {
2862
+ ref = { x: 0, y: 0 },
2863
+ scale = 1,
2864
+ element,
2865
+ parentGfx = canvas._svg
2866
+ } = options;
2867
+
2868
+ var marker = create$1('marker', {
2869
+ id: id,
2870
+ viewBox: '0 0 20 20',
2871
+ refX: ref.x,
2872
+ refY: ref.y,
2873
+ markerWidth: 20 * scale,
2874
+ markerHeight: 20 * scale,
2875
+ orient: 'auto'
2876
+ });
2877
+
2878
+ append(marker, element);
2879
+
2880
+ var defs = query(':scope > defs', parentGfx);
2881
+
2882
+ if (!defs) {
2883
+ defs = create$1('defs');
2884
+
2885
+ append(parentGfx, defs);
2886
+ }
2887
+
2888
+ append(defs, marker);
2889
+ }
2890
+
2891
+ function marker(parentGfx, type, fill, stroke) {
2892
+
2893
+
2894
+ var id = markerIds.nextPrefixed('marker-');
2895
+
2896
+ createMarker(parentGfx, id, type, fill, stroke);
2897
+
2898
+ return 'url(#' + id + ')';
2899
+ }
2900
+
2901
+ function createMarker(parentGfx, id, type, fill, stroke) {
2902
+
2903
+ if (type === 'sequenceflow-end') {
2904
+ var sequenceflowEnd = create$1('path', {
2905
+ d: 'M 1 5 L 11 10 L 1 15 Z',
2906
+ ...shapeStyle({
2907
+ fill: stroke,
2908
+ stroke: stroke,
2909
+ strokeWidth: 1
2910
+ })
2911
+ });
2912
+
2913
+ addMarker(id, {
2914
+ element: sequenceflowEnd,
2915
+ ref: { x: 11, y: 10 },
2916
+ scale: 0.5,
2917
+ parentGfx
2918
+ });
2919
+ }
2920
+
2921
+ if (type === 'messageflow-start') {
2922
+ var messageflowStart = create$1('circle', {
2923
+ cx: 6,
2924
+ cy: 6,
2925
+ r: 3.5,
2926
+ ...shapeStyle({
2927
+ fill,
2928
+ stroke: stroke,
2929
+ strokeWidth: 1,
2930
+
2931
+ // fix for safari / chrome / firefox bug not correctly
2932
+ // resetting stroke dash array
2933
+ strokeDasharray: [ 10000, 1 ]
2934
+ })
2935
+ });
2936
+
2937
+ addMarker(id, {
2938
+ element: messageflowStart,
2939
+ ref: { x: 6, y: 6 },
2940
+ parentGfx
2941
+ });
2942
+ }
2943
+
2944
+ if (type === 'messageflow-end') {
2945
+ var messageflowEnd = create$1('path', {
2946
+ d: 'm 1 5 l 0 -3 l 7 3 l -7 3 z',
2947
+ ...shapeStyle({
2948
+ fill,
2949
+ stroke: stroke,
2950
+ strokeWidth: 1,
2951
+
2952
+ // fix for safari / chrome / firefox bug not correctly
2953
+ // resetting stroke dash array
2954
+ strokeDasharray: [ 10000, 1 ]
2955
+ })
2956
+ });
2957
+
2958
+ addMarker(id, {
2959
+ element: messageflowEnd,
2960
+ ref: { x: 8.5, y: 5 },
2961
+ parentGfx
2962
+ });
2963
+ }
2964
+
2965
+ if (type === 'association-start') {
2966
+ var associationStart = create$1('path', {
2967
+ d: 'M 11 5 L 1 10 L 11 15',
2968
+ ...lineStyle({
2969
+ fill: 'none',
2970
+ stroke,
2971
+ strokeWidth: 1.5,
2972
+
2973
+ // fix for safari / chrome / firefox bug not correctly
2974
+ // resetting stroke dash array
2975
+ strokeDasharray: [ 10000, 1 ]
2976
+ })
2977
+ });
2978
+
2979
+ addMarker(id, {
2980
+ element: associationStart,
2981
+ ref: { x: 1, y: 10 },
2982
+ scale: 0.5,
2983
+ parentGfx
2984
+ });
2985
+ }
2986
+
2987
+ if (type === 'association-end') {
2988
+ var associationEnd = create$1('path', {
2989
+ d: 'M 1 5 L 11 10 L 1 15',
2990
+ ...lineStyle({
2991
+ fill: 'none',
2992
+ stroke,
2993
+ strokeWidth: 1.5,
2994
+
2995
+ // fix for safari / chrome / firefox bug not correctly
2996
+ // resetting stroke dash array
2997
+ strokeDasharray: [ 10000, 1 ]
2998
+ })
2999
+ });
3000
+
3001
+ addMarker(id, {
3002
+ element: associationEnd,
3003
+ ref: { x: 11, y: 10 },
3004
+ scale: 0.5,
3005
+ parentGfx
3006
+ });
3007
+ }
3008
+
3009
+ if (type === 'conditional-flow-marker') {
3010
+ var conditionalFlowMarker = create$1('path', {
3011
+ d: 'M 0 10 L 8 6 L 16 10 L 8 14 Z',
3012
+ ...shapeStyle({
3013
+ fill,
3014
+ stroke: stroke
3015
+ })
3016
+ });
3017
+
3018
+ addMarker(id, {
3019
+ element: conditionalFlowMarker,
3020
+ ref: { x: -1, y: 10 },
3021
+ scale: 0.5,
3022
+ parentGfx
3023
+ });
3024
+ }
3025
+
3026
+ if (type === 'conditional-default-flow-marker') {
3027
+ var defaultFlowMarker = create$1('path', {
3028
+ d: 'M 6 4 L 10 16',
3029
+ ...shapeStyle({
3030
+ stroke: stroke,
3031
+ fill: 'none'
3032
+ })
3033
+ });
3034
+
3035
+ addMarker(id, {
3036
+ element: defaultFlowMarker,
3037
+ ref: { x: 0, y: 10 },
3038
+ scale: 0.5,
3039
+ parentGfx
3040
+ });
3041
+ }
3042
+ }
3043
+
3044
+ function drawCircle(parentGfx, width, height, offset, attrs = {}) {
3045
+
3046
+ if (isObject(offset)) {
3047
+ attrs = offset;
3048
+ offset = 0;
3049
+ }
3050
+
3051
+ offset = offset || 0;
3052
+
3053
+ attrs = shapeStyle(attrs);
3054
+
3055
+ var cx = width / 2,
3056
+ cy = height / 2;
3057
+
3058
+ var circle = create$1('circle', {
3059
+ cx: cx,
3060
+ cy: cy,
3061
+ r: Math.round((width + height) / 4 - offset),
3062
+ ...attrs
3063
+ });
3064
+
3065
+ append(parentGfx, circle);
3066
+
3067
+ return circle;
3068
+ }
3069
+
3070
+ function drawRect(parentGfx, width, height, r, offset, attrs) {
3071
+
3072
+ if (isObject(offset)) {
3073
+ attrs = offset;
3074
+ offset = 0;
3075
+ }
3076
+
3077
+ offset = offset || 0;
3078
+
3079
+ attrs = shapeStyle(attrs);
3080
+
3081
+ var rect = create$1('rect', {
3082
+ x: offset,
3083
+ y: offset,
3084
+ width: width - offset * 2,
3085
+ height: height - offset * 2,
3086
+ rx: r,
3087
+ ry: r,
3088
+ ...attrs
3089
+ });
3090
+
3091
+ append(parentGfx, rect);
3092
+
3093
+ return rect;
3094
+ }
3095
+
3096
+ function drawDiamond(parentGfx, width, height, attrs) {
3097
+
3098
+ var x_2 = width / 2;
3099
+ var y_2 = height / 2;
3100
+
3101
+ var points = [
3102
+ { x: x_2, y: 0 },
3103
+ { x: width, y: y_2 },
3104
+ { x: x_2, y: height },
3105
+ { x: 0, y: y_2 }
3106
+ ];
3107
+
3108
+ var pointsString = points.map(function(point) {
3109
+ return point.x + ',' + point.y;
3110
+ }).join(' ');
3111
+
3112
+ attrs = shapeStyle(attrs);
3113
+
3114
+ var polygon = create$1('polygon', {
3115
+ ...attrs,
3116
+ points: pointsString
3117
+ });
3118
+
3119
+ append(parentGfx, polygon);
3120
+
3121
+ return polygon;
3122
+ }
3123
+
3124
+ /**
3125
+ * @param {SVGElement} parentGfx
3126
+ * @param {Point[]} waypoints
3127
+ * @param {any} attrs
3128
+ * @param {number} [radius]
3129
+ *
3130
+ * @return {SVGElement}
3131
+ */
3132
+ function drawLine(parentGfx, waypoints, attrs, radius) {
3133
+ attrs = lineStyle(attrs);
3134
+
3135
+ var line = createLine(waypoints, attrs, radius);
3136
+
3137
+ append(parentGfx, line);
3138
+
3139
+ return line;
3140
+ }
3141
+
3142
+ /**
3143
+ * @param {SVGElement} parentGfx
3144
+ * @param {Point[]} waypoints
3145
+ * @param {any} attrs
3146
+ *
3147
+ * @return {SVGElement}
3148
+ */
3149
+ function drawConnectionSegments(parentGfx, waypoints, attrs) {
3150
+ return drawLine(parentGfx, waypoints, attrs, 5);
3151
+ }
3152
+
3153
+ function drawPath(parentGfx, d, attrs) {
3154
+ attrs = lineStyle(attrs);
3155
+
3156
+ var path = create$1('path', {
3157
+ ...attrs,
3158
+ d
3159
+ });
3160
+
3161
+ append(parentGfx, path);
3162
+
3163
+ return path;
3164
+ }
3165
+
3166
+ function drawMarker(type, parentGfx, path, attrs) {
3167
+ return drawPath(parentGfx, path, assign$1({ 'data-marker': type }, attrs));
3168
+ }
3169
+
3170
+ function renderer(type) {
3171
+ return handlers[type];
3172
+ }
3173
+
3174
+ function as(type) {
3175
+ return function(parentGfx, element, attrs) {
3176
+ return renderer(type)(parentGfx, element, attrs);
3177
+ };
3178
+ }
3179
+
3180
+ var eventIconRenderers = {
3181
+ 'bpmn:MessageEventDefinition': function(parentGfx, element, attrs = {}, isThrowing) {
3182
+ var pathData = pathMap.getScaledPath('EVENT_MESSAGE', {
3183
+ xScaleFactor: 0.9,
3184
+ yScaleFactor: 0.9,
3185
+ containerWidth: attrs.width || element.width,
3186
+ containerHeight: attrs.height || element.height,
3187
+ position: {
3188
+ mx: 0.235,
3189
+ my: 0.315
3190
+ }
3191
+ });
3192
+
3193
+ var fill = isThrowing
3194
+ ? getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3195
+ : getFillColor(element, defaultFillColor, attrs.fill);
3196
+
3197
+ var stroke = isThrowing
3198
+ ? getFillColor(element, defaultFillColor, attrs.fill)
3199
+ : getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3200
+
3201
+ var messagePath = drawPath(parentGfx, pathData, {
3202
+ fill,
3203
+ stroke,
3204
+ strokeWidth: 1
3205
+ });
3206
+
3207
+ return messagePath;
3208
+ },
3209
+ 'bpmn:TimerEventDefinition': function(parentGfx, element, attrs = {}) {
3210
+ var baseWidth = attrs.width || element.width;
3211
+ var baseHeight = attrs.height || element.height;
3212
+
3213
+ // use a lighter stroke for event suprocess icons
3214
+ var strokeWidth = attrs.width ? 1 : 2;
3215
+
3216
+ var circle = drawCircle(parentGfx, baseWidth, baseHeight, 0.2 * baseHeight, {
3217
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3218
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3219
+ strokeWidth: strokeWidth
3220
+ });
3221
+
3222
+ var pathData = pathMap.getScaledPath('EVENT_TIMER_WH', {
3223
+ xScaleFactor: 0.75,
3224
+ yScaleFactor: 0.75,
3225
+ containerWidth: baseWidth,
3226
+ containerHeight: baseHeight,
3227
+ position: {
3228
+ mx: 0.5,
3229
+ my: 0.5
3230
+ }
3231
+ });
3232
+
3233
+ drawPath(parentGfx, pathData, {
3234
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3235
+ strokeWidth: strokeWidth
3236
+ });
3237
+
3238
+ for (var i = 0; i < 12; i++) {
3239
+ var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
3240
+ xScaleFactor: 0.75,
3241
+ yScaleFactor: 0.75,
3242
+ containerWidth: baseWidth,
3243
+ containerHeight: baseHeight,
3244
+ position: {
3245
+ mx: 0.5,
3246
+ my: 0.5
3247
+ }
3248
+ });
3249
+
3250
+ var width = baseWidth / 2,
3251
+ height = baseHeight / 2;
3252
+
3253
+ drawPath(parentGfx, linePathData, {
3254
+ strokeWidth: 1,
3255
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3256
+ transform: 'rotate(' + (i * 30) + ',' + height + ',' + width + ')'
3257
+ });
3258
+ }
3259
+
3260
+ return circle;
3261
+ },
3262
+ 'bpmn:EscalationEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3263
+ var pathData = pathMap.getScaledPath('EVENT_ESCALATION', {
3264
+ xScaleFactor: 1,
3265
+ yScaleFactor: 1,
3266
+ containerWidth: attrs.width || event.width,
3267
+ containerHeight: attrs.height || event.height,
3268
+ position: {
3269
+ mx: 0.5,
3270
+ my: 0.2
3271
+ }
3272
+ });
3273
+
3274
+ var fill = isThrowing
3275
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3276
+ : getFillColor(event, defaultFillColor, attrs.fill);
3277
+
3278
+ return drawPath(parentGfx, pathData, {
3279
+ fill,
3280
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3281
+ strokeWidth: 1
3282
+ });
3283
+ },
3284
+ 'bpmn:ConditionalEventDefinition': function(parentGfx, event, attrs = {}) {
3285
+ var pathData = pathMap.getScaledPath('EVENT_CONDITIONAL', {
3286
+ xScaleFactor: 1,
3287
+ yScaleFactor: 1,
3288
+ containerWidth: attrs.width || event.width,
3289
+ containerHeight: attrs.height || event.height,
3290
+ position: {
3291
+ mx: 0.5,
3292
+ my: 0.222
3293
+ }
3294
+ });
3295
+
3296
+ return drawPath(parentGfx, pathData, {
3297
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
3298
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3299
+ strokeWidth: 1
3300
+ });
3301
+ },
3302
+ 'bpmn:LinkEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3303
+ var pathData = pathMap.getScaledPath('EVENT_LINK', {
3304
+ xScaleFactor: 1,
3305
+ yScaleFactor: 1,
3306
+ containerWidth: event.width,
3307
+ containerHeight: event.height,
3308
+ position: {
3309
+ mx: 0.57,
3310
+ my: 0.263
3311
+ }
3312
+ });
3313
+
3314
+ var fill = isThrowing
3315
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3316
+ : getFillColor(event, defaultFillColor, attrs.fill);
3317
+
3318
+ return drawPath(parentGfx, pathData, {
3319
+ fill,
3320
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3321
+ strokeWidth: 1
3322
+ });
3323
+ },
3324
+ 'bpmn:ErrorEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3325
+ var pathData = pathMap.getScaledPath('EVENT_ERROR', {
3326
+ xScaleFactor: 1.1,
3327
+ yScaleFactor: 1.1,
3328
+ containerWidth: attrs.width || event.width,
3329
+ containerHeight: attrs.height || event.height,
3330
+ position: {
3331
+ mx: 0.2,
3332
+ my: 0.722
3333
+ }
3334
+ });
3335
+
3336
+ var fill = isThrowing
3337
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3338
+ : getFillColor(event, defaultFillColor, attrs.fill);
3339
+
3340
+ return drawPath(parentGfx, pathData, {
3341
+ fill,
3342
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3343
+ strokeWidth: 1
3344
+ });
3345
+ },
3346
+ 'bpmn:CancelEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3347
+ var pathData = pathMap.getScaledPath('EVENT_CANCEL_45', {
3348
+ xScaleFactor: 1.0,
3349
+ yScaleFactor: 1.0,
3350
+ containerWidth: event.width,
3351
+ containerHeight: event.height,
3352
+ position: {
3353
+ mx: 0.638,
3354
+ my: -0.055
3355
+ }
3356
+ });
3357
+
3358
+ var fill = isThrowing ? getStrokeColor(event, defaultStrokeColor, attrs.stroke) : 'none';
3359
+
3360
+ var path = drawPath(parentGfx, pathData, {
3361
+ fill,
3362
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3363
+ strokeWidth: 1
3364
+ });
3365
+
3366
+ rotate(path, 45);
3367
+
3368
+ return path;
3369
+ },
3370
+ 'bpmn:CompensateEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3371
+ var pathData = pathMap.getScaledPath('EVENT_COMPENSATION', {
3372
+ xScaleFactor: 1,
3373
+ yScaleFactor: 1,
3374
+ containerWidth: attrs.width || event.width,
3375
+ containerHeight: attrs.height || event.height,
3376
+ position: {
3377
+ mx: 0.22,
3378
+ my: 0.5
3379
+ }
3380
+ });
3381
+
3382
+ var fill = isThrowing
3383
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3384
+ : getFillColor(event, defaultFillColor, attrs.fill);
3385
+
3386
+ return drawPath(parentGfx, pathData, {
3387
+ fill,
3388
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3389
+ strokeWidth: 1
3390
+ });
3391
+ },
3392
+ 'bpmn:SignalEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3393
+ var pathData = pathMap.getScaledPath('EVENT_SIGNAL', {
3394
+ xScaleFactor: 0.9,
3395
+ yScaleFactor: 0.9,
3396
+ containerWidth: attrs.width || event.width,
3397
+ containerHeight: attrs.height || event.height,
3398
+ position: {
3399
+ mx: 0.5,
3400
+ my: 0.2
3401
+ }
3402
+ });
3403
+
3404
+ var fill = isThrowing
3405
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3406
+ : getFillColor(event, defaultFillColor, attrs.fill);
3407
+
3408
+ return drawPath(parentGfx, pathData, {
3409
+ strokeWidth: 1,
3410
+ fill,
3411
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3412
+ });
3413
+ },
3414
+ 'bpmn:MultipleEventDefinition': function(parentGfx, event, attrs = {}, isThrowing) {
3415
+ var pathData = pathMap.getScaledPath('EVENT_MULTIPLE', {
3416
+ xScaleFactor: 1.1,
3417
+ yScaleFactor: 1.1,
3418
+ containerWidth: attrs.width || event.width,
3419
+ containerHeight: attrs.height || event.height,
3420
+ position: {
3421
+ mx: 0.211,
3422
+ my: 0.36
3423
+ }
3424
+ });
3425
+
3426
+ var fill = isThrowing
3427
+ ? getStrokeColor(event, defaultStrokeColor, attrs.stroke)
3428
+ : getFillColor(event, defaultFillColor, attrs.fill);
3429
+
3430
+ return drawPath(parentGfx, pathData, {
3431
+ fill,
3432
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3433
+ strokeWidth: 1
3434
+ });
3435
+ },
3436
+ 'bpmn:ParallelMultipleEventDefinition': function(parentGfx, event, attrs = {}) {
3437
+ var pathData = pathMap.getScaledPath('EVENT_PARALLEL_MULTIPLE', {
3438
+ xScaleFactor: 1.2,
3439
+ yScaleFactor: 1.2,
3440
+ containerWidth: attrs.width || event.width,
3441
+ containerHeight: attrs.height || event.height,
3442
+ position: {
3443
+ mx: 0.458,
3444
+ my: 0.194
3445
+ }
3446
+ });
3447
+
3448
+ return drawPath(parentGfx, pathData, {
3449
+ fill: getFillColor(event, defaultFillColor, attrs.fill),
3450
+ stroke: getStrokeColor(event, defaultStrokeColor, attrs.stroke),
3451
+ strokeWidth: 1
3452
+ });
3453
+ },
3454
+ 'bpmn:TerminateEventDefinition': function(parentGfx, element, attrs = {}) {
3455
+ var circle = drawCircle(parentGfx, element.width, element.height, 8, {
3456
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3457
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3458
+ strokeWidth: 4
3459
+ });
3460
+
3461
+ return circle;
3462
+ }
3463
+ };
3464
+
3465
+ function renderEventIcon(element, parentGfx, attrs = {}, proxyElement) {
3466
+ var semantic = getBusinessObject(element),
3467
+ isThrowing = isThrowEvent(semantic);
3468
+
3469
+ var nodeElement = proxyElement || element;
3470
+
3471
+ if (semantic.get('eventDefinitions') && semantic.get('eventDefinitions').length > 1) {
3472
+ if (semantic.get('parallelMultiple')) {
3473
+ return eventIconRenderers[ 'bpmn:ParallelMultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3474
+ }
3475
+ else {
3476
+ return eventIconRenderers[ 'bpmn:MultipleEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3477
+ }
3478
+ }
3479
+
3480
+ if (isTypedEvent(semantic, 'bpmn:MessageEventDefinition')) {
3481
+ return eventIconRenderers[ 'bpmn:MessageEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3482
+ }
3483
+
3484
+ if (isTypedEvent(semantic, 'bpmn:TimerEventDefinition')) {
3485
+ return eventIconRenderers[ 'bpmn:TimerEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3486
+ }
3487
+
3488
+ if (isTypedEvent(semantic, 'bpmn:ConditionalEventDefinition')) {
3489
+ return eventIconRenderers[ 'bpmn:ConditionalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3490
+ }
3491
+
3492
+ if (isTypedEvent(semantic, 'bpmn:SignalEventDefinition')) {
3493
+ return eventIconRenderers[ 'bpmn:SignalEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3494
+ }
3495
+
3496
+ if (isTypedEvent(semantic, 'bpmn:EscalationEventDefinition')) {
3497
+ return eventIconRenderers[ 'bpmn:EscalationEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3498
+ }
3499
+
3500
+ if (isTypedEvent(semantic, 'bpmn:LinkEventDefinition')) {
3501
+ return eventIconRenderers[ 'bpmn:LinkEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3502
+ }
3503
+
3504
+ if (isTypedEvent(semantic, 'bpmn:ErrorEventDefinition')) {
3505
+ return eventIconRenderers[ 'bpmn:ErrorEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3506
+ }
3507
+
3508
+ if (isTypedEvent(semantic, 'bpmn:CancelEventDefinition')) {
3509
+ return eventIconRenderers[ 'bpmn:CancelEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3510
+ }
3511
+
3512
+ if (isTypedEvent(semantic, 'bpmn:CompensateEventDefinition')) {
3513
+ return eventIconRenderers[ 'bpmn:CompensateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3514
+ }
3515
+
3516
+ if (isTypedEvent(semantic, 'bpmn:TerminateEventDefinition')) {
3517
+ return eventIconRenderers[ 'bpmn:TerminateEventDefinition' ](parentGfx, nodeElement, attrs, isThrowing);
3518
+ }
3519
+
3520
+ return null;
3521
+ }
3522
+
3523
+ var taskMarkerRenderers = {
3524
+ 'ParticipantMultiplicityMarker': function(parentGfx, element, attrs = {}) {
3525
+ var width = getWidth(element, attrs),
3526
+ height = getHeight(element, attrs);
3527
+
3528
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3529
+ xScaleFactor: 1,
3530
+ yScaleFactor: 1,
3531
+ containerWidth: width,
3532
+ containerHeight: height,
3533
+ position: {
3534
+ mx: ((width / 2 - 6) / width),
3535
+ my: (height - 15) / height
3536
+ }
3537
+ });
3538
+
3539
+ drawMarker('participant-multiplicity', parentGfx, markerPath, {
3540
+ strokeWidth: 2,
3541
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3542
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3543
+ });
3544
+ },
3545
+ 'SubProcessMarker': function(parentGfx, element, attrs = {}) {
3546
+ var markerRect = drawRect(parentGfx, 14, 14, 0, {
3547
+ strokeWidth: 1,
3548
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3549
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3550
+ });
3551
+
3552
+ translate$1(markerRect, element.width / 2 - 7.5, element.height - 20);
3553
+
3554
+ var markerPath = pathMap.getScaledPath('MARKER_SUB_PROCESS', {
3555
+ xScaleFactor: 1.5,
3556
+ yScaleFactor: 1.5,
3557
+ containerWidth: element.width,
3558
+ containerHeight: element.height,
3559
+ position: {
3560
+ mx: (element.width / 2 - 7.5) / element.width,
3561
+ my: (element.height - 20) / element.height
3562
+ }
3563
+ });
3564
+
3565
+ drawMarker('sub-process', parentGfx, markerPath, {
3566
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3567
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3568
+ });
3569
+ },
3570
+ 'ParallelMarker': function(parentGfx, element, attrs) {
3571
+ var width = getWidth(element, attrs),
3572
+ height = getHeight(element, attrs);
3573
+
3574
+ var markerPath = pathMap.getScaledPath('MARKER_PARALLEL', {
3575
+ xScaleFactor: 1,
3576
+ yScaleFactor: 1,
3577
+ containerWidth: width,
3578
+ containerHeight: height,
3579
+ position: {
3580
+ mx: ((width / 2 + attrs.parallel) / width),
3581
+ my: (height - 20) / height
3582
+ }
3583
+ });
3584
+
3585
+ drawMarker('parallel', parentGfx, markerPath, {
3586
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3587
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3588
+ });
3589
+ },
3590
+ 'SequentialMarker': function(parentGfx, element, attrs) {
3591
+ var markerPath = pathMap.getScaledPath('MARKER_SEQUENTIAL', {
3592
+ xScaleFactor: 1,
3593
+ yScaleFactor: 1,
3594
+ containerWidth: element.width,
3595
+ containerHeight: element.height,
3596
+ position: {
3597
+ mx: ((element.width / 2 + attrs.seq) / element.width),
3598
+ my: (element.height - 19) / element.height
3599
+ }
3600
+ });
3601
+
3602
+ drawMarker('sequential', parentGfx, markerPath, {
3603
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3604
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3605
+ });
3606
+ },
3607
+ 'CompensationMarker': function(parentGfx, element, attrs) {
3608
+ var markerMath = pathMap.getScaledPath('MARKER_COMPENSATION', {
3609
+ xScaleFactor: 1,
3610
+ yScaleFactor: 1,
3611
+ containerWidth: element.width,
3612
+ containerHeight: element.height,
3613
+ position: {
3614
+ mx: ((element.width / 2 + attrs.compensation) / element.width),
3615
+ my: (element.height - 13) / element.height
3616
+ }
3617
+ });
3618
+
3619
+ drawMarker('compensation', parentGfx, markerMath, {
3620
+ strokeWidth: 1,
3621
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3622
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3623
+ });
3624
+ },
3625
+ 'LoopMarker': function(parentGfx, element, attrs) {
3626
+ var width = getWidth(element, attrs),
3627
+ height = getHeight(element, attrs);
3628
+
3629
+ var markerPath = pathMap.getScaledPath('MARKER_LOOP', {
3630
+ xScaleFactor: 1,
3631
+ yScaleFactor: 1,
3632
+ containerWidth: width,
3633
+ containerHeight: height,
3634
+ position: {
3635
+ mx: ((width / 2 + attrs.loop) / width),
3636
+ my: (height - 7) / height
3637
+ }
3638
+ });
3639
+
3640
+ drawMarker('loop', parentGfx, markerPath, {
3641
+ strokeWidth: 1.5,
3642
+ fill: 'none',
3643
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3644
+ strokeMiterlimit: 0.5
3645
+ });
3646
+ },
3647
+ 'AdhocMarker': function(parentGfx, element, attrs) {
3648
+ var width = getWidth(element, attrs),
3649
+ height = getHeight(element, attrs);
3650
+
3651
+ var markerPath = pathMap.getScaledPath('MARKER_ADHOC', {
3652
+ xScaleFactor: 1,
3653
+ yScaleFactor: 1,
3654
+ containerWidth: width,
3655
+ containerHeight: height,
3656
+ position: {
3657
+ mx: ((width / 2 + attrs.adhoc) / width),
3658
+ my: (height - 15) / height
3659
+ }
3660
+ });
3661
+
3662
+ drawMarker('adhoc', parentGfx, markerPath, {
3663
+ strokeWidth: 1,
3664
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3665
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3666
+ });
3667
+ }
3668
+ };
3669
+
3670
+ function renderTaskMarker(type, parentGfx, element, attrs) {
3671
+ taskMarkerRenderers[ type ](parentGfx, element, attrs);
3672
+ }
3673
+
3674
+ function renderTaskMarkers(parentGfx, element, taskMarkers = [], attrs = {}) {
3675
+ attrs = {
3676
+ fill: attrs.fill,
3677
+ stroke: attrs.stroke,
3678
+ width: getWidth(element, attrs),
3679
+ height: getHeight(element, attrs)
3680
+ };
3681
+
3682
+ var semantic = getBusinessObject(element);
3683
+
3684
+ var subprocess = taskMarkers.includes('SubProcessMarker');
3685
+
3686
+ if (subprocess) {
3687
+ attrs = {
3688
+ ...attrs,
3689
+ seq: -21,
3690
+ parallel: -22,
3691
+ compensation: -25,
3692
+ loop: -18,
3693
+ adhoc: 10
3694
+ };
3695
+ } else {
3696
+ attrs = {
3697
+ ...attrs,
3698
+ seq: -5,
3699
+ parallel: -6,
3700
+ compensation: -7,
3701
+ loop: 0,
3702
+ adhoc: -8
3703
+ };
3704
+ }
3705
+
3706
+ if (semantic.get('isForCompensation')) {
3707
+ taskMarkers.push('CompensationMarker');
3708
+ }
3709
+
3710
+ if (is$1(semantic, 'bpmn:AdHocSubProcess')) {
3711
+ taskMarkers.push('AdhocMarker');
3712
+
3713
+ if (!subprocess) {
3714
+ assign$1(attrs, { compensation: attrs.compensation - 18 });
3715
+ }
3716
+ }
3717
+
3718
+ var loopCharacteristics = semantic.get('loopCharacteristics'),
3719
+ isSequential = loopCharacteristics && loopCharacteristics.get('isSequential');
3720
+
3721
+ if (loopCharacteristics) {
3722
+
3723
+ assign$1(attrs, {
3724
+ compensation: attrs.compensation - 18,
3725
+ });
3726
+
3727
+ if (taskMarkers.includes('AdhocMarker')) {
3728
+ assign$1(attrs, {
3729
+ seq: -23,
3730
+ loop: -18,
3731
+ parallel: -24
3732
+ });
3733
+ }
3734
+
3735
+ if (isSequential === undefined) {
3736
+ taskMarkers.push('LoopMarker');
3737
+ }
3738
+
3739
+ if (isSequential === false) {
3740
+ taskMarkers.push('ParallelMarker');
3741
+ }
3742
+
3743
+ if (isSequential === true) {
3744
+ taskMarkers.push('SequentialMarker');
3745
+ }
3746
+ }
3747
+
3748
+ if (taskMarkers.includes('CompensationMarker') && taskMarkers.length === 1) {
3749
+ assign$1(attrs, {
3750
+ compensation: -8
3751
+ });
3752
+ }
3753
+
3754
+ forEach$1(taskMarkers, function(marker) {
3755
+ renderTaskMarker(marker, parentGfx, element, attrs);
3756
+ });
3757
+ }
3758
+
3759
+ function renderLabel(parentGfx, label, attrs = {}) {
3760
+ attrs = assign$1({
3761
+ size: {
3762
+ width: 100
3763
+ }
3764
+ }, attrs);
3765
+
3766
+ var text = textRenderer.createText(label || '', attrs);
3767
+
3768
+ classes$1(text).add('djs-label');
3769
+
3770
+ append(parentGfx, text);
3771
+
3772
+ return text;
3773
+ }
3774
+
3775
+ function renderEmbeddedLabel(parentGfx, element, align, attrs = {}) {
3776
+ var semantic = getBusinessObject(element);
3777
+
3778
+ var box = getBounds({
3779
+ x: element.x,
3780
+ y: element.y,
3781
+ width: element.width,
3782
+ height: element.height
3783
+ }, attrs);
3784
+
3785
+ return renderLabel(parentGfx, semantic.name, {
3786
+ align,
3787
+ box,
3788
+ padding: 7,
3789
+ style: {
3790
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3791
+ }
3792
+ });
3793
+ }
3794
+
3795
+ function renderExternalLabel(parentGfx, element, attrs = {}) {
3796
+ var box = {
3797
+ width: 90,
3798
+ height: 30,
3799
+ x: element.width / 2 + element.x,
3800
+ y: element.height / 2 + element.y
3801
+ };
3802
+
3803
+ return renderLabel(parentGfx, getLabel(element), {
3804
+ box: box,
3805
+ fitBox: true,
3806
+ style: assign$1(
3807
+ {},
3808
+ textRenderer.getExternalStyle(),
3809
+ {
3810
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3811
+ }
3812
+ )
3813
+ });
3814
+ }
3815
+
3816
+ function renderLaneLabel(parentGfx, text, element, attrs = {}) {
3817
+ var isHorizontalLane = isHorizontal(element);
3818
+
3819
+ var textBox = renderLabel(parentGfx, text, {
3820
+ box: {
3821
+ height: 30,
3822
+ width: isHorizontalLane ? getHeight(element, attrs) : getWidth(element, attrs),
3823
+ },
3824
+ align: 'center-middle',
3825
+ style: {
3826
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
3827
+ }
3828
+ });
3829
+
3830
+ if (isHorizontalLane) {
3831
+ var top = -1 * getHeight(element, attrs);
3832
+ transform(textBox, 0, -top, 270);
3833
+ }
3834
+ }
3835
+
3836
+ function renderActivity(parentGfx, element, attrs = {}) {
3837
+ var {
3838
+ width,
3839
+ height
3840
+ } = getBounds(element, attrs);
3841
+
3842
+ return drawRect(parentGfx, width, height, TASK_BORDER_RADIUS, {
3843
+ ...attrs,
3844
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3845
+ fillOpacity: DEFAULT_OPACITY,
3846
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3847
+ });
3848
+ }
3849
+
3850
+ function renderAssociation(parentGfx, element, attrs = {}) {
3851
+ var semantic = getBusinessObject(element);
3852
+
3853
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
3854
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3855
+
3856
+ if (semantic.get('associationDirection') === 'One' ||
3857
+ semantic.get('associationDirection') === 'Both') {
3858
+ attrs.markerEnd = marker(parentGfx, 'association-end', fill, stroke);
3859
+ }
3860
+
3861
+ if (semantic.get('associationDirection') === 'Both') {
3862
+ attrs.markerStart = marker(parentGfx, 'association-start', fill, stroke);
3863
+ }
3864
+
3865
+ attrs = pickAttrs(attrs, [
3866
+ 'markerStart',
3867
+ 'markerEnd'
3868
+ ]);
3869
+
3870
+ return drawConnectionSegments(parentGfx, element.waypoints, {
3871
+ ...attrs,
3872
+ stroke,
3873
+ strokeDasharray: '0, 5'
3874
+ });
3875
+ }
3876
+
3877
+ function renderDataObject(parentGfx, element, attrs = {}) {
3878
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
3879
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
3880
+
3881
+ var pathData = pathMap.getScaledPath('DATA_OBJECT_PATH', {
3882
+ xScaleFactor: 1,
3883
+ yScaleFactor: 1,
3884
+ containerWidth: element.width,
3885
+ containerHeight: element.height,
3886
+ position: {
3887
+ mx: 0.474,
3888
+ my: 0.296
3889
+ }
3890
+ });
3891
+
3892
+ var dataObject = drawPath(parentGfx, pathData, {
3893
+ fill,
3894
+ fillOpacity: DEFAULT_OPACITY,
3895
+ stroke
3896
+ });
3897
+
3898
+ var semantic = getBusinessObject(element);
3899
+
3900
+ if (isCollection(semantic)) {
3901
+ var collectionPathData = pathMap.getScaledPath('DATA_OBJECT_COLLECTION_PATH', {
3902
+ xScaleFactor: 1,
3903
+ yScaleFactor: 1,
3904
+ containerWidth: element.width,
3905
+ containerHeight: element.height,
3906
+ position: {
3907
+ mx: 0.33,
3908
+ my: (element.height - 18) / element.height
3909
+ }
3910
+ });
3911
+
3912
+ drawPath(parentGfx, collectionPathData, {
3913
+ strokeWidth: 2,
3914
+ fill,
3915
+ stroke
3916
+ });
3917
+ }
3918
+
3919
+ return dataObject;
3920
+ }
3921
+
3922
+ function renderEvent(parentGfx, element, attrs = {}) {
3923
+ return drawCircle(parentGfx, element.width, element.height, {
3924
+ fillOpacity: DEFAULT_OPACITY,
3925
+ ...attrs,
3926
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3927
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3928
+ });
3929
+ }
3930
+
3931
+ function renderGateway(parentGfx, element, attrs = {}) {
3932
+ return drawDiamond(parentGfx, element.width, element.height, {
3933
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3934
+ fillOpacity: DEFAULT_OPACITY,
3935
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
3936
+ });
3937
+ }
3938
+
3939
+ function renderLane(parentGfx, element, attrs = {}) {
3940
+ var lane = drawRect(parentGfx, getWidth(element, attrs), getHeight(element, attrs), 0, {
3941
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
3942
+ fillOpacity: attrs.fillOpacity || DEFAULT_OPACITY,
3943
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
3944
+ strokeWidth: 1.5
3945
+ });
3946
+
3947
+ var semantic = getBusinessObject(element);
3948
+
3949
+ if (is$1(semantic, 'bpmn:Lane')) {
3950
+ var text = semantic.get('name');
3951
+
3952
+ renderLaneLabel(parentGfx, text, element, attrs);
3953
+ }
3954
+
3955
+ return lane;
3956
+ }
3957
+
3958
+ function renderSubProcess(parentGfx, element, attrs = {}) {
3959
+ var activity = renderActivity(parentGfx, element, attrs);
3960
+
3961
+ var expanded = isExpanded(element);
3962
+
3963
+ if (isEventSubProcess(element)) {
3964
+ attr$1(activity, {
3965
+ strokeDasharray: '0, 5.5',
3966
+ strokeWidth: 2.5
3967
+ });
3968
+
3969
+ if (!expanded) {
3970
+ var flowElements = getBusinessObject(element).flowElements || [];
3971
+ var startEvents = flowElements.filter(e => is$1(e, 'bpmn:StartEvent'));
3972
+
3973
+ if (startEvents.length === 1) {
3974
+ renderEventSubProcessIcon(startEvents[0], parentGfx, attrs, element);
3975
+ }
3976
+ }
3977
+ }
3978
+
3979
+ renderEmbeddedLabel(parentGfx, element, expanded ? 'center-top' : 'center-middle', attrs);
3980
+
3981
+ if (expanded) {
3982
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
3983
+ } else {
3984
+ renderTaskMarkers(parentGfx, element, [ 'SubProcessMarker' ], attrs);
3985
+ }
3986
+
3987
+ return activity;
3988
+ }
3989
+
3990
+ function renderEventSubProcessIcon(startEvent, parentGfx, attrs, proxyElement) {
3991
+ var iconSize = 22;
3992
+
3993
+ // match the colors of the enclosing subprocess
3994
+ var proxyAttrs = {
3995
+ fill: getFillColor(proxyElement, defaultFillColor, attrs.fill),
3996
+ stroke: getStrokeColor(proxyElement, defaultStrokeColor, attrs.stroke),
3997
+ width: iconSize,
3998
+ height: iconSize
3999
+ };
4000
+
4001
+ var interrupting = getBusinessObject(startEvent).isInterrupting;
4002
+ var strokeDasharray = interrupting ? 0 : 3;
4003
+
4004
+ // better visibility for non-interrupting events
4005
+ var strokeWidth = interrupting ? 1 : 1.2;
4006
+
4007
+ // make the icon look larger by drawing a smaller circle
4008
+ var circleSize = 20;
4009
+ var shift = (iconSize - circleSize) / 2;
4010
+ var transform = 'translate(' + shift + ',' + shift + ')';
4011
+
4012
+ drawCircle(parentGfx, circleSize, circleSize, {
4013
+ fill: proxyAttrs.fill,
4014
+ stroke: proxyAttrs.stroke,
4015
+ strokeWidth,
4016
+ strokeDasharray,
4017
+ transform
4018
+ });
4019
+
4020
+ renderEventIcon(startEvent, parentGfx, proxyAttrs, proxyElement);
4021
+ }
4022
+
4023
+ function renderTask(parentGfx, element, attrs = {}) {
4024
+ var activity = renderActivity(parentGfx, element, attrs);
4025
+
4026
+ renderEmbeddedLabel(parentGfx, element, 'center-middle', attrs);
4027
+
4028
+ renderTaskMarkers(parentGfx, element, undefined, attrs);
4029
+
4030
+ return activity;
4031
+ }
4032
+
4033
+ var handlers = this.handlers = {
4034
+ 'bpmn:AdHocSubProcess': function(parentGfx, element, attrs = {}) {
4035
+ if (isExpanded(element)) {
4036
+ attrs = pickAttrs(attrs, [
4037
+ 'fill',
4038
+ 'stroke',
4039
+ 'width',
4040
+ 'height'
4041
+ ]);
4042
+ } else {
4043
+ attrs = pickAttrs(attrs, [
4044
+ 'fill',
4045
+ 'stroke'
4046
+ ]);
4047
+ }
4048
+
4049
+ return renderSubProcess(parentGfx, element, attrs);
4050
+ },
4051
+ 'bpmn:Association': function(parentGfx, element, attrs = {}) {
4052
+ attrs = pickAttrs(attrs, [
4053
+ 'fill',
4054
+ 'stroke'
4055
+ ]);
4056
+
4057
+ return renderAssociation(parentGfx, element, attrs);
4058
+ },
4059
+ 'bpmn:BoundaryEvent': function(parentGfx, element, attrs = {}) {
4060
+ var { renderIcon = true } = attrs;
4061
+
4062
+ attrs = pickAttrs(attrs, [
4063
+ 'fill',
4064
+ 'stroke'
4065
+ ]);
4066
+
4067
+ var semantic = getBusinessObject(element),
4068
+ cancelActivity = semantic.get('cancelActivity');
4069
+
4070
+ attrs = {
4071
+ strokeWidth: 1.5,
4072
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4073
+ fillOpacity: FULL_OPACITY,
4074
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4075
+ };
4076
+
4077
+ if (!cancelActivity) {
4078
+ attrs.strokeDasharray = '6';
4079
+ }
4080
+
4081
+ var event = renderEvent(parentGfx, element, attrs);
4082
+
4083
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4084
+ ...attrs,
4085
+ fill: 'none'
4086
+ });
4087
+
4088
+ if (renderIcon) {
4089
+ renderEventIcon(element, parentGfx, attrs);
4090
+ }
4091
+
4092
+ return event;
4093
+ },
4094
+ 'bpmn:BusinessRuleTask': function(parentGfx, element, attrs = {}) {
4095
+ attrs = pickAttrs(attrs, [
4096
+ 'fill',
4097
+ 'stroke'
4098
+ ]);
4099
+
4100
+ var task = renderTask(parentGfx, element, attrs);
4101
+
4102
+ var headerData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_MAIN', {
4103
+ abspos: {
4104
+ x: 8,
4105
+ y: 8
4106
+ }
4107
+ });
4108
+
4109
+ var businessPath = drawPath(parentGfx, headerData);
4110
+
4111
+ attr$1(businessPath, {
4112
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4113
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4114
+ strokeWidth: 1
4115
+ });
4116
+
4117
+ var headerPathData = pathMap.getScaledPath('TASK_TYPE_BUSINESS_RULE_HEADER', {
4118
+ abspos: {
4119
+ x: 8,
4120
+ y: 8
4121
+ }
4122
+ });
4123
+
4124
+ var businessHeaderPath = drawPath(parentGfx, headerPathData);
4125
+
4126
+ attr$1(businessHeaderPath, {
4127
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4128
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4129
+ strokeWidth: 1
4130
+ });
4131
+
4132
+ return task;
4133
+ },
4134
+ 'bpmn:CallActivity': function(parentGfx, element, attrs = {}) {
4135
+ attrs = pickAttrs(attrs, [
4136
+ 'fill',
4137
+ 'stroke'
4138
+ ]);
4139
+
4140
+ return renderSubProcess(parentGfx, element, {
4141
+ strokeWidth: 5,
4142
+ ...attrs
4143
+ });
4144
+ },
4145
+ 'bpmn:ComplexGateway': function(parentGfx, element, attrs = {}) {
4146
+ attrs = pickAttrs(attrs, [
4147
+ 'fill',
4148
+ 'stroke'
4149
+ ]);
4150
+
4151
+ var gateway = renderGateway(parentGfx, element, attrs);
4152
+
4153
+ var pathData = pathMap.getScaledPath('GATEWAY_COMPLEX', {
4154
+ xScaleFactor: 0.5,
4155
+ yScaleFactor:0.5,
4156
+ containerWidth: element.width,
4157
+ containerHeight: element.height,
4158
+ position: {
4159
+ mx: 0.46,
4160
+ my: 0.26
4161
+ }
4162
+ });
4163
+
4164
+ drawPath(parentGfx, pathData, {
4165
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4166
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4167
+ strokeWidth: 1
4168
+ });
4169
+
4170
+ return gateway;
4171
+ },
4172
+ 'bpmn:DataInput': function(parentGfx, element, attrs = {}) {
4173
+ attrs = pickAttrs(attrs, [
4174
+ 'fill',
4175
+ 'stroke'
4176
+ ]);
4177
+
4178
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4179
+
4180
+ var dataObject = renderDataObject(parentGfx, element, attrs);
4181
+
4182
+ drawPath(parentGfx, arrowPathData, {
4183
+ fill: 'none',
4184
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4185
+ strokeWidth: 1
4186
+ });
4187
+
4188
+ return dataObject;
4189
+ },
4190
+ 'bpmn:DataInputAssociation': function(parentGfx, element, attrs = {}) {
4191
+ attrs = pickAttrs(attrs, [
4192
+ 'fill',
4193
+ 'stroke'
4194
+ ]);
4195
+
4196
+ return renderAssociation(parentGfx, element, {
4197
+ ...attrs,
4198
+ markerEnd: marker(parentGfx, 'association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
4199
+ });
4200
+ },
4201
+ 'bpmn:DataObject': function(parentGfx, element, attrs = {}) {
4202
+ attrs = pickAttrs(attrs, [
4203
+ 'fill',
4204
+ 'stroke'
4205
+ ]);
4206
+
4207
+ return renderDataObject(parentGfx, element, attrs);
4208
+ },
4209
+ 'bpmn:DataObjectReference': as('bpmn:DataObject'),
4210
+ 'bpmn:DataOutput': function(parentGfx, element, attrs = {}) {
4211
+ attrs = pickAttrs(attrs, [
4212
+ 'fill',
4213
+ 'stroke'
4214
+ ]);
4215
+
4216
+ var arrowPathData = pathMap.getRawPath('DATA_ARROW');
4217
+
4218
+ var dataObject = renderDataObject(parentGfx, element, attrs);
4219
+
4220
+ drawPath(parentGfx, arrowPathData, {
4221
+ strokeWidth: 1,
4222
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4223
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4224
+ });
4225
+
4226
+ return dataObject;
4227
+ },
4228
+ 'bpmn:DataOutputAssociation': function(parentGfx, element, attrs = {}) {
4229
+ attrs = pickAttrs(attrs, [
4230
+ 'fill',
4231
+ 'stroke'
4232
+ ]);
4233
+
4234
+ return renderAssociation(parentGfx, element, {
4235
+ ...attrs,
4236
+ markerEnd: marker(parentGfx, 'association-end', getFillColor(element, defaultFillColor, attrs.fill), getStrokeColor(element, defaultStrokeColor, attrs.stroke))
4237
+ });
4238
+ },
4239
+ 'bpmn:DataStoreReference': function(parentGfx, element, attrs = {}) {
4240
+ attrs = pickAttrs(attrs, [
4241
+ 'fill',
4242
+ 'stroke'
4243
+ ]);
4244
+
4245
+ var dataStorePath = pathMap.getScaledPath('DATA_STORE', {
4246
+ xScaleFactor: 1,
4247
+ yScaleFactor: 1,
4248
+ containerWidth: element.width,
4249
+ containerHeight: element.height,
4250
+ position: {
4251
+ mx: 0,
4252
+ my: 0.133
4253
+ }
4254
+ });
4255
+
4256
+ return drawPath(parentGfx, dataStorePath, {
4257
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4258
+ fillOpacity: DEFAULT_OPACITY,
4259
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4260
+ strokeWidth: 2
4261
+ });
4262
+ },
4263
+ 'bpmn:EndEvent': function(parentGfx, element, attrs = {}) {
4264
+ var { renderIcon = true } = attrs;
4265
+
4266
+ attrs = pickAttrs(attrs, [
4267
+ 'fill',
4268
+ 'stroke'
4269
+ ]);
4270
+
4271
+ var event = renderEvent(parentGfx, element, {
4272
+ ...attrs,
4273
+ strokeWidth: 4
4274
+ });
4275
+
4276
+ if (renderIcon) {
4277
+ renderEventIcon(element, parentGfx, attrs);
4278
+ }
4279
+
4280
+ return event;
4281
+ },
4282
+ 'bpmn:EventBasedGateway': function(parentGfx, element, attrs = {}) {
4283
+ attrs = pickAttrs(attrs, [
4284
+ 'fill',
4285
+ 'stroke'
4286
+ ]);
4287
+
4288
+ var semantic = getBusinessObject(element);
4289
+
4290
+ var diamond = renderGateway(parentGfx, element, attrs);
4291
+
4292
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.20, {
4293
+ fill: getFillColor(element, 'none', attrs.fill),
4294
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4295
+ strokeWidth: 1
4296
+ });
4297
+
4298
+ var type = semantic.get('eventGatewayType'),
4299
+ instantiate = !!semantic.get('instantiate');
4300
+
4301
+ function drawEvent() {
4302
+
4303
+ var pathData = pathMap.getScaledPath('GATEWAY_EVENT_BASED', {
4304
+ xScaleFactor: 0.18,
4305
+ yScaleFactor: 0.18,
4306
+ containerWidth: element.width,
4307
+ containerHeight: element.height,
4308
+ position: {
4309
+ mx: 0.36,
4310
+ my: 0.44
4311
+ }
4312
+ });
4313
+
4314
+ drawPath(parentGfx, pathData, {
4315
+ fill: 'none',
4316
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4317
+ strokeWidth: 2
4318
+ });
4319
+ }
4320
+
4321
+ if (type === 'Parallel') {
4322
+ var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4323
+ xScaleFactor: 0.4,
4324
+ yScaleFactor: 0.4,
4325
+ containerWidth: element.width,
4326
+ containerHeight: element.height,
4327
+ position: {
4328
+ mx: 0.474,
4329
+ my: 0.296
4330
+ }
4331
+ });
4332
+
4333
+ drawPath(parentGfx, pathData, {
4334
+ fill: 'none',
4335
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4336
+ strokeWidth: 1
4337
+ });
4338
+ } else if (type === 'Exclusive') {
4339
+ if (!instantiate) {
4340
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.26, {
4341
+ fill: 'none',
4342
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4343
+ strokeWidth: 1
4344
+ });
4345
+ }
4346
+
4347
+ drawEvent();
4348
+ }
4349
+
4350
+
4351
+ return diamond;
4352
+ },
4353
+ 'bpmn:ExclusiveGateway': function(parentGfx, element, attrs = {}) {
4354
+ attrs = pickAttrs(attrs, [
4355
+ 'fill',
4356
+ 'stroke'
4357
+ ]);
4358
+
4359
+ var gateway = renderGateway(parentGfx, element, attrs);
4360
+
4361
+ var pathData = pathMap.getScaledPath('GATEWAY_EXCLUSIVE', {
4362
+ xScaleFactor: 0.4,
4363
+ yScaleFactor: 0.4,
4364
+ containerWidth: element.width,
4365
+ containerHeight: element.height,
4366
+ position: {
4367
+ mx: 0.32,
4368
+ my: 0.3
4369
+ }
4370
+ });
4371
+
4372
+ var di = getDi(element);
4373
+
4374
+ if (di.get('isMarkerVisible')) {
4375
+ drawPath(parentGfx, pathData, {
4376
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4377
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4378
+ strokeWidth: 1
4379
+ });
4380
+ }
4381
+
4382
+ return gateway;
4383
+ },
4384
+ 'bpmn:Gateway': function(parentGfx, element, attrs = {}) {
4385
+ attrs = pickAttrs(attrs, [
4386
+ 'fill',
4387
+ 'stroke'
4388
+ ]);
4389
+
4390
+ return renderGateway(parentGfx, element, attrs);
4391
+ },
4392
+ 'bpmn:Group': function(parentGfx, element, attrs = {}) {
4393
+ attrs = pickAttrs(attrs, [
4394
+ 'fill',
4395
+ 'stroke',
4396
+ 'width',
4397
+ 'height'
4398
+ ]);
4399
+
4400
+ return drawRect(parentGfx, element.width, element.height, TASK_BORDER_RADIUS, {
4401
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4402
+ strokeWidth: 1.5,
4403
+ strokeDasharray: '10, 6, 0, 6',
4404
+ fill: 'none',
4405
+ pointerEvents: 'none',
4406
+ width: getWidth(element, attrs),
4407
+ height: getHeight(element, attrs)
4408
+ });
4409
+ },
4410
+ 'bpmn:InclusiveGateway': function(parentGfx, element, attrs = {}) {
4411
+ attrs = pickAttrs(attrs, [
4412
+ 'fill',
4413
+ 'stroke'
4414
+ ]);
4415
+
4416
+ var gateway = renderGateway(parentGfx, element, attrs);
4417
+
4418
+ drawCircle(parentGfx, element.width, element.height, element.height * 0.24, {
4419
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4420
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4421
+ strokeWidth: 2.5
4422
+ });
4423
+
4424
+ return gateway;
4425
+ },
4426
+ 'bpmn:IntermediateEvent': function(parentGfx, element, attrs = {}) {
4427
+ var { renderIcon = true } = attrs;
4428
+
4429
+ attrs = pickAttrs(attrs, [
4430
+ 'fill',
4431
+ 'stroke'
4432
+ ]);
4433
+
4434
+ var outer = renderEvent(parentGfx, element, {
4435
+ ...attrs,
4436
+ strokeWidth: 1.5
4437
+ });
4438
+
4439
+ drawCircle(parentGfx, element.width, element.height, INNER_OUTER_DIST, {
4440
+ fill: 'none',
4441
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4442
+ strokeWidth: 1.5
4443
+ });
4444
+
4445
+ if (renderIcon) {
4446
+ renderEventIcon(element, parentGfx, attrs);
4447
+ }
4448
+
4449
+ return outer;
4450
+ },
4451
+ 'bpmn:IntermediateCatchEvent': as('bpmn:IntermediateEvent'),
4452
+ 'bpmn:IntermediateThrowEvent': as('bpmn:IntermediateEvent'),
4453
+ 'bpmn:Lane': function(parentGfx, element, attrs = {}) {
4454
+ attrs = pickAttrs(attrs, [
4455
+ 'fill',
4456
+ 'stroke',
4457
+ 'width',
4458
+ 'height'
4459
+ ]);
4460
+
4461
+ return renderLane(parentGfx, element, {
4462
+ ...attrs,
4463
+ fillOpacity: LOW_OPACITY
4464
+ });
4465
+ },
4466
+ 'bpmn:ManualTask': function(parentGfx, element, attrs = {}) {
4467
+ attrs = pickAttrs(attrs, [
4468
+ 'fill',
4469
+ 'stroke'
4470
+ ]);
4471
+
4472
+ var task = renderTask(parentGfx, element, attrs);
4473
+
4474
+ var pathData = pathMap.getScaledPath('TASK_TYPE_MANUAL', {
4475
+ abspos: {
4476
+ x: 17,
4477
+ y: 15
4478
+ }
4479
+ });
4480
+
4481
+ drawPath(parentGfx, pathData, {
4482
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4483
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4484
+ strokeWidth: 0.5
4485
+ });
4486
+
4487
+ return task;
4488
+ },
4489
+ 'bpmn:MessageFlow': function(parentGfx, element, attrs = {}) {
4490
+ attrs = pickAttrs(attrs, [
4491
+ 'fill',
4492
+ 'stroke'
4493
+ ]);
4494
+
4495
+ var semantic = getBusinessObject(element),
4496
+ di = getDi(element);
4497
+
4498
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
4499
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4500
+
4501
+ var path = drawConnectionSegments(parentGfx, element.waypoints, {
4502
+ markerEnd: marker(parentGfx, 'messageflow-end', fill, stroke),
4503
+ markerStart: marker(parentGfx, 'messageflow-start', fill, stroke),
4504
+ stroke,
4505
+ strokeDasharray: '10, 11',
4506
+ strokeWidth: 1.5
4507
+ });
4508
+
4509
+ if (semantic.get('messageRef')) {
4510
+ var midPoint = path.getPointAtLength(path.getTotalLength() / 2);
4511
+
4512
+ var markerPathData = pathMap.getScaledPath('MESSAGE_FLOW_MARKER', {
4513
+ abspos: {
4514
+ x: midPoint.x,
4515
+ y: midPoint.y
4516
+ }
4517
+ });
4518
+
4519
+ var messageAttrs = {
4520
+ strokeWidth: 1
4521
+ };
4522
+
4523
+ if (di.get('messageVisibleKind') === 'initiating') {
4524
+ messageAttrs.fill = fill;
4525
+ messageAttrs.stroke = stroke;
4526
+ } else {
4527
+ messageAttrs.fill = stroke;
4528
+ messageAttrs.stroke = fill;
4529
+ }
4530
+
4531
+ var message = drawPath(parentGfx, markerPathData, messageAttrs);
4532
+
4533
+ var messageRef = semantic.get('messageRef'),
4534
+ name = messageRef.get('name');
4535
+
4536
+ var label = renderLabel(parentGfx, name, {
4537
+ align: 'center-top',
4538
+ fitBox: true,
4539
+ style: {
4540
+ fill: stroke
4541
+ }
4542
+ });
4543
+
4544
+ var messageBounds = message.getBBox(),
4545
+ labelBounds = label.getBBox();
4546
+
4547
+ var translateX = midPoint.x - labelBounds.width / 2,
4548
+ translateY = midPoint.y + messageBounds.height / 2 + ELEMENT_LABEL_DISTANCE;
4549
+
4550
+ transform(label, translateX, translateY, 0);
4551
+ }
4552
+
4553
+ return path;
4554
+ },
4555
+ 'bpmn:ParallelGateway': function(parentGfx, element, attrs = {}) {
4556
+ attrs = pickAttrs(attrs, [
4557
+ 'fill',
4558
+ 'stroke'
4559
+ ]);
4560
+
4561
+ var diamond = renderGateway(parentGfx, element, attrs);
4562
+
4563
+ var pathData = pathMap.getScaledPath('GATEWAY_PARALLEL', {
4564
+ xScaleFactor: 0.6,
4565
+ yScaleFactor: 0.6,
4566
+ containerWidth: element.width,
4567
+ containerHeight: element.height,
4568
+ position: {
4569
+ mx: 0.46,
4570
+ my: 0.2
4571
+ }
4572
+ });
4573
+
4574
+ drawPath(parentGfx, pathData, {
4575
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4576
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4577
+ strokeWidth: 1
4578
+ });
4579
+
4580
+ return diamond;
4581
+ },
4582
+ 'bpmn:Participant': function(parentGfx, element, attrs = {}) {
4583
+ attrs = pickAttrs(attrs, [
4584
+ 'fill',
4585
+ 'stroke',
4586
+ 'width',
4587
+ 'height'
4588
+ ]);
4589
+
4590
+ var participant = renderLane(parentGfx, element, attrs);
4591
+
4592
+ var expandedParticipant = isExpanded(element);
4593
+ var horizontalParticipant = isHorizontal(element);
4594
+
4595
+ var semantic = getBusinessObject(element),
4596
+ name = semantic.get('name');
4597
+
4598
+ if (expandedParticipant) {
4599
+ var waypoints = horizontalParticipant ? [
4600
+ {
4601
+ x: 30,
4602
+ y: 0
4603
+ },
4604
+ {
4605
+ x: 30,
4606
+ y: getHeight(element, attrs)
4607
+ }
4608
+ ] : [
4609
+ {
4610
+ x: 0,
4611
+ y: 30
4612
+ },
4613
+ {
4614
+ x: getWidth(element, attrs),
4615
+ y: 30
4616
+ }
4617
+ ];
4618
+
4619
+ drawLine(parentGfx, waypoints, {
4620
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4621
+ strokeWidth: PARTICIPANT_STROKE_WIDTH
4622
+ });
4623
+
4624
+ renderLaneLabel(parentGfx, name, element, attrs);
4625
+ } else {
4626
+ var bounds = getBounds(element, attrs);
4627
+
4628
+ if (!horizontalParticipant) {
4629
+ bounds.height = getWidth(element, attrs);
4630
+ bounds.width = getHeight(element, attrs);
4631
+ }
4632
+
4633
+ var textBox = renderLabel(parentGfx, name, {
4634
+ box: bounds,
4635
+ align: 'center-middle',
4636
+ style: {
4637
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4638
+ }
4639
+ });
4640
+
4641
+ if (!horizontalParticipant) {
4642
+ var top = -1 * getHeight(element, attrs);
4643
+ transform(textBox, 0, -top, 270);
4644
+ }
4645
+ }
4646
+
4647
+ if (semantic.get('participantMultiplicity')) {
4648
+ renderTaskMarker('ParticipantMultiplicityMarker', parentGfx, element, attrs);
4649
+ }
4650
+
4651
+ return participant;
4652
+ },
4653
+ 'bpmn:ReceiveTask' : function(parentGfx, element, attrs = {}) {
4654
+ attrs = pickAttrs(attrs, [
4655
+ 'fill',
4656
+ 'stroke'
4657
+ ]);
4658
+
4659
+ var semantic = getBusinessObject(element);
4660
+
4661
+ var task = renderTask(parentGfx, element, attrs);
4662
+
4663
+ var pathData;
4664
+
4665
+ if (semantic.get('instantiate')) {
4666
+ drawCircle(parentGfx, 28, 28, 20 * 0.22, {
4667
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4668
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4669
+ strokeWidth: 1
4670
+ });
4671
+
4672
+ pathData = pathMap.getScaledPath('TASK_TYPE_INSTANTIATING_SEND', {
4673
+ abspos: {
4674
+ x: 7.77,
4675
+ y: 9.52
4676
+ }
4677
+ });
4678
+ } else {
4679
+ pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4680
+ xScaleFactor: 0.9,
4681
+ yScaleFactor: 0.9,
4682
+ containerWidth: 21,
4683
+ containerHeight: 14,
4684
+ position: {
4685
+ mx: 0.3,
4686
+ my: 0.4
4687
+ }
4688
+ });
4689
+ }
4690
+
4691
+ drawPath(parentGfx, pathData, {
4692
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4693
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4694
+ strokeWidth: 1
4695
+ });
4696
+
4697
+ return task;
4698
+ },
4699
+ 'bpmn:ScriptTask': function(parentGfx, element, attrs = {}) {
4700
+ attrs = pickAttrs(attrs, [
4701
+ 'fill',
4702
+ 'stroke'
4703
+ ]);
4704
+
4705
+ var task = renderTask(parentGfx, element, attrs);
4706
+
4707
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SCRIPT', {
4708
+ abspos: {
4709
+ x: 15,
4710
+ y: 20
4711
+ }
4712
+ });
4713
+
4714
+ drawPath(parentGfx, pathData, {
4715
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4716
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4717
+ strokeWidth: 1
4718
+ });
4719
+
4720
+ return task;
4721
+ },
4722
+ 'bpmn:SendTask': function(parentGfx, element, attrs = {}) {
4723
+ attrs = pickAttrs(attrs, [
4724
+ 'fill',
4725
+ 'stroke'
4726
+ ]);
4727
+
4728
+ var task = renderTask(parentGfx, element, attrs);
4729
+
4730
+ var pathData = pathMap.getScaledPath('TASK_TYPE_SEND', {
4731
+ xScaleFactor: 1,
4732
+ yScaleFactor: 1,
4733
+ containerWidth: 21,
4734
+ containerHeight: 14,
4735
+ position: {
4736
+ mx: 0.285,
4737
+ my: 0.357
4738
+ }
4739
+ });
4740
+
4741
+ drawPath(parentGfx, pathData, {
4742
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4743
+ stroke: getFillColor(element, defaultFillColor, attrs.fill),
4744
+ strokeWidth: 1
4745
+ });
4746
+
4747
+ return task;
4748
+ },
4749
+ 'bpmn:SequenceFlow': function(parentGfx, element, attrs = {}) {
4750
+ attrs = pickAttrs(attrs, [
4751
+ 'fill',
4752
+ 'stroke'
4753
+ ]);
4754
+
4755
+ var fill = getFillColor(element, defaultFillColor, attrs.fill),
4756
+ stroke = getStrokeColor(element, defaultStrokeColor, attrs.stroke);
4757
+
4758
+ var connection = drawConnectionSegments(parentGfx, element.waypoints, {
4759
+ markerEnd: marker(parentGfx, 'sequenceflow-end', fill, stroke),
4760
+ stroke
4761
+ });
4762
+
4763
+ var semantic = getBusinessObject(element);
4764
+
4765
+ var { source } = element;
4766
+
4767
+ if (source) {
4768
+ var sourceSemantic = getBusinessObject(source);
4769
+
4770
+ // conditional flow marker
4771
+ if (semantic.get('conditionExpression') && is$1(sourceSemantic, 'bpmn:Activity')) {
4772
+ attr$1(connection, {
4773
+ markerStart: marker(parentGfx, 'conditional-flow-marker', fill, stroke)
4774
+ });
4775
+ }
4776
+
4777
+ // default marker
4778
+ if (sourceSemantic.get('default') && (is$1(sourceSemantic, 'bpmn:Gateway') || is$1(sourceSemantic, 'bpmn:Activity')) &&
4779
+ sourceSemantic.get('default') === semantic) {
4780
+ attr$1(connection, {
4781
+ markerStart: marker(parentGfx, 'conditional-default-flow-marker', fill, stroke)
4782
+ });
4783
+ }
4784
+ }
4785
+
4786
+ return connection;
4787
+ },
4788
+ 'bpmn:ServiceTask': function(parentGfx, element, attrs = {}) {
4789
+ attrs = pickAttrs(attrs, [
4790
+ 'fill',
4791
+ 'stroke'
4792
+ ]);
4793
+
4794
+ var task = renderTask(parentGfx, element, attrs);
4795
+
4796
+ drawCircle(parentGfx, 10, 10, {
4797
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4798
+ stroke: 'none',
4799
+ transform: 'translate(6, 6)'
4800
+ });
4801
+
4802
+ var pathDataService1 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4803
+ abspos: {
4804
+ x: 12,
4805
+ y: 18
4806
+ }
4807
+ });
4808
+
4809
+ drawPath(parentGfx, pathDataService1, {
4810
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4811
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4812
+ strokeWidth: 1
4813
+ });
4814
+
4815
+ drawCircle(parentGfx, 10, 10, {
4816
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4817
+ stroke: 'none',
4818
+ transform: 'translate(11, 10)'
4819
+ });
4820
+
4821
+ var pathDataService2 = pathMap.getScaledPath('TASK_TYPE_SERVICE', {
4822
+ abspos: {
4823
+ x: 17,
4824
+ y: 22
4825
+ }
4826
+ });
4827
+
4828
+ drawPath(parentGfx, pathDataService2, {
4829
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4830
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4831
+ strokeWidth: 1
4832
+ });
4833
+
4834
+ return task;
4835
+ },
4836
+ 'bpmn:StartEvent': function(parentGfx, element, attrs = {}) {
4837
+ var { renderIcon = true } = attrs;
4838
+
4839
+ attrs = pickAttrs(attrs, [
4840
+ 'fill',
4841
+ 'stroke'
4842
+ ]);
4843
+
4844
+ var semantic = getBusinessObject(element);
4845
+
4846
+ if (!semantic.get('isInterrupting')) {
4847
+ attrs = {
4848
+ ...attrs,
4849
+ strokeDasharray: '6'
4850
+ };
4851
+ }
4852
+
4853
+ var event = renderEvent(parentGfx, element, attrs);
4854
+
4855
+ if (renderIcon) {
4856
+ renderEventIcon(element, parentGfx, attrs);
4857
+ }
4858
+
4859
+ return event;
4860
+ },
4861
+ 'bpmn:SubProcess': function(parentGfx, element, attrs = {}) {
4862
+ if (isExpanded(element)) {
4863
+ attrs = pickAttrs(attrs, [
4864
+ 'fill',
4865
+ 'stroke',
4866
+ 'width',
4867
+ 'height'
4868
+ ]);
4869
+ } else {
4870
+ attrs = pickAttrs(attrs, [
4871
+ 'fill',
4872
+ 'stroke'
4873
+ ]);
4874
+ }
4875
+
4876
+ return renderSubProcess(parentGfx, element, attrs);
4877
+ },
4878
+ 'bpmn:Task': function(parentGfx, element, attrs = {}) {
4879
+ attrs = pickAttrs(attrs, [
4880
+ 'fill',
4881
+ 'stroke'
4882
+ ]);
4883
+
4884
+ return renderTask(parentGfx, element, attrs);
4885
+ },
4886
+ 'bpmn:TextAnnotation': function(parentGfx, element, attrs = {}) {
4887
+ attrs = pickAttrs(attrs, [
4888
+ 'fill',
4889
+ 'stroke',
4890
+ 'width',
4891
+ 'height'
4892
+ ]);
4893
+
4894
+ var {
4895
+ width,
4896
+ height
4897
+ } = getBounds(element, attrs);
4898
+
4899
+ var textElement = drawRect(parentGfx, width, height, 0, 0, {
4900
+ fill: 'none',
4901
+ stroke: 'none'
4902
+ });
4903
+
4904
+ var textPathData = pathMap.getScaledPath('TEXT_ANNOTATION', {
4905
+ xScaleFactor: 1,
4906
+ yScaleFactor: 1,
4907
+ containerWidth: width,
4908
+ containerHeight: height,
4909
+ position: {
4910
+ mx: 0.0,
4911
+ my: 0.0
4912
+ }
4913
+ });
4914
+
4915
+ drawPath(parentGfx, textPathData, {
4916
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke)
4917
+ });
4918
+
4919
+ var semantic = getBusinessObject(element),
4920
+ text = semantic.get('text') || '';
4921
+
4922
+ renderLabel(parentGfx, text, {
4923
+ align: 'left-top',
4924
+ box: getBounds(element, attrs),
4925
+ padding: 7,
4926
+ style: {
4927
+ fill: getLabelColor(element, defaultLabelColor, defaultStrokeColor, attrs.stroke)
4928
+ }
4929
+ });
4930
+
4931
+ return textElement;
4932
+ },
4933
+ 'bpmn:Transaction': function(parentGfx, element, attrs = {}) {
4934
+ if (isExpanded(element)) {
4935
+ attrs = pickAttrs(attrs, [
4936
+ 'fill',
4937
+ 'stroke',
4938
+ 'width',
4939
+ 'height'
4940
+ ]);
4941
+ } else {
4942
+ attrs = pickAttrs(attrs, [
4943
+ 'fill',
4944
+ 'stroke'
4945
+ ]);
4946
+ }
4947
+
4948
+ var outer = renderSubProcess(parentGfx, element, {
4949
+ strokeWidth: 1.5,
4950
+ ...attrs
4951
+ });
4952
+
4953
+ var innerAttrs = styles.style([ 'no-fill', 'no-events' ], {
4954
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4955
+ strokeWidth: 1.5
4956
+ });
4957
+
4958
+ var expanded = isExpanded(element);
4959
+
4960
+ if (!expanded) {
4961
+ attrs = {};
4962
+ }
4963
+
4964
+ drawRect(
4965
+ parentGfx,
4966
+ getWidth(element, attrs),
4967
+ getHeight(element, attrs),
4968
+ TASK_BORDER_RADIUS - INNER_OUTER_DIST,
4969
+ INNER_OUTER_DIST,
4970
+ innerAttrs
4971
+ );
4972
+
4973
+ return outer;
4974
+ },
4975
+ 'bpmn:UserTask': function(parentGfx, element, attrs = {}) {
4976
+ attrs = pickAttrs(attrs, [
4977
+ 'fill',
4978
+ 'stroke'
4979
+ ]);
4980
+
4981
+ var task = renderTask(parentGfx, element, attrs);
4982
+
4983
+ var x = 15;
4984
+ var y = 12;
4985
+
4986
+ var pathDataUser1 = pathMap.getScaledPath('TASK_TYPE_USER_1', {
4987
+ abspos: {
4988
+ x: x,
4989
+ y: y
4990
+ }
4991
+ });
4992
+
4993
+ drawPath(parentGfx, pathDataUser1, {
4994
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
4995
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
4996
+ strokeWidth: 0.5
4997
+ });
4998
+
4999
+ var pathDataUser2 = pathMap.getScaledPath('TASK_TYPE_USER_2', {
5000
+ abspos: {
5001
+ x: x,
5002
+ y: y
5003
+ }
5004
+ });
5005
+
5006
+ drawPath(parentGfx, pathDataUser2, {
5007
+ fill: getFillColor(element, defaultFillColor, attrs.fill),
5008
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5009
+ strokeWidth: 0.5
5010
+ });
5011
+
5012
+ var pathDataUser3 = pathMap.getScaledPath('TASK_TYPE_USER_3', {
5013
+ abspos: {
5014
+ x: x,
5015
+ y: y
5016
+ }
5017
+ });
5018
+
5019
+ drawPath(parentGfx, pathDataUser3, {
5020
+ fill: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5021
+ stroke: getStrokeColor(element, defaultStrokeColor, attrs.stroke),
5022
+ strokeWidth: 0.5
5023
+ });
5024
+
5025
+ return task;
5026
+ },
5027
+ 'label': function(parentGfx, element, attrs = {}) {
5028
+ return renderExternalLabel(parentGfx, element, attrs);
5029
+ }
5030
+ };
5031
+
5032
+ // extension API, use at your own risk
5033
+ this._drawPath = drawPath;
5034
+
5035
+ this._renderer = renderer;
5036
+ }
5037
+
5038
+
5039
+ e(BpmnRenderer, BaseRenderer);
5040
+
5041
+ BpmnRenderer.$inject = [
5042
+ 'config.bpmnRenderer',
5043
+ 'eventBus',
5044
+ 'styles',
5045
+ 'pathMap',
5046
+ 'canvas',
5047
+ 'textRenderer'
5048
+ ];
5049
+
5050
+
5051
+ /**
5052
+ * @param {Element} element
5053
+ *
5054
+ * @return {boolean}
5055
+ */
5056
+ BpmnRenderer.prototype.canRender = function(element) {
5057
+ return is$1(element, 'bpmn:BaseElement');
5058
+ };
5059
+
5060
+ /**
5061
+ * Draw shape into parentGfx.
5062
+ *
5063
+ * @param {SVGElement} parentGfx
5064
+ * @param {Shape} shape
5065
+ * @param {Attrs} [attrs]
5066
+ *
5067
+ * @return {SVGElement} mainGfx
5068
+ */
5069
+ BpmnRenderer.prototype.drawShape = function(parentGfx, shape, attrs = {}) {
5070
+ var { type } = shape;
5071
+
5072
+ var handler = this._renderer(type);
5073
+
5074
+ return handler(parentGfx, shape, attrs);
5075
+ };
5076
+
5077
+ /**
5078
+ * Draw connection into parentGfx.
5079
+ *
5080
+ * @param {SVGElement} parentGfx
5081
+ * @param {Connection} connection
5082
+ * @param {Attrs} [attrs]
5083
+ *
5084
+ * @return {SVGElement} mainGfx
5085
+ */
5086
+ BpmnRenderer.prototype.drawConnection = function(parentGfx, connection, attrs = {}) {
5087
+ var { type } = connection;
5088
+
5089
+ var handler = this._renderer(type);
5090
+
5091
+ return handler(parentGfx, connection, attrs);
5092
+ };
5093
+
5094
+ /**
5095
+ * Get shape path.
5096
+ *
5097
+ * @param {Shape} shape
5098
+ *
5099
+ * @return {string} path
5100
+ */
5101
+ BpmnRenderer.prototype.getShapePath = function(shape) {
5102
+ if (is$1(shape, 'bpmn:Event')) {
5103
+ return getCirclePath(shape);
5104
+ }
5105
+
5106
+ if (is$1(shape, 'bpmn:Activity')) {
5107
+ return getRoundRectPath(shape, TASK_BORDER_RADIUS);
5108
+ }
5109
+
5110
+ if (is$1(shape, 'bpmn:Gateway')) {
5111
+ return getDiamondPath(shape);
5112
+ }
5113
+
5114
+ return getRectPath(shape);
5115
+ };
5116
+
5117
+ /**
5118
+ * Pick attributes if they exist.
5119
+ *
5120
+ * @param {Object} attrs
5121
+ * @param {string[]} keys
5122
+ *
5123
+ * @returns {Object}
5124
+ */
5125
+ function pickAttrs(attrs, keys = []) {
5126
+ return keys.reduce((pickedAttrs, key) => {
5127
+ if (attrs[ key ]) {
5128
+ pickedAttrs[ key ] = attrs[ key ];
5129
+ }
5130
+
5131
+ return pickedAttrs;
5132
+ }, {});
5111
5133
  }
5112
5134
 
5113
5135
  /**
@@ -17939,94 +17961,94 @@
17939
17961
  return prefixMap;
17940
17962
  }
17941
17963
 
17942
- /**
17943
- * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
17944
- *
17945
- * @class BpmnModdle
17946
- * @extends Moddle
17947
- *
17948
- * @param {Object|Array} packages to use for instantiating the model
17949
- * @param {Object} [options] additional options to pass over
17950
- */
17951
- function BpmnModdle(packages, options) {
17952
- Moddle.call(this, packages, options);
17953
- }
17954
-
17955
- BpmnModdle.prototype = Object.create(Moddle.prototype);
17956
-
17957
- /**
17958
- * The fromXML result.
17959
- *
17960
- * @typedef {Object} ParseResult
17961
- *
17962
- * @property {ModdleElement} rootElement
17963
- * @property {Array<Object>} references
17964
- * @property {Array<Error>} warnings
17965
- * @property {Object} elementsById - a mapping containing each ID -> ModdleElement
17966
- */
17967
-
17968
- /**
17969
- * The fromXML error.
17970
- *
17971
- * @typedef {Error} ParseError
17972
- *
17973
- * @property {Array<Error>} warnings
17974
- */
17975
-
17976
- /**
17977
- * Instantiates a BPMN model tree from a given xml string.
17978
- *
17979
- * @param {String} xmlStr
17980
- * @param {String} [typeName='bpmn:Definitions'] name of the root element
17981
- * @param {Object} [options] options to pass to the underlying reader
17982
- *
17983
- * @returns {Promise<ParseResult, ParseError>}
17984
- */
17985
- BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
17986
-
17987
- if (!isString(typeName)) {
17988
- options = typeName;
17989
- typeName = 'bpmn:Definitions';
17990
- }
17991
-
17992
- var reader = new Reader(assign$1({ model: this, lax: true }, options));
17993
- var rootHandler = reader.handler(typeName);
17994
-
17995
- return reader.fromXML(xmlStr, rootHandler);
17996
- };
17997
-
17998
-
17999
- /**
18000
- * The toXML result.
18001
- *
18002
- * @typedef {Object} SerializationResult
18003
- *
18004
- * @property {String} xml
18005
- */
18006
-
18007
- /**
18008
- * Serializes a BPMN 2.0 object tree to XML.
18009
- *
18010
- * @param {String} element the root element, typically an instance of `bpmn:Definitions`
18011
- * @param {Object} [options] to pass to the underlying writer
18012
- *
18013
- * @returns {Promise<SerializationResult, Error>}
18014
- */
18015
- BpmnModdle.prototype.toXML = function(element, options) {
18016
-
18017
- var writer = new Writer(options);
18018
-
18019
- return new Promise(function(resolve, reject) {
18020
- try {
18021
- var result = writer.toXML(element);
18022
-
18023
- return resolve({
18024
- xml: result
18025
- });
18026
- } catch (err) {
18027
- return reject(err);
18028
- }
18029
- });
17964
+ /**
17965
+ * A sub class of {@link Moddle} with support for import and export of BPMN 2.0 xml files.
17966
+ *
17967
+ * @class BpmnModdle
17968
+ * @extends Moddle
17969
+ *
17970
+ * @param {Object|Array} packages to use for instantiating the model
17971
+ * @param {Object} [options] additional options to pass over
17972
+ */
17973
+ function BpmnModdle(packages, options) {
17974
+ Moddle.call(this, packages, options);
17975
+ }
17976
+
17977
+ BpmnModdle.prototype = Object.create(Moddle.prototype);
17978
+
17979
+ /**
17980
+ * The fromXML result.
17981
+ *
17982
+ * @typedef {Object} ParseResult
17983
+ *
17984
+ * @property {ModdleElement} rootElement
17985
+ * @property {Array<Object>} references
17986
+ * @property {Array<Error>} warnings
17987
+ * @property {Object} elementsById - a mapping containing each ID -> ModdleElement
17988
+ */
17989
+
17990
+ /**
17991
+ * The fromXML error.
17992
+ *
17993
+ * @typedef {Error} ParseError
17994
+ *
17995
+ * @property {Array<Error>} warnings
17996
+ */
17997
+
17998
+ /**
17999
+ * Instantiates a BPMN model tree from a given xml string.
18000
+ *
18001
+ * @param {String} xmlStr
18002
+ * @param {String} [typeName='bpmn:Definitions'] name of the root element
18003
+ * @param {Object} [options] options to pass to the underlying reader
18004
+ *
18005
+ * @returns {Promise<ParseResult, ParseError>}
18006
+ */
18007
+ BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options) {
18008
+
18009
+ if (!isString(typeName)) {
18010
+ options = typeName;
18011
+ typeName = 'bpmn:Definitions';
18012
+ }
18013
+
18014
+ var reader = new Reader(assign$1({ model: this, lax: true }, options));
18015
+ var rootHandler = reader.handler(typeName);
18016
+
18017
+ return reader.fromXML(xmlStr, rootHandler);
18018
+ };
18019
+
18020
+
18021
+ /**
18022
+ * The toXML result.
18023
+ *
18024
+ * @typedef {Object} SerializationResult
18025
+ *
18026
+ * @property {String} xml
18027
+ */
18028
+
18029
+ /**
18030
+ * Serializes a BPMN 2.0 object tree to XML.
18031
+ *
18032
+ * @param {String} element the root element, typically an instance of `bpmn:Definitions`
18033
+ * @param {Object} [options] to pass to the underlying writer
18034
+ *
18035
+ * @returns {Promise<SerializationResult, Error>}
18036
+ */
18037
+ BpmnModdle.prototype.toXML = function(element, options) {
18038
+
18039
+ var writer = new Writer(options);
18040
+
18041
+ return new Promise(function(resolve, reject) {
18042
+ try {
18043
+ var result = writer.toXML(element);
18044
+
18045
+ return resolve({
18046
+ xml: result
18047
+ });
18048
+ } catch (err) {
18049
+ return reject(err);
18050
+ }
18051
+ });
18030
18052
  };
18031
18053
 
18032
18054
  var name$5 = "BPMN20";
@@ -18879,7 +18901,6 @@
18879
18901
  {
18880
18902
  name: "operationRef",
18881
18903
  type: "Operation",
18882
- isAttr: true,
18883
18904
  isReference: true
18884
18905
  }
18885
18906
  ]
@@ -20631,7 +20652,6 @@
20631
20652
  },
20632
20653
  {
20633
20654
  name: "cancelRemainingInstances",
20634
- "default": true,
20635
20655
  isAttr: true,
20636
20656
  type: "Boolean"
20637
20657
  }
@@ -21665,19 +21685,19 @@
21665
21685
  associations: associations
21666
21686
  };
21667
21687
 
21668
- const packages = {
21669
- bpmn: BpmnPackage,
21670
- bpmndi: BpmnDiPackage,
21671
- dc: DcPackage,
21672
- di: DiPackage,
21673
- bioc: BiocPackage,
21674
- color: BpmnInColorPackage
21675
- };
21676
-
21677
- function SimpleBpmnModdle(additionalPackages, options) {
21678
- const pks = assign$1({}, packages, additionalPackages);
21679
-
21680
- return new BpmnModdle(pks, options);
21688
+ const packages = {
21689
+ bpmn: BpmnPackage,
21690
+ bpmndi: BpmnDiPackage,
21691
+ dc: DcPackage,
21692
+ di: DiPackage,
21693
+ bioc: BiocPackage,
21694
+ color: BpmnInColorPackage
21695
+ };
21696
+
21697
+ function SimpleBpmnModdle(additionalPackages, options) {
21698
+ const pks = assign$1({}, packages, additionalPackages);
21699
+
21700
+ return new BpmnModdle(pks, options);
21681
21701
  }
21682
21702
 
21683
21703
  /**