@@ -40,6 +40,12 @@ export class SwitchStepComponentView implements ComponentView {
40
40
totalX += containerWidths [ i ] ;
41
41
}
42
42
43
+ const centerBranchIndex = Math . floor ( branchNames . length / 2 ) ;
44
+ let joinX = containerOffsets [ centerBranchIndex ] ;
45
+ if ( branchNames . length % 2 !== 0 ) {
46
+ joinX += joinXs [ centerBranchIndex ] + PADDING_X ;
47
+ }
48
+
43
49
branchNames . forEach ( ( branchName , i ) => {
44
50
const sequence = sequenceComponents [ i ] ;
45
51
const offsetX = containerOffsets [ i ] ;
@@ -58,22 +64,22 @@ export class SwitchStepComponentView implements ComponentView {
58
64
Dom . translate ( sequence . view . g , sequenceX , sequenceY ) ;
59
65
} ) ;
60
66
61
- LabelView . create ( g , containerWidths [ 0 ] , PADDING_TOP , step . name ) ;
67
+ LabelView . create ( g , joinX , PADDING_TOP , step . name ) ;
62
68
63
- JoinView . createStraightJoin ( g , new Vector ( containerWidths [ 0 ] , 0 ) , PADDING_TOP ) ;
69
+ JoinView . createStraightJoin ( g , new Vector ( joinX , 0 ) , PADDING_TOP ) ;
64
70
65
71
const iconUrl = configuration . iconUrlProvider ? configuration . iconUrlProvider ( step . componentType , step . type ) : null ;
66
- const inputView = InputView . createRectInput ( g , containerWidths [ 0 ] , 0 , iconUrl ) ;
72
+ const inputView = InputView . createRectInput ( g , joinX , 0 , iconUrl ) ;
67
73
68
74
JoinView . createJoins (
69
75
g ,
70
- new Vector ( containerWidths [ 0 ] , PADDING_TOP + LABEL_HEIGHT ) ,
76
+ new Vector ( joinX , PADDING_TOP + LABEL_HEIGHT ) ,
71
77
containerOffsets . map ( ( o , i ) => new Vector ( o + joinXs [ i ] + PADDING_X , PADDING_TOP + LABEL_HEIGHT + CONNECTION_HEIGHT ) )
72
78
) ;
73
79
74
80
JoinView . createJoins (
75
81
g ,
76
- new Vector ( containerWidths [ 0 ] , containerHeight ) ,
82
+ new Vector ( joinX , containerHeight ) ,
77
83
containerOffsets . map (
78
84
( o , i ) => new Vector ( o + joinXs [ i ] + PADDING_X , PADDING_TOP + CONNECTION_HEIGHT + LABEL_HEIGHT * 2 + maxChildHeight )
79
85
)
@@ -87,7 +93,7 @@ export class SwitchStepComponentView implements ComponentView {
87
93
g ,
88
94
containersWidth ,
89
95
containerHeight ,
90
- containerWidths [ 0 ] ,
96
+ joinX ,
91
97
sequenceComponents ,
92
98
regionView ,
93
99
inputView ,
0 commit comments