mirror of
https://github.com/langgenius/dify.git
synced 2026-09-10 01:00:15 +08:00
12 lines
387 B
TypeScript
12 lines
387 B
TypeScript
export const getPreviewPanelMaxWidth = (
|
|
workflowCanvasWidth: number | undefined,
|
|
hasSelectedNode: boolean,
|
|
fallback = 1024,
|
|
) => {
|
|
if (!workflowCanvasWidth) return fallback
|
|
|
|
// Keep the canvas visible and allow an open node panel to shrink to its minimum.
|
|
const reservedWidth = 400 + (hasSelectedNode ? 400 : 0)
|
|
return Math.max(400, workflowCanvasWidth - reservedWidth)
|
|
}
|