Skip to content

Commit a25ceae

Browse files
committed
2 parents 8f30f0f + 184c409 commit a25ceae

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

app/lib/node-editor/utils/duplicate.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,19 @@ interface DuplicateOptions {
1010
targetPosition?: { x: number; y: number };
1111
}
1212

13-
// this accepts a list of nodes and duplicates them
14-
// loops and groups will be handled automatically, just include them and their children
13+
/**
14+
* Duplicates the given nodes and their associated edges, handling groups and loops automatically.
15+
* This function creates new nodes and edges based on the provided nodes,
16+
* ensuring that the new nodes are positioned relative to the original nodes.
17+
* If a target position is provided, the new nodes will be positioned relative to that.
18+
* If no target position is provided, the new nodes will be offset by a default value.
19+
* @param nodes - The list of nodes to duplicate.
20+
* @param getEdges - A function to retrieve the current edges.
21+
* @param getNodes - A function to retrieve the current nodes.
22+
* @param setEdges - A function to set the new edges.
23+
* @param setNodes - A function to set the new nodes.
24+
* @param options - Optional parameters for duplication, such as target position.
25+
*/
1526
export function duplicateNodes(
1627
nodes: Node[],
1728
getEdges: () => Edge[],

0 commit comments

Comments
 (0)