add BehaviorTree

This commit is contained in:
zhandouxiaojiji committed 2020-10-16 11:30:30 +08:00
1 parent 04f329eb7d
commit 30a49ed5d6
7 files changed
+69 -63

No files matched your search

+1
View File
@@ -44,6 +44,7 @@ export class MainProcess {
// fullscreenable:false, // fullscreenable:false,
// maximizable:false // maximizable:false
}); });
this.mainWindow.maximize();
// mainWindow.webContents.openDevTools(); // mainWindow.webContents.openDevTools();
this.mainWindow.loadFile('index.html'); this.mainWindow.loadFile('index.html');
this.mainWindow.on('closed', function () { this.mainWindow.on('closed', function () {
+33
View File
@@ -0,0 +1,33 @@
import * as React from 'react';
import GGEditor, { Mind, RegisterNode } from 'gg-editor';
import { MindData } from 'gg-editor/lib/common/interfaces';
const data: MindData = {
id: "1",
label: 'Central Topic111',
children: [
{
id: "2",
label: 'Main Topic 1',
},
{
id: "3",
label: 'Main Topic 2',
},
{
id: "4",
label: 'Main Topic 3',
},
],
};
export default class BehaviorTree extends React.Component {
render() {
return (
<Mind
style={{ width: "70vw", height: "100vh" }}
graphConfig= {{fitView: true, maxZoom:2, fitViewPadding:[20, 20, 20, 20]}}
data={data}
/>
);
}
}
+5 -4
View File
@@ -5,19 +5,20 @@
} }
.editorBd { .editorBd {
width: 100%;
height : 100%; height : 100%;
display: flex; display: flex;
background: #fafafa;
} }
.editorSidebar,
.editorContent { .editorContent {
min-width: 500px; /* min-width: 500px; */
height : 100%; height : 100%;
} }
.editorSidebar { .editorSidebar {
background: #fafafa; /* min-width: 500px; */
height : 100%;
overflow-y: auto; overflow-y: auto;
} }
+25 -3
View File
@@ -13,16 +13,38 @@ interface NodePanelState {
} }
class NodePanel extends React.Component<NodePanelProps, NodePanelState> { class Panel extends React.Component<NodePanelProps, NodePanelState> {
render() { render() {
const { nodes } = this.props; const { nodes } = this.props;
console.log("NodePanel render", nodes);
const node = nodes[0]; const node = nodes[0];
if (node) {
return ( return (
<Card> <Card title="节点信息">
{node ? node.getModel().label : ''} {node ? node.getModel().label : ''}
</Card> </Card>
) )
} else {
return (
<Card title="节点信息">
未选中
</Card>
)
}
} }
} }
export default DetailPanel.create<NodePanelProps>('node')(withEditorContext(NodePanel)); export default class NodePanel extends React.Component {
render() {
console.log("NodePanel render");
return (
<Card title="节点信息" style = {{height:"100%"}}>
未选中fefqwefqwefwewef
</Card>
)
}
}
// export default DetailPanel.create<NodePanelProps>('node')(withEditorContext(Panel));
+2 -2
View File
@@ -4,6 +4,7 @@ import { MindData } from 'gg-editor/lib/common/interfaces';
import { Row, Col } from 'antd'; import { Row, Col } from 'antd';
import './Editor.css'; import './Editor.css';
import NodePanel from './NodePanel'; import NodePanel from './NodePanel';
import BehaviorTree from './BehaviorTree';
export interface EditorProps { export interface EditorProps {
@@ -15,8 +16,7 @@ export default class Editor extends React.Component<EditorProps> {
<GGEditor className="editor"> <GGEditor className="editor">
<Row className="editorBd"> <Row className="editorBd">
<Col span={18} className="editorContent"> <Col span={18} className="editorContent">
hello <BehaviorTree />
{/* <BehaviorTree /> */}
</Col> </Col>
<Col span={6} className="editorSidebar"> <Col span={6} className="editorSidebar">
<NodePanel /> <NodePanel />
-52
View File
@@ -1,52 +0,0 @@
import * as React from 'react';
import GGEditor, { Mind, RegisterNode } from 'gg-editor';
import { MindData } from 'gg-editor/lib/common/interfaces';
const data: MindData = {
id: "1",
label: 'Central Topic111',
children: [
{
id: "2",
label: 'Main Topic 1',
},
{
id: "3",
label: 'Main Topic 2',
},
{
id: "4",
label: 'Main Topic 3',
},
],
};
export default class Hello extends React.Component {
render() {
return (
<GGEditor style={{ background: "#242424" }}>
<Mind
style={{ width: 500, height: 500 }}
data={data}
graphConfig={{ defaultNode: { type: 'customNode' } }}
/>
<RegisterNode
name="customNode"
config={{
getCustomConfig(model: any) {
return {
wrapperStyle: {
fill: '#000000',
},
};
},
}}
extend="bizFlowNode"
/>
</GGEditor>
);
}
}
function getExclamationMarks(numChars: number) {
return Array(numChars + 1).join('!');
}
+3 -2
View File
@@ -114,7 +114,7 @@ export default class Main extends Component {
/> />
</Sider> </Sider>
<Content className="content"> <Content className="content">
<Tabs {/* <Tabs
hideAdd hideAdd
className="tabs" className="tabs"
type="editable-card" type="editable-card"
@@ -128,7 +128,8 @@ export default class Main extends Component {
); );
}) })
} }
</Tabs> </Tabs> */}
<Editor />
</Content> </Content>
</Layout> </Layout>
) )