File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -417,7 +417,7 @@ export declare class LGraph {
417417 /**
418418 * Positions every node in a more readable manner
419419 */
420- arrange ( margin ?: number ) : void ;
420+ arrange ( margin ?: number , layout ?: string ) : void ;
421421 /**
422422 * Returns the amount of time the graph has been running in milliseconds
423423 * @return number of milliseconds the graph has been running
Original file line number Diff line number Diff line change 8787 NO_TITLE : 1 ,
8888 TRANSPARENT_TITLE : 2 ,
8989 AUTOHIDE_TITLE : 3 ,
90+ VERTICAL_LAYOUT : "vertical" , // arrange nodes vertically
9091
9192 proxy : null , //used to redirect calls
9293 node_images_path : "" ,
12581259 * Positions every node in a more readable manner
12591260 * @method arrange
12601261 */
1261- LGraph . prototype . arrange = function ( margin ) {
1262+ LGraph . prototype . arrange = function ( margin , layout ) {
12621263 margin = margin || 100 ;
12631264
12641265 var nodes = this . computeExecutionOrder ( false , true ) ;
12831284 var y = margin + LiteGraph . NODE_TITLE_HEIGHT ;
12841285 for ( var j = 0 ; j < column . length ; ++ j ) {
12851286 var node = column [ j ] ;
1286- node . pos [ 0 ] = x ;
1287- node . pos [ 1 ] = y ;
1288- if ( node . size [ 0 ] > max_size ) {
1289- max_size = node . size [ 0 ] ;
1290- }
1291- y += node . size [ 1 ] + margin + LiteGraph . NODE_TITLE_HEIGHT ;
1287+ node . pos [ 0 ] = ( layout == LiteGraph . VERTICAL_LAYOUT ) ? y : x ;
1288+ node . pos [ 1 ] = ( layout == LiteGraph . VERTICAL_LAYOUT ) ? x : y ;
1289+ max_size_index = ( layout == LiteGraph . VERTICAL_LAYOUT ) ? 1 : 0 ;
1290+ if ( node . size [ max_size_index ] > max_size ) {
1291+ max_size = node . size [ max_size_index ] ;
1292+ }
1293+ node_size_index = ( layout == LiteGraph . VERTICAL_LAYOUT ) ? 0 : 1 ;
1294+ y += node . size [ node_size_index ] + margin + LiteGraph . NODE_TITLE_HEIGHT ;
12921295 }
12931296 x += max_size + margin ;
12941297 }
You can’t perform that action at this time.
0 commit comments