Move noodle correctly when the node it's connected to moves
This commit is contained in:
@@ -153,7 +153,7 @@ i32 run_main_loop(void) {
|
||||
}
|
||||
}
|
||||
|
||||
for (u64 i = 0; i < comp.count; ++i) {
|
||||
for (u64 i = NODE_START; i <= comp.count; ++i) {
|
||||
node *node_elem = &(comp.nodes[i]);
|
||||
|
||||
f64 angle = 90.0;
|
||||
@@ -178,7 +178,7 @@ i32 run_main_loop(void) {
|
||||
ndl->ln.p0.y += comp.ctx.rel_y;
|
||||
break;
|
||||
case NOODLE_ACTION_RELEASED:
|
||||
for (u64 k = 0; k < comp.count; ++k) {
|
||||
for (u64 k = NODE_START; k <= comp.count; ++k) {
|
||||
if (k == i) {
|
||||
continue;
|
||||
}
|
||||
@@ -228,6 +228,25 @@ i32 run_main_loop(void) {
|
||||
ndl->ln.p1.x += comp.ctx.rel_x;
|
||||
ndl->ln.p1.y += comp.ctx.rel_y;
|
||||
}
|
||||
|
||||
for (u64 j = NODE_START; j <= comp.count; ++j) {
|
||||
if (j == i) {
|
||||
continue;
|
||||
}
|
||||
|
||||
node *nd = &(comp.nodes[j]);
|
||||
if (nd->inputs == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (u64 k = 0; k < nd->inputs; ++k) {
|
||||
noodle *ndl = &(nd->noodles[k]);
|
||||
if (ndl->connected_node == i) {
|
||||
ndl->ln.p0.x += comp.ctx.rel_x;
|
||||
ndl->ln.p0.y += comp.ctx.rel_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user