@@ -40,6 +40,12 @@ export class SwitchStepComponentView implements ComponentView {
4040 totalX += containerWidths [ i ] ;
4141 }
4242
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+
4349 branchNames . forEach ( ( branchName , i ) => {
4450 const sequence = sequenceComponents [ i ] ;
4551 const offsetX = containerOffsets [ i ] ;
@@ -58,22 +64,22 @@ export class SwitchStepComponentView implements ComponentView {
5864 Dom . translate ( sequence . view . g , sequenceX , sequenceY ) ;
5965 } ) ;
6066
61- LabelView . create ( g , containerWidths [ 0 ] , PADDING_TOP , step . name ) ;
67+ LabelView . create ( g , joinX , PADDING_TOP , step . name ) ;
6268
63- JoinView . createStraightJoin ( g , new Vector ( containerWidths [ 0 ] , 0 ) , PADDING_TOP ) ;
69+ JoinView . createStraightJoin ( g , new Vector ( joinX , 0 ) , PADDING_TOP ) ;
6470
6571 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 ) ;
6773
6874 JoinView . createJoins (
6975 g ,
70- new Vector ( containerWidths [ 0 ] , PADDING_TOP + LABEL_HEIGHT ) ,
76+ new Vector ( joinX , PADDING_TOP + LABEL_HEIGHT ) ,
7177 containerOffsets . map ( ( o , i ) => new Vector ( o + joinXs [ i ] + PADDING_X , PADDING_TOP + LABEL_HEIGHT + CONNECTION_HEIGHT ) )
7278 ) ;
7379
7480 JoinView . createJoins (
7581 g ,
76- new Vector ( containerWidths [ 0 ] , containerHeight ) ,
82+ new Vector ( joinX , containerHeight ) ,
7783 containerOffsets . map (
7884 ( o , i ) => new Vector ( o + joinXs [ i ] + PADDING_X , PADDING_TOP + CONNECTION_HEIGHT + LABEL_HEIGHT * 2 + maxChildHeight )
7985 )
@@ -87,7 +93,7 @@ export class SwitchStepComponentView implements ComponentView {
8793 g ,
8894 containersWidth ,
8995 containerHeight ,
90- containerWidths [ 0 ] ,
96+ joinX ,
9197 sequenceComponents ,
9298 regionView ,
9399 inputView ,
0 commit comments