dify/web/app/components/workflow/panel/panel-width.ts
Joel a233b2f53a
fix: make panel and node resizing keyboard accessible (#41963)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
2026-09-08 07:44:41 +00:00

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)
}