From c5f37a374ac98489cada121e8ac10b0a4b0b0b72 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 29 Dec 2025 16:51:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E5=BC=B9=E7=AA=97=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=9A=E5=B1=85=E4=B8=AD=E6=98=BE=E7=A4=BA=E3=80=81?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E8=83=8C=E6=99=AF=E6=A8=A1=E7=B3=8A=E3=80=81?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E7=BC=96=E8=BE=91=E5=99=A8=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E3=80=81=E5=9B=BE=E7=89=87=E8=87=AA=E5=8A=A8=E7=BC=A9=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/image-annotator.tsx | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/components/image-annotator.tsx b/components/image-annotator.tsx index 1b6380742..6e14a9d21 100644 --- a/components/image-annotator.tsx +++ b/components/image-annotator.tsx @@ -84,7 +84,7 @@ export function ImageAnnotator({ imageUrl, onConfirm, onCancel }: ImageAnnotator img.src = imageUrl; }, [imageUrl]); - // 初始化 canvas - 适配弹窗大小 + // 初始化 canvas - 适配弹窗大小,固定编辑器大小,图片缩小显示 useEffect(() => { if (!canvasRef.current || !image || !containerRef.current) return; @@ -93,12 +93,13 @@ export function ImageAnnotator({ imageUrl, onConfirm, onCancel }: ImageAnnotator const context = canvas.getContext("2d"); if (!context) return; - // 弹窗内画布区域大小(减去工具栏和边距,考虑并排显示) + // 固定弹窗内画布区域大小(减去工具栏和边距,考虑并排显示) + // 弹窗固定为 1200px x 550px,画布区域约为 1100px x 350px(单图)或 550px x 350px(双图) const containerWidth = processedImageBase64 ? 550 : 1100; // 如果有处理后图片,每个区域550px;否则1100px - const containerHeight = 350; // 550 - 工具栏高度 + const containerHeight = 350; // 550 - 工具栏高度(约200px) const scaleX = containerWidth / image.width; const scaleY = containerHeight / image.height; - const newScale = Math.min(scaleX, scaleY, 1); // 不放大,只缩小 + const newScale = Math.min(scaleX, scaleY, 1); // 不放大,只缩小以适应固定容器 setScale(newScale); @@ -563,11 +564,16 @@ export function ImageAnnotator({ imageUrl, onConfirm, onCancel }: ImageAnnotator }; return ( -
- {/* 弹窗容器 */} +
+ {/* 弹窗容器 - 固定在屏幕中央,固定大小 */}
e.stopPropagation()} > {/* 顶部标题栏 */} @@ -774,7 +780,7 @@ export function ImageAnnotator({ imageUrl, onConfirm, onCancel }: ImageAnnotator {/* 文字输入弹窗 */} {textPosition && ( -
setTextPosition(null)}> +
setTextPosition(null)}>
e.stopPropagation()}>
输入标注文字