X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Fcomposer%2Fsrc%2Fsrc%2Fcomponents%2FCatalogItemCanvasEditor.js;h=77c349789eddaa8f437a40be0ac518c490bd8eae;hp=097596ddf5ce8430113e953b83478cb4cb836b70;hb=refs%2Ftags%2Fv3.0.0rc2;hpb=f2dc2462571800e62cba969964de621dca09299c diff --git a/skyquake/plugins/composer/src/src/components/CatalogItemCanvasEditor.js b/skyquake/plugins/composer/src/src/components/CatalogItemCanvasEditor.js index 097596ddf..77c349789 100644 --- a/skyquake/plugins/composer/src/src/components/CatalogItemCanvasEditor.js +++ b/skyquake/plugins/composer/src/src/components/CatalogItemCanvasEditor.js @@ -27,31 +27,28 @@ import ComposerAppStore from '../stores/ComposerAppStore' import '../styles/CatalogItemCanvasEditor.scss' import '../styles/DescriptorGraph.scss' -const CatalogItemCanvasEditor = React.createClass({ - mixins: [PureRenderMixin], - getInitialState() { - return { - graph: null - }; - }, - getDefaultProps() { - return { +class CatalogItemCanvasEditor extends React.Component { + constructor(props) { + super(props); + this.state = { + graph: null, zoom: 100, containers: [], isShowingMoreInfo: false }; - }, - componentWillMount() { - }, + } + componentDidMount() { const element = ReactDOM.findDOMNode(this.refs.descriptorGraph); const options = { - zoom: this.props.zoom + zoom: this.props.zoom, + readOnly: this.props.readOnly }; const graph = new DescriptorGraph(element, options); graph.containers = this.props.containers; this.setState({graph: graph}); - }, + } + componentDidUpdate() { this.state.graph.containers = this.props.containers; const isNSD = this.props.containers[0] && this.props.containers[0].uiState.type === 'nsd'; @@ -61,10 +58,12 @@ const CatalogItemCanvasEditor = React.createClass({ this.state.graph.showMoreInfo = true; } this.state.graph.update(); - }, + } + componentWillUnmount() { this.state.graph.destroy(); - }, + } + render() { const graph = this.state.graph; if (graph) { @@ -78,6 +77,6 @@ const CatalogItemCanvasEditor = React.createClass({ ); } -}); +}; export default CatalogItemCanvasEditor;