@@ -20,7 +20,7 @@ type CCComponentEditorRendererComponentPinProps = {
2020 nodeId : CCNodeId ; // TODO: this might be unnecessary
2121 pinId : CCComponentPinId ;
2222 position : PIXI . Point ;
23- // simulation : () => Map<CCComponentPinId, boolean[]> | null ;
23+ getPinValue : ( ) => boolean [ ] | undefined ;
2424} ;
2525
2626/**
@@ -43,7 +43,7 @@ export default class CCComponentEditorRendererComponentPin extends CCComponentEd
4343
4444 readonly #unsubscribeComponentEditorStore: ( ) => void ;
4545
46- // readonly #simulation : () => Map<CCComponentPinId, boolean[]> | null ;
46+ readonly #getPinValue : ( ) => boolean [ ] | undefined ;
4747
4848 #valueBoxWidth: number ;
4949
@@ -65,7 +65,6 @@ export default class CCComponentEditorRendererComponentPin extends CCComponentEd
6565 super ( props . context ) ;
6666 this . #componentPinId = props . pinId ;
6767 this . position = props . position ;
68- // this.#simulation = props.simulation;
6968 this . #pixiParentContainer = props . pixiParentContainer ;
7069 this . #pixiContainer = new PIXI . Container ( ) ;
7170 this . #pixiParentContainer. addChild ( this . #pixiContainer) ;
@@ -116,6 +115,7 @@ export default class CCComponentEditorRendererComponentPin extends CCComponentEd
116115 this . context . store . componentPins . on ( "didUpdate" , ( pin ) => {
117116 if ( pin . id === this . #componentPinId) this . render ( ) ;
118117 } ) ;
118+ this . #getPinValue = props . getPinValue ;
119119 this . render ( ) ;
120120 }
121121
@@ -189,9 +189,7 @@ export default class CCComponentEditorRendererComponentPin extends CCComponentEd
189189 }
190190 return valueText ;
191191 } ;
192- const outputValue = editorState . getComponentPinValue (
193- this . #componentPinId
194- ) ;
192+ const outputValue = this . #getPinValue( ) ;
195193 if ( outputValue ) {
196194 this . #pixiValueText. text = createValueText ( outputValue ) ;
197195 this . #valueBoxWidth =
@@ -202,30 +200,6 @@ export default class CCComponentEditorRendererComponentPin extends CCComponentEd
202200 this . #pixiValueText. text = "" ;
203201 this . #pixiGraphics. beginFill ( errorColor ) ;
204202 }
205-
206- // const output = this.#simulation();
207- // if (output) {
208- // const createValueText = (values: boolean[]) => {
209- // let valueText = "";
210- // for (let i = 0; i < values.length; i += 1) {
211- // valueText += values[i] ? "1" : "0";
212- // }
213- // return valueText;
214- // };
215- // for (const [key, values] of output) {
216- // if (key === this.#componentPinId) {
217- // this.#pixiValueText.text = createValueText(values);
218- // this.#valueBoxWidth =
219- // c.valueBoxWidthUnit +
220- // ((values.length - 1) * c.valueBoxWidthUnit) / 4;
221- // break;
222- // }
223- // }
224- // this.#pixiGraphics.beginFill(grayColor.darken2);
225- // } else {
226- // this.#pixiValueText.text = "";
227- // this.#pixiGraphics.beginFill(errorColor);
228- // }
229203 }
230204 this . #pixiLabelTextBox. alignment =
231205 pin . type === "input" ? "right" : "left" ;
0 commit comments