File tree Expand file tree Collapse file tree
webapp/components/general Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,11 +96,32 @@ export default class NetPyNECoordsRange extends Component {
9696 handleCoordParamChange ( index , newValue ) {
9797 const {
9898 model,
99+ conds,
99100 name,
100101 } = this . props ;
102+
103+ function getOppositeObject ( list , givenValue ) {
104+ const index = list . findIndex ( obj => obj . value === givenValue ) ;
105+
106+ if ( index === - 1 || list . length !== 2 ) {
107+ return null ;
108+ }
109+ return list [ 1 - index ] ;
110+ }
111+
112+ const opossiteRangeType = getOppositeObject ( this . props . items , this . state . rangeType ) ;
113+
114+ if ( opossiteRangeType )
115+ {
116+ const pythonMessageDelOpposite = `netpyne_geppetto.${ model } ['${ name } ']['${ conds } '].pop('${ opossiteRangeType . value } ', None)` ;
117+ Utils . execPythonMessage (
118+ pythonMessageDelOpposite
119+ ) ;
120+ }
121+
101122 const rangeValue = this . state . rangeValue ;
102123 rangeValue [ index ] = newValue ;
103- const pythonMessage = `netpyne_geppetto.${ model } ['${ name } ']['${ this . state . rangeType } '] = [${ rangeValue } ]` ;
124+ const pythonMessage = `netpyne_geppetto.${ model } ['${ name } ']['${ conds } '][' ${ this . state . rangeType } '] = [${ rangeValue } ]` ;
104125 Utils . execPythonMessage (
105126 pythonMessage
106127 ) ;
You can’t perform that action at this time.
0 commit comments