bpmn-js 17.0.1 → 17.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bpmn-modeler.development.js +31 -20
- package/dist/bpmn-modeler.production.min.js +2 -2
- package/dist/bpmn-navigated-viewer.development.js +2 -2
- package/dist/bpmn-navigated-viewer.production.min.js +1 -1
- package/dist/bpmn-viewer.development.js +2 -2
- package/dist/bpmn-viewer.production.min.js +1 -1
- package/lib/features/context-pad/ContextPadProvider.js +3 -2
- package/lib/features/interaction-events/BpmnInteractionEvents.js +11 -3
- package/lib/features/modeling/cmd/SplitLaneHandler.js +24 -14
- package/package.json +1 -1
|
@@ -3,6 +3,10 @@ import {
|
|
|
3
3
|
LANE_INDENTATION
|
|
4
4
|
} from '../util/LaneUtil';
|
|
5
5
|
|
|
6
|
+
import {
|
|
7
|
+
isHorizontal
|
|
8
|
+
} from '../../../util/DiUtil';
|
|
9
|
+
|
|
6
10
|
/**
|
|
7
11
|
* @typedef {import('diagram-js/lib/command/CommandHandler').default} CommandHandler
|
|
8
12
|
*
|
|
@@ -45,36 +49,41 @@ SplitLaneHandler.prototype.preExecute = function(context) {
|
|
|
45
49
|
throw new Error(translate('more than {count} child lanes', { count: newLanesCount }));
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
var
|
|
52
|
+
var isHorizontalLane = isHorizontal(shape);
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
var laneBaseSize = isHorizontalLane ? shape.height : shape.width;
|
|
55
|
+
var newLanesSize = Math.round(laneBaseSize / newLanesCount);
|
|
56
|
+
|
|
57
|
+
// Iterate from first to last in child lane order,
|
|
51
58
|
// resizing existing lanes and creating new ones
|
|
52
59
|
// so that they split the parent proportionally.
|
|
53
60
|
//
|
|
54
|
-
// Due to rounding related errors, the
|
|
61
|
+
// Due to rounding related errors, the last lane
|
|
55
62
|
// needs to take up all the remaining space.
|
|
56
|
-
var
|
|
57
|
-
laneHeight,
|
|
63
|
+
var laneSize,
|
|
58
64
|
laneBounds,
|
|
59
65
|
newLaneAttrs,
|
|
60
66
|
idx;
|
|
61
67
|
|
|
62
68
|
for (idx = 0; idx < newLanesCount; idx++) {
|
|
63
69
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// if bottom lane
|
|
70
|
+
// if last lane
|
|
67
71
|
if (idx === newLanesCount - 1) {
|
|
68
|
-
|
|
72
|
+
laneSize = laneBaseSize - (newLanesSize * idx);
|
|
69
73
|
} else {
|
|
70
|
-
|
|
74
|
+
laneSize = newLanesSize;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
laneBounds = {
|
|
77
|
+
laneBounds = isHorizontalLane ? {
|
|
74
78
|
x: shape.x + LANE_INDENTATION,
|
|
75
|
-
y:
|
|
79
|
+
y: shape.y + idx * newLanesSize,
|
|
76
80
|
width: shape.width - LANE_INDENTATION,
|
|
77
|
-
height:
|
|
81
|
+
height: laneSize
|
|
82
|
+
} : {
|
|
83
|
+
x: shape.x + idx * newLanesSize,
|
|
84
|
+
y: shape.y + LANE_INDENTATION,
|
|
85
|
+
width: laneSize,
|
|
86
|
+
height: shape.height - LANE_INDENTATION
|
|
78
87
|
};
|
|
79
88
|
|
|
80
89
|
if (idx < existingLanesCount) {
|
|
@@ -85,7 +94,8 @@ SplitLaneHandler.prototype.preExecute = function(context) {
|
|
|
85
94
|
|
|
86
95
|
// create a new lane at position
|
|
87
96
|
newLaneAttrs = {
|
|
88
|
-
type: 'bpmn:Lane'
|
|
97
|
+
type: 'bpmn:Lane',
|
|
98
|
+
isHorizontal: isHorizontalLane
|
|
89
99
|
};
|
|
90
100
|
|
|
91
101
|
modeling.createShape(newLaneAttrs, laneBounds, shape);
|