@@ -7,7 +7,9 @@ import CameraControls from '@metacell/geppetto-meta-ui/camera-controls/CameraCon
77// import ControlPanel from 'geppetto-client/js/components/interface/controlPanel/controlpanel';
88
99import { NetWorkControlButtons } from 'netpyne/components' ;
10- import { primaryColor , canvasBgDark , canvasBgLight , bgRegular } from '../../theme' ;
10+ import {
11+ primaryColor , canvasBgDark , canvasBgLight , bgRegular ,
12+ } from '../../theme' ;
1113import { THEMES } from '../../constants' ;
1214
1315const CANVAS_LIGHT = 'canvas-toolbar-btns-light' ;
@@ -39,6 +41,9 @@ class NetPyNEInstantiated extends React.Component {
3941 data : [
4042 {
4143 instancePath : 'network' ,
44+ color : {
45+ g : 0.50 , b : 0.60 , r : 1 , a : 0.80 ,
46+ } ,
4247 } ,
4348 ] ,
4449 selected : { } ,
@@ -48,58 +53,26 @@ class NetPyNEInstantiated extends React.Component {
4853 far : 2000000 ,
4954 baseZoom : 1 ,
5055 position : { x : - 97.349 , y : 53.797 , z : 387.82 } ,
51- rotation : { rx : 0.051 , ry : - 0.192 , rz : - 0.569 , radius : 361.668 } ,
56+ rotation : {
57+ rx : 0.051 , ry : - 0.192 , rz : - 0.569 , radius : 361.668 ,
58+ } ,
5259 autoRotate : false ,
5360 movieFilter : true ,
5461 reset : false ,
55- cameraControls : {
62+ cameraControls : {
5663 instance : CameraControls ,
57- props : { }
64+ props : { } ,
5865 } ,
5966 } ,
6067 } ;
6168 this . dimensions = {
62- width : 200 ,
63- height : 200 ,
69+ width : '1980px' ,
70+ height : '1900px' ,
6471 } ;
6572 this . canvasRef = React . createRef ( ) ;
6673 this . controlPanelToggle = this . controlPanelToggle . bind ( this ) ;
6774 }
6875
69- componentDidMount ( ) {
70- // this.canvasRef.current.engine.setLinesThreshold(10000);
71- // this.canvasRef.current.displayAllInstances();
72- // this.updateBtnsWithTheme('', this.state.canvasBtnCls);
73- // window.addEventListener('resize', this.delayedResize.bind(this));
74- // this.resizeIfNeeded();
75- // this.updateInstances();
76-
77- // GEPPETTO.on(GEPPETTO.Events.Control_panel_close, () => {
78- // this.setState({ bringItToFront: 0 });
79- // });
80- }
81-
82- componentDidUpdate ( prevProps , prevState ) {
83- // this.resizeIfNeeded();
84- // const { theme } = this.props;
85- // if (prevProps.theme !== this.props.theme) {
86- // theme === THEMES.LIGHT ? this.updateBtnsWithTheme(CANVAS_DARK, CANVAS_LIGHT)
87- // : this.updateBtnsWithTheme(CANVAS_LIGHT, CANVAS_DARK);
88- // }
89- // if (prevState.controlPanelInitialized !== this.state.controlPanelInitialized) {
90- // if (this.state.controlPanelInitialized) {
91- // $('#controlpanel')
92- // .show();
93- // }
94- // }
95- }
96-
97- componentWillUnmount ( ) {
98- // GEPPETTO.off(GEPPETTO.Events.Control_panel_close);
99- // clearTimeout(this.timer);
100- // window.removeEventListener('resize', this.delayedResize);
101- }
102-
10376 updateBtnsWithTheme = ( removeClass , addClass ) => {
10477 const element = document . getElementById ( 'CanvasContainer_component' ) ;
10578 if ( removeClass ) {
@@ -109,25 +82,6 @@ class NetPyNEInstantiated extends React.Component {
10982 this . setState ( { canvasBtnCls : addClass } ) ;
11083 } ;
11184
112- // updateInstances () {
113- // if (window.Instances != null && window.Instances.network) {
114- // // update canvas only if there are instances to show
115- // this.canvasRef.current.engine.setLinesThreshold(25000);
116- // this.canvasRef.current.engine.updateSceneWithNewInstances(
117- // window.Instances,
118- // );
119- // this.canvasRef.current.resetCamera();
120-
121- // this.canvasRef.current.setColor('network', primaryColor, true);
122- // const spotLight = this.canvasRef.current.engine.scene.children.find(
123- // (child) => child.type === 'SpotLight',
124- // );
125- // if (spotLight) {
126- // this.canvasRef.current.engine.scene.remove(spotLight);
127- // }
128- // }
129- // }
130-
13185 resizeCanvas ( ) {
13286 this . setState ( ( prevState ) => ( { update : prevState . update + 1 } ) ) ;
13387 }
@@ -169,7 +123,7 @@ class NetPyNEInstantiated extends React.Component {
169123 mapToCanvasData ( data ) {
170124 return data . map ( ( item ) => (
171125 {
172- color : item . selected ? SELECTION_COLOR : DEFAULT_COLOR ,
126+ color : item . selected ? SELECTION_COLOR : item . color ,
173127 instancePath : item . instancePath ,
174128 }
175129 ) ) ;
@@ -204,18 +158,6 @@ class NetPyNEInstantiated extends React.Component {
204158
205159 return (
206160 < div className = "instantiatedContainer" >
207- { /* <Canvas
208- id="CanvasContainer"
209- name="Canvas"
210- componentType="Canvas"
211- ref={this.canvasRef}
212- style={{
213- height: '100%',
214- width: '100%',
215- background: bgColor,
216- }}
217- update={update}
218- /> */ }
219161 < Canvas
220162 ref = { this . canvasRef }
221163 cameraOptions = { camOptions }
@@ -228,4 +170,4 @@ class NetPyNEInstantiated extends React.Component {
228170 }
229171}
230172
231- export default withStyles ( styles ) ( NetPyNEInstantiated ) ;
173+ export default withStyles ( styles ) ( NetPyNEInstantiated ) ;
0 commit comments