fix: fix variable inspect panel width in subgraphs

This commit is contained in:
zhsama
2026-01-15 15:55:55 +08:00
parent ccb337e8eb
commit 8ee643e88d
5 changed files with 64 additions and 7 deletions

View File

@ -2,6 +2,7 @@ import type { Node } from 'reactflow'
import { memo, useCallback, useEffect, useMemo, useRef } from 'react'
import { MiniMap } from 'reactflow'
import UndoRedo from '../header/undo-redo'
import { useHooksStore } from '../hooks-store'
import { useStore } from '../store'
import VariableInspectPanel from '../variable-inspect'
import VariableTrigger from '../variable-inspect/trigger'
@ -14,16 +15,19 @@ export type OperatorProps = {
const Operator = ({ handleUndo, handleRedo }: OperatorProps) => {
const bottomPanelRef = useRef<HTMLDivElement>(null)
const interactionMode = useHooksStore(s => s.interactionMode)
const workflowCanvasWidth = useStore(s => s.workflowCanvasWidth)
const rightPanelWidth = useStore(s => s.rightPanelWidth)
const nodePanelWidth = useStore(s => s.nodePanelWidth)
const setBottomPanelWidth = useStore(s => s.setBottomPanelWidth)
const setBottomPanelHeight = useStore(s => s.setBottomPanelHeight)
const bottomPanelWidth = useMemo(() => {
if (!workflowCanvasWidth || !rightPanelWidth)
const panelWidth = rightPanelWidth || nodePanelWidth
if (!workflowCanvasWidth || !panelWidth)
return 'auto'
return Math.max((workflowCanvasWidth - rightPanelWidth), 400)
}, [workflowCanvasWidth, rightPanelWidth])
return Math.max((workflowCanvasWidth - panelWidth), 400)
}, [interactionMode, nodePanelWidth, rightPanelWidth, workflowCanvasWidth])
const getMiniMapNodeClassName = useCallback((node: Node) => {
return node.data?.selected