From 9ddae7423e09722cc426d8932cbdc3dcf4533b21 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 23 May 2026 14:35:41 +0800 Subject: [PATCH] fix: render local edit prompts outside scaled image layer --- components/canvas/nodes/ImageNode.tsx | 49 +++++++++++++++++++++------ 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/components/canvas/nodes/ImageNode.tsx b/components/canvas/nodes/ImageNode.tsx index ac453e2bc..82abc3303 100644 --- a/components/canvas/nodes/ImageNode.tsx +++ b/components/canvas/nodes/ImageNode.tsx @@ -2057,6 +2057,8 @@ export function ImageNode({ // 文件输入的 ref const fileInputRef = useRef(null); const containerRef = useRef(null); + const [localEditPromptLayerElement, setLocalEditPromptLayerElement] = + useState(null); const displayImageRef = useRef(null); const compareFrameRef = useRef(null); const cropOverlayRef = useRef(null); @@ -2477,6 +2479,20 @@ export function ImageNode({ localEditMode, localEditRegionOverlays, ]); + const localEditPromptViewportOverlays = useMemo( + () => + localEditPromptInlineOverlays.map(({ region, isEditing, style }) => ({ + region, + isEditing, + style: { + ...style, + left: Number(style.left || 0) * nodeContentScale, + top: Number(style.top || 0) * nodeContentScale, + width: Number(style.width || 0) * nodeContentScale, + } satisfies React.CSSProperties, + })), + [localEditPromptInlineOverlays, nodeContentScale] + ); const currentPickerClickStyle = useMemo(() => { if (!boxCutoutMetrics || !currentClick) return null; @@ -8131,7 +8147,10 @@ export function ImageNode({ ); })} - {localEditPromptInlineOverlays.map(({ region, isEditing, style }) => ( + {localEditPromptLayerElement + ? createPortal( + localEditPromptViewportOverlays.map( + ({ region, isEditing, style }) => (
) : null}
- ))} + ) + ), + localEditPromptLayerElement + ) + : null} {localEditDraftRectStyle ? (
{imageNoteItem.label}
- )} - {shortAgentExecutionSnapshotId ? ( - - ) : null} - - - + ) : null} + +
+
+