File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed
rust/cubesql/cubesql/egraph-debug-template/src Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -111,25 +111,31 @@ function layout(
111111 edges : elkEdges ,
112112 } ;
113113
114+ function elk2flow ( node , flattenChildren , withStyle ) {
115+ node . position = { x : node . x , y : node . y } ;
116+ if ( withStyle ) {
117+ node . style = {
118+ ...node . style ,
119+ width : node . width ,
120+ height : node . height ,
121+ } ;
122+ }
123+ flattenChildren . push ( node ) ;
124+ ( node . children ?? [ ] ) . forEach ( ( child ) => {
125+ // only depth 0 get styles
126+ elk2flow ( child , flattenChildren , false ) ;
127+ } ) ;
128+ delete node . children ;
129+ }
130+
114131 const elk = new ELK ( ) ;
115132 return elk . layout ( graph ) . then ( ( { children } ) => {
116133 // By mutating the children in-place we saves ourselves from creating a
117134 // needless copy of the nodes array.
118135 const flattenChildren = [ ] ;
119136
120137 children . forEach ( ( node ) => {
121- node . position = { x : node . x , y : node . y } ;
122- node . style = {
123- ...node . style ,
124- width : node . width ,
125- height : node . height ,
126- } ;
127- flattenChildren . push ( node ) ;
128- node . children . forEach ( ( child ) => {
129- child . position = { x : child . x , y : child . y } ;
130- flattenChildren . push ( child ) ;
131- } ) ;
132- delete node . children ;
138+ elk2flow ( node , flattenChildren , true ) ;
133139 } ) ;
134140
135141 setNodes ( flattenChildren ) ;
You can’t perform that action at this time.
0 commit comments