Fix what happens when a noodle gets released

This commit is contained in:
Abdelrahman Said 2024-02-27 23:12:59 +00:00
parent b447e9d5a1
commit 4ed86611b5

View File

@ -220,7 +220,9 @@ internal void draw_node_graph(compositor *comp, const window *wnd) {
ndl->ln.p0.x += comp->ctx.rel_x;
ndl->ln.p0.y += comp->ctx.rel_y;
break;
case NOODLE_ACTION_RELEASED:
case NOODLE_ACTION_RELEASED: {
bool connected = false;
for (u64 k = NODE_START; k <= comp->count; ++k) {
if (k == i) {
continue;
@ -234,12 +236,19 @@ internal void draw_node_graph(compositor *comp, const window *wnd) {
ndl->ln.p0 = p0;
ndl->connected_node = k;
} else {
ndl->ln.p0 = ndl->ln.p1;
ndl->connected_node = EMPTY_NODE;
connected = true;
break;
}
}
if (!connected) {
ndl->ln.p0 = ndl->ln.p1;
ndl->connected_node = EMPTY_NODE;
}
break;
}
default:
break;
}