From 827a1b181b5d5c475643bc1b2b38ee9b31abdf03 Mon Sep 17 00:00:00 2001 From: hjlarry Date: Sat, 4 Oct 2025 13:25:59 +0800 Subject: [PATCH] fix comment icon position --- .../components/workflow/hooks/use-workflow-comment.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/app/components/workflow/hooks/use-workflow-comment.ts b/web/app/components/workflow/hooks/use-workflow-comment.ts index 73c8e9e947..2eb6ca0d90 100644 --- a/web/app/components/workflow/hooks/use-workflow-comment.ts +++ b/web/app/components/workflow/hooks/use-workflow-comment.ts @@ -133,7 +133,15 @@ export const useWorkflowComment = () => { const cachedDetail = commentDetailCacheRef.current[comment.id] setActiveComment(cachedDetail || comment) - reactflow.setCenter(comment.position_x, comment.position_y, { zoom: 1, duration: 600 }) + let horizontalOffsetPx = 220 + const maxOffset = Math.max(0, (window.innerWidth / 2) - 60) + horizontalOffsetPx = Math.min(horizontalOffsetPx, maxOffset) + + reactflow.setCenter( + comment.position_x + horizontalOffsetPx, + comment.position_y, + { zoom: 1, duration: 600 }, + ) if (!appId) return