mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
fix: fix variable inspect panel width in subgraphs
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user