fix: 修正canvas初始化逻辑,正确处理处理后图片的显示

This commit is contained in:
Your Name 2025-12-29 07:39:47 +08:00
parent 9719570897
commit b8381c6160

View File

@ -92,8 +92,8 @@ export function ImageAnnotator({ imageUrl, onConfirm, onCancel }: ImageAnnotator
const context = canvas.getContext("2d");
if (!context) return;
// 弹窗内画布区域大小(减去工具栏和边距)
const containerWidth = 800; // 850 - padding
// 弹窗内画布区域大小(减去工具栏和边距,考虑并排显示)
const containerWidth = processedImageBase64 ? 550 : 1100; // 如果有处理后图片,每个区域550px;否则1100px
const containerHeight = 350; // 550 - 工具栏高度
const scaleX = containerWidth / image.width;
const scaleY = containerHeight / image.height;