diff --git a/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx b/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx
index 622d9f7..117c5ac 100644
--- a/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx
+++ b/web/app/dashboard/ai-workflows/_components/workflow-editor-toolbar.tsx
@@ -3,6 +3,9 @@
import type { ReactNode } from "react"
import {
CheckCircle2Icon,
+ Maximize2Icon,
+ MinusIcon,
+ PlusIcon,
RotateCcwIcon,
SaveIcon,
SendIcon,
@@ -11,6 +14,7 @@ import {
} from "lucide-react"
import { Button } from "@/components/ui/button"
+import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { cn } from "@/lib/utils"
import type { WorkflowDraftValidation } from "./workflow-utils"
@@ -26,6 +30,11 @@ export function WorkflowEditorToolbar({
redoDisabled = false,
onAutoLayout,
autoLayoutDisabled = false,
+ zoomPercent,
+ onZoomIn,
+ onZoomOut,
+ onResetZoom,
+ onFitView,
onRestoreDefault,
restoreDefaultDisabled = false,
onValidate,
@@ -45,6 +54,11 @@ export function WorkflowEditorToolbar({
redoDisabled?: boolean
onAutoLayout?: () => void
autoLayoutDisabled?: boolean
+ zoomPercent?: string
+ onZoomIn?: () => void
+ onZoomOut?: () => void
+ onResetZoom?: () => void
+ onFitView?: () => void
onRestoreDefault?: () => void
restoreDefaultDisabled?: boolean
onValidate?: () => void
@@ -72,6 +86,35 @@ export function WorkflowEditorToolbar({
{toolbarExtra}
+
+
+
+
+
+
+ }
+ >
+ {zoomPercent ?? "100%"}
+
+ 重置为 100%
+
+
+
+
+
+
+
+
)
}
+
+function WorkflowToolbarIconButton({
+ label,
+ onClick,
+ children,
+}: {
+ label: string
+ onClick?: () => void
+ children: ReactNode
+}) {
+ return (
+
+
+ }
+ >
+ {children}
+
+ {label}
+
+ )
+}
diff --git a/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx b/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx
index 80ab1f9..61cb74f 100644
--- a/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx
+++ b/web/app/dashboard/ai-workflows/_components/workflow-editor.tsx
@@ -191,6 +191,7 @@ function WorkflowEditorInner({
const workflowDocument = useService(WorkflowDocument)
const selectService = useService(WorkflowSelectService)
const [autoLayouting, setAutoLayouting] = useState(false)
+ const zoomPercent = `${Math.round(playgroundTools.zoom * 100)}%`
useEffect(() => {
const disposable = selectService.onSelectionChanged(() => {
@@ -248,6 +249,12 @@ function WorkflowEditorInner({
}
}
+ const resetZoom = () => {
+ context.playground.config.updateConfig({
+ zoom: 1,
+ })
+ }
+
const closeConfigPanel = () => {
selectService.clear()
onSelectNode("")
@@ -273,6 +280,11 @@ function WorkflowEditorInner({
redoDisabled={redoDisabled}
onAutoLayout={() => void autoLayout()}
autoLayoutDisabled={autoLayouting || definition.nodes.length < 2}
+ zoomPercent={zoomPercent}
+ onZoomIn={() => playgroundTools.zoomin(true)}
+ onZoomOut={() => playgroundTools.zoomout(true)}
+ onResetZoom={resetZoom}
+ onFitView={() => playgroundTools.fitView(true)}
onRestoreDefault={onRestoreDefault}
restoreDefaultDisabled={restoreDefaultDisabled}
onValidate={onValidate}