4 * Copyright 2016 RIFT.IO Inc
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 import React
from 'react'
22 import ReactDOM
from 'react-dom'
23 import PureRenderMixin
from 'react-addons-pure-render-mixin'
24 import DescriptorGraph
from '../libraries/graph/DescriptorGraph'
25 import ComposerAppStore
from '../stores/ComposerAppStore'
27 import '../styles/CatalogItemCanvasEditor.scss'
28 import '../styles/DescriptorGraph.scss'
30 class CatalogItemCanvasEditor
extends React
.Component
{
37 isShowingMoreInfo
: false
42 const element
= ReactDOM
.findDOMNode(this.refs
.descriptorGraph
);
44 zoom
: this.props
.zoom
,
45 readOnly
: this.props
.readOnly
47 const graph
= new DescriptorGraph(element
, options
);
48 graph
.containers
= this.props
.containers
;
49 this.setState({graph
: graph
});
52 componentDidUpdate() {
53 this.state
.graph
.containers
= this.props
.containers
;
54 const isNSD
= this.props
.containers
[0] && this.props
.containers
[0].uiState
.type
=== 'nsd';
56 this.state
.graph
.showMoreInfo
= this.props
.isShowingMoreInfo
;
58 this.state
.graph
.showMoreInfo
= true;
60 this.state
.graph
.update();
63 componentWillUnmount() {
64 this.state
.graph
.destroy();
68 const graph
= this.state
.graph
;
70 graph
.zoom(this.props
.zoom
);
73 <div data
-offset
-parent
="true" className
="CatalogItemCanvasEditor">
74 <div key
="outline-indicator" data
-outline
-indicator
="true"></div
>
75 <div id
='canvas-dropzone' style
={{visibility
: 'hidden'}}></div
>
76 <div ref
="descriptorGraph" className
="DescriptorGraph"></div
>
82 export default CatalogItemCanvasEditor
;