darabos commited on
Commit
fb847c9
·
1 Parent(s): 91961e7

Support nested groups.

Browse files
lynxkite-app/web/src/workspace/Workspace.tsx CHANGED
@@ -363,7 +363,7 @@ function LynxKiteFlow() {
363
  reactFlow.deleteElements({ nodes: selectedNodes, edges: selectedEdges });
364
  }
365
  function groupSelection() {
366
- const selectedNodes = nodes.filter((n) => n.selected);
367
  const groupNode = {
368
  id: findFreeId("Group"),
369
  type: "node_group",
@@ -398,7 +398,7 @@ function LynxKiteFlow() {
398
  ...n,
399
  position: { x: n.position.x - left, y: n.position.y - top },
400
  parentId: groupNode.id,
401
- extent: "parent",
402
  selected: false,
403
  }
404
  : n,
 
363
  reactFlow.deleteElements({ nodes: selectedNodes, edges: selectedEdges });
364
  }
365
  function groupSelection() {
366
+ const selectedNodes = nodes.filter((n) => n.selected && !n.parentId);
367
  const groupNode = {
368
  id: findFreeId("Group"),
369
  type: "node_group",
 
398
  ...n,
399
  position: { x: n.position.x - left, y: n.position.y - top },
400
  parentId: groupNode.id,
401
+ extent: "parent" as const,
402
  selected: false,
403
  }
404
  : n,