How to use the mout/src/lang/clone function in mout

To help you get started, we’ve selected a few mout examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kitware / light-viz / lib / panels / Contour / index.js View on Github external
onReset() {
    this.setState({
      field: this.oldState.field,
      values: clone(this.oldState.values),
    });
  }
github Kitware / light-viz / lib / panels / Contour / index.js View on Github external
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);
  }
github Kitware / light-viz / lib / panels / Contour / index.js View on Github external
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();
    }
  }
github Kitware / light-viz / lib / panels / Streamline / index.js View on Github external
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 });
  }
github Kitware / light-viz / lib / panels / MultiSlice / index.js View on Github external
updateState(newState) {
    const localState = {
      values: newState.positions,
      axis: newState.normal,
    };
    this.oldState = {
      values: clone(newState.positions),
      axis: newState.normal,
    };
    this.setState(localState);
  }
github Kitware / light-viz / lib / panels / Threshold / index.js View on Github external
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);
  }
github Kitware / light-viz / lib / panels / Section / index.js View on Github external
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>
github Kitware / light-viz / lib / panels / Contour / index.js View on Github external
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;
  }
github Kitware / light-viz / lib / panels / Slice / index.js View on Github external
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;
  }
github Kitware / light-viz / lib / panels / MultiSlice / index.js View on Github external
onReset() {
    this.setState({
      values: clone(this.oldState.values),
      axis: this.oldState.axis,
    });
  }