@@ -74,7 +74,14 @@ export class OCWGExporter extends BaseExporter<OCWGFile, OCWGInfo> {
7474 return elements . has ( `${ id } ` ) ;
7575 }
7676
77- override mergeWithAdditionalIbfo (
77+ getNodeFromElements = (
78+ id : string ,
79+ elements : ElementNodeMap < BaseNodeInfo >
80+ ) => {
81+ return elements . get ( id ) ;
82+ } ;
83+
84+ override mergeWithAdditionalInfo (
7885 elements : ElementNodeMap < BaseNodeInfo >
7986 ) : void {
8087 const rootOCIF = getCurrentOCIF ( ) ;
@@ -97,13 +104,27 @@ export class OCWGExporter extends BaseExporter<OCWGFile, OCWGInfo> {
97104 console . log ( 'export ocif node' , codeFlowCanvasNode ) ;
98105 node . data ?. forEach ( ( d : any ) => {
99106 if ( ! codeFlowCanvasNode . data ) {
107+ // purely for typescript
100108 return ;
101109 }
102110 if (
103111 d . type !== nodeInfoPropertyName &&
104112 d . type !== connectionNodeInfoPropertyName &&
105113 d . type !== '@ocwg/node/ports'
106114 ) {
115+ if ( d . type === 'rect-node' ) {
116+ const canvasNode = this . getNodeFromElements (
117+ node . id ,
118+ elements
119+ ) ;
120+ if ( canvasNode ) {
121+ const nodeInfo = canvasNode . nodeInfo as any ;
122+
123+ d . fillColor = nodeInfo ?. fillColor ?? d . fillColor ;
124+ d . strokeColor = nodeInfo ?. strokeColor ?? d . strokeColor ;
125+ d . strokeWidth = nodeInfo ?. strokeWidth ?? d . strokeWidth ;
126+ }
127+ }
107128 codeFlowCanvasNode . data . push ( d ) ;
108129 }
109130 } ) ;
@@ -181,13 +202,17 @@ export class OCWGExporter extends BaseExporter<OCWGFile, OCWGInfo> {
181202 ports : ports ,
182203 } ) ;
183204 }
205+ const clonedNodeInfo = structuredClone ( nodeInfo ) as any ;
206+ delete clonedNodeInfo . fillColor ;
207+ delete clonedNodeInfo . strokeColor ;
208+ delete clonedNodeInfo . strokeWidth ;
184209 const ocwgNode : OCWGNode = {
185210 id : `${ node . id } ` ,
186211 position : [ node . x , node . y ] ,
187212 size : [ node . width ?? 0 , node . height ?? 0 ] ,
188213 data : [
189214 {
190- ...nodeInfo ,
215+ ...clonedNodeInfo ,
191216 type : nodeInfoPropertyName ,
192217 nodeType : nodeInfo . type ,
193218 } ,
0 commit comments