@@ -21,6 +21,7 @@ export function getScript(vscode: any, document: any, window: any) {
2121 let expandedErrors = new Set < number > ( ) ;
2222 let stateMachine : StateMachine | undefined ;
2323 let selectedTab : NavTab = 'verification' ;
24+ let diagramOrientation : "LR" | "TB" = "TB" ;
2425
2526 // initial state
2627 root . innerHTML = renderLoading ( ) ;
@@ -69,13 +70,21 @@ export function getScript(vscode: any, document: any, window: any) {
6970 }
7071
7172 // toggle show all diagnostics
72- if ( target . classList . contains ( 'show-all-button' ) ) {
73+ if ( target . id === 'show-all-button' ) {
7374 e . stopPropagation ( ) ;
7475 showAllDiagnostics = ! showAllDiagnostics ;
7576 updateView ( ) ;
7677 return ;
7778 }
7879
80+ // toggle diagram orientation
81+ if ( target . id === 'diagram-orientation-btn' ) {
82+ e . stopPropagation ( ) ;
83+ diagramOrientation = diagramOrientation === "TB" ? "LR" : "TB" ;
84+ updateView ( ) ;
85+ return ;
86+ }
87+
7988 // toggle show more/less for errors
8089 if ( target . classList . contains ( 'show-more-button' ) ) {
8190 e . stopPropagation ( ) ;
@@ -129,8 +138,8 @@ export function getScript(vscode: any, document: any, window: any) {
129138 if ( selectedTab === 'verification' ) {
130139 root . innerHTML = renderVerificationView ( diagnostics , showAllDiagnostics , currentFile , expandedErrors , selectedTab )
131140 } else {
132- const diagram = createMermaidDiagram ( stateMachine ) ;
133- root . innerHTML = renderStateMachineView ( stateMachine , diagram , selectedTab ) ;
141+ const diagram = createMermaidDiagram ( stateMachine , diagramOrientation ) ;
142+ root . innerHTML = renderStateMachineView ( stateMachine , diagram , selectedTab , diagramOrientation ) ;
134143 if ( stateMachine ) renderMermaidDiagram ( document , window ) ;
135144 }
136145 }
0 commit comments