Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onReset() {
this.setState({
field: this.oldState.field,
values: clone(this.oldState.values),
});
}
updateState(newState) {
const localState = {
values: newState.values,
field: this.state.field,
};
if (newState.field !== '') {
localState.field = newState.field;
}
this.oldState = clone(localState);
this.oldState.values = clone(localState.values);
this.setState(localState);
}
const previous = this.props.dataset.data.arrays;
const next = nextProps.dataset.data.arrays;
if (!equals(previous, next)) {
if (next.length) {
this.oldState = {
values: [0.5 * (next[0].range[0] + next[0].range[1])],
field: next[0].name,
};
this.setState(clone(this.oldState));
} else {
this.oldState = {
values: [],
field: '',
};
this.setState(clone(this.oldState));
}
}
if (this.props.dataset.autoApply !== nextProps.dataset.autoApply) {
this.onApply();
}
}
onApply() {
const { xPosition, yPosition, zPosition } = this.state;
const pos = {
xPosition,
yPosition,
zPosition,
};
updateStreamlineSeedPoint(pos);
updateStreamlineVector(this.state.vector);
updateStreamlineNumPoints(this.state.numPoints);
updateStreamlineSeedRadius(this.state.radius);
showStreamlineSeed(false);
this.oldState = clone(this.state);
this.oldState.applyDone = true;
this.setState({ applyDone: true });
}
updateState(newState) {
const localState = {
values: newState.positions,
axis: newState.normal,
};
this.oldState = {
values: clone(newState.positions),
axis: newState.normal,
};
this.setState(localState);
}
onApply() {
updateThresholdRange(this.state.rangeMin, this.state.rangeMax);
updateThresholdBy(
this.props.dataset.data.arrays[this.state.currentArrayIndex].name
);
this.setState({ applyDone: true });
this.oldState = clone(this.state);
}
render() {
const panelClass = this.state.showing ? style.shown : style.hidden;
const iconClass = this.state.showing ? style.shownIcon : style.hiddenIcon;
const sectionClass = this.props.hidden
? style.sectionHidden
: style.section;
const propsWithHidden = clone(this.props);
propsWithHidden.hideAdditionalControls = !this.state.showing;
const content = this.props.panel
? React.createElement(this.props.panel.component, propsWithHidden)
: this.props.content;
return (
<div>
<div>
<i>
</i></div><i>
<div>{content}</div>
</i></div><i>
);
}
}</i>
onApply() {
updateContourValues(this.state.values);
updateContourBy(this.state.field);
this.oldState = clone(this.state);
this.oldState.values = clone(this.state.values);
this.setState({ applyDone: true });
this.oldState.applyDone = true;
}
onApply() {
const { xPosition, yPosition, zPosition } = this.state;
const pos = {
xPosition,
yPosition,
zPosition,
};
updateSlicesVisible(
this.state.xVisible,
this.state.yVisible,
this.state.zVisible
);
updateSlicePosition(pos);
this.oldState = clone(this.state);
this.setState({ applyDone: true });
this.oldState.applyDone = true;
}
onReset() {
this.setState({
values: clone(this.oldState.values),
axis: this.oldState.axis,
});
}