Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two input node give error #113

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,26 @@ class BodyWidget extends React.Component<BodyWidgetProps, BodyWidgetState> {
event => {
var data = JSON.parse(event.dataTransfer.getData("storm-diagram-node"));
var node = null;
var is_true=true;
var old_nodes =this.props.app.getDiagramEngine().getDiagramModel().serializeDiagram().nodes;
if (data.name === "inp_layer") {
for(var i=0;i<old_nodes.length;i++){
console.log(old_nodes[i].extras.name,i)
if (old_nodes[i].extras.name==="Input Node"){
window.alert("There is already one Input node.");
is_true=false
break;
}
}
console.log(is_true)
if(is_true){
node = new DefaultNodeModel("Input", "rgb(0,102,255)");
node.addPort(new DefaultPortModel(false, "out-1", "out"));
node.extras = {
name: "Input Node",
wight: 0.5
}
} else if (data.name === "out_layer") {
} }else if (data.name === "out_layer") {

node = new DefaultNodeModel("Output", "rgb(90,102,255)");
node.addPort(new DefaultPortModel(true, "in-1", "In"));
Expand All @@ -493,6 +505,7 @@ class BodyWidget extends React.Component<BodyWidgetProps, BodyWidgetState> {
wight: 0.5
}
}
if(node != null){
var points = this.props.app.getDiagramEngine().getRelativeMousePoint(event);
node.x = points.x;
node.y = points.y;
Expand All @@ -501,7 +514,7 @@ class BodyWidget extends React.Component<BodyWidgetProps, BodyWidgetState> {
.getDiagramModel()
.addNode(node);
this.forceUpdate();
}
}}
}
onDragOver = {
event => {
Expand Down