Compare commits

...

2 Commits

Author SHA1 Message Date
Dream
cfe3a222ac Update autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/Flow/Flow.tsx
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-03-17 16:30:59 +05:30
eureka928
b9eaff7763 feat(frontend/builder): enable rectangle drag-to-select multiple blocks
Enable multi-block selection by dragging a rectangle on the canvas.
Left-click drag draws a selection box, middle/right-click drag and
scroll wheel pan the canvas. Nodes partially inside the rectangle
are included in the selection.

Shift+click to add to selection, multi-node drag, and copy/paste
of selected blocks already work via React Flow defaults and the
existing useCopyPaste hook.

Closes #11045
2026-03-17 16:30:59 +05:30
2 changed files with 12 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
import { useGetV1GetSpecificGraph } from "@/app/api/__generated__/endpoints/graphs/graphs";
import { okData } from "@/app/api/helpers";
import { FloatingReviewsPanel } from "@/components/organisms/FloatingReviewsPanel/FloatingReviewsPanel";
import { Background, ReactFlow } from "@xyflow/react";
import { Background, ReactFlow, SelectionMode } from "@xyflow/react";
import { parseAsString, useQueryStates } from "nuqs";
import { useCallback, useMemo } from "react";
import { useShallow } from "zustand/react/shallow";
@@ -112,6 +112,11 @@ export const Flow = () => {
nodesDraggable={!isLocked}
nodesConnectable={!isLocked}
elementsSelectable={!isLocked}
selectionOnDrag={!isLocked}
selectionMode={SelectionMode.Partial}
multiSelectionKeyCode={["Shift", "Meta", "Control"]}
panOnDrag={isLocked ? true : [1, 2]}
panOnScroll
deleteKeyCode={["Backspace", "Delete"]}
>
<Background />

View File

@@ -7,3 +7,9 @@
position: relative;
transform: none;
}
/* Selection box styling for drag-to-select */
.react-flow {
--xy-selection-background-color: rgba(99, 102, 241, 0.08);
--xy-selection-border: 1px solid rgba(99, 102, 241, 0.4);
}