@@ -4,9 +4,9 @@ import { ENVIModelerEdge, ENVIModelerNode } from '@idl/types/envi/modeler';
44import {
55 LAYOUT_BASE_X ,
66 LAYOUT_BASE_Y ,
7- LAYOUT_COMMENT_Y_OFFSET ,
87} from './create-envi-modeler-workflow.interface' ;
98import { InjectAggregatorNodes } from './helpers/add-aggregator-nodes' ;
9+ import { AddCommentNodes } from './helpers/add-comment-nodes' ;
1010import { BuildIdMap } from './helpers/build-id-map' ;
1111import { BuildNodeJSON } from './helpers/build-node-json' ;
1212import { ComputeLayout } from './helpers/compute-layout' ;
@@ -45,22 +45,8 @@ export function CreateENVIModelerWorkflow(
4545 return BuildNodeJSON ( node , modelName , location , registry ) ;
4646 } ) ;
4747
48- // Synthesize comment nodes from node.comment properties
49- let commentCounter = 0 ;
50- for ( const node of injected . nodes ) {
51- if ( node . comment ) {
52- const rawLocation = layout . get ( node . id ) ;
53- const parentX = rawLocation ? rawLocation [ 0 ] : LAYOUT_BASE_X ;
54- const parentY = rawLocation ? rawLocation [ 1 ] : LAYOUT_BASE_Y ;
55- commentCounter ++ ;
56- modelNodes . push ( {
57- display_name : node . comment ,
58- location : [ parentX , parentY + LAYOUT_COMMENT_Y_OFFSET ] ,
59- name : `comment_${ commentCounter } ` ,
60- type : 'comment' ,
61- } ) ;
62- }
63- }
48+ // automatically add in comment nodes
49+ AddCommentNodes ( injected . nodes , modelNodes , layout ) ;
6450
6551 // Build edges array
6652 const modelEdges = injected . edges . map ( ( edge ) => ( {
0 commit comments