Skip to content

Commit fa97c66

Browse files
committed
Completed Coords Range missing functionality
1 parent a45fba1 commit fa97c66

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

webapp/components/general/NetPyNECoordsRange.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff 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
);

0 commit comments

Comments
 (0)