select node

This commit is contained in:
zhandouxiaojiji committed 2020-10-19 17:50:37 +08:00
1 parent 46123a9b83
commit d2b0584c24
3 files changed
+34 -14

No files matched your search

+17 -4
View File
@@ -3,6 +3,7 @@ import GGEditor, { Mind, RegisterNode, withEditorContext } from 'gg-editor';
import { Row, Col } from 'antd';
import NodePanel from './NodePanel';
import BehaviorTree from './BehaviorTree';
import { INode } from '@antv/g6/lib/interface/item';
import './Editor.css';
@@ -10,7 +11,15 @@ export interface EditorProps {
filepath: string;
}
export default class Editor extends React.Component<EditorProps> {
interface EditorState {
curNode: INode | null;
}
export default class Editor extends React.Component<EditorProps, EditorState> {
state: EditorState = {
curNode: null
}
componentWillMount() {
}
@@ -19,18 +28,22 @@ export default class Editor extends React.Component<EditorProps> {
}
render() {
const { curNode } = this.state;
return (
<GGEditor className="editor">
<Row className="editorBd">
<Col span={18} className="editorContent">
<BehaviorTree
<BehaviorTree
onSelectNode={(node) => {
console.log("onSelectNode", node)
console.log("onSelectNode", node);
this.setState({ curNode: node });
}}
/>
</Col>
<Col span={6} className="editorSidebar">
<NodePanel />
<NodePanel
curNode={curNode}
/>
</Col>
</Row>
</GGEditor>