diff --git a/classes/deck/deck.gd b/classes/deck/deck.gd index 71b79da..00455f1 100644 --- a/classes/deck/deck.gd +++ b/classes/deck/deck.gd @@ -188,7 +188,9 @@ func group_nodes(nodes_to_group: Array) -> Deck: var group := DeckHolder.add_empty_group() var midpoint := Vector2() - var temp := [] + + var rightmost := -INF + var leftmost := INF for node: DeckNode in nodes_to_group: #if node.node_type == "group_node": #var _group_id: String = node.group_id @@ -196,6 +198,11 @@ func group_nodes(nodes_to_group: Array) -> Deck: #groups.erase(_group) #group.groups[_group_id] = _group #_group._belonging_to = group + + if node.position.x > rightmost: + rightmost = node.position.x + if node.position.x < leftmost: + leftmost = node.position.x var outgoing_connections := node.outgoing_connections.duplicate(true) @@ -233,6 +240,13 @@ func group_nodes(nodes_to_group: Array) -> Deck: var output_node := group.add_node_type("group_output") group.group_input_node = input_node._id group.group_output_node = output_node._id + + input_node.position.x = leftmost - 350 + output_node.position.x = rightmost + 350 + input_node.position.y = midpoint.y + output_node.position.y = midpoint.y + input_node.position_updated.emit(input_node.position) + output_node.position_updated.emit(output_node.position) input_node.group_node = _group_node output_node.group_node = _group_node