Skip to content

Commit

Permalink
Fix creating multiple links at once
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Nov 20, 2020
1 parent 830c9a7 commit 92bbe44
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Sources/zui/Nodes.hx
Expand Up @@ -252,16 +252,18 @@ class Nodes {
}
if (ui.inputStarted && ui.getInputInRect(wx + NODE_X(node) - LINE_H() / 2, wy + NODE_Y(node) - LINE_H() / 2, NODE_W() + LINE_H(), nodeh + LINE_H())) {
// Check sockets
for (i in 0...outs.length) {
var sx = wx + NODE_X(node) + NODE_W();
var sy = wy + NODE_Y(node) + SOCKET_Y(i);
if (ui.getInputInRect(sx - LINE_H() / 2, sy - LINE_H() / 2, LINE_H(), LINE_H())) {
// New link from output
var l: TNodeLink = { id: getLinkId(canvas.links), from_id: node.id, from_socket: i, to_id: -1, to_socket: -1 };
canvas.links.push(l);
linkDrag = l;
isNewLink = true;
break;
if (linkDrag == null) {
for (i in 0...outs.length) {
var sx = wx + NODE_X(node) + NODE_W();
var sy = wy + NODE_Y(node) + SOCKET_Y(i);
if (ui.getInputInRect(sx - LINE_H() / 2, sy - LINE_H() / 2, LINE_H(), LINE_H())) {
// New link from output
var l: TNodeLink = { id: getLinkId(canvas.links), from_id: node.id, from_socket: i, to_id: -1, to_socket: -1 };
canvas.links.push(l);
linkDrag = l;
isNewLink = true;
break;
}
}
}
if (linkDrag == null) {
Expand Down

0 comments on commit 92bbe44

Please sign in to comment.