From 682c589238edf9c52b92d9318c5db3ade36aaf9f Mon Sep 17 00:00:00 2001 From: zcr Date: Sat, 24 Jan 2026 02:44:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Ddesign=20merge=20?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=20,=E6=97=8B=E8=BD=ACsketch=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E8=AE=A1=E7=AE=97=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/design_fast/utils/synthesis_item.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/service/design_fast/utils/synthesis_item.py b/app/service/design_fast/utils/synthesis_item.py index ff44157..8b7e55e 100644 --- a/app/service/design_fast/utils/synthesis_item.py +++ b/app/service/design_fast/utils/synthesis_item.py @@ -347,7 +347,8 @@ def transpose_rotate(layer, image): rotate = layer.get('rotate', 0) paste_x, paste_y = layer['adaptive_position'][1], layer['adaptive_position'][0] - + original_w = image.width + original_h = image.height # transpose左右是1 上下是-1 if transpose[0] != 1: # 左右 @@ -361,8 +362,8 @@ def transpose_rotate(layer, image): image = image.rotate(-rotate, expand=True) # 4. 计算粘贴位置以保持视觉中心一致 # 原本 (15, 36) 是 288*288 的左上角,我们计算其中心点 - target_center_x = 15 + 288 // 2 - target_center_y = 36 + 288 // 2 + target_center_x = paste_x + original_w // 2 + target_center_y = paste_y + original_h // 2 # 获取旋转后图像的新尺寸 new_w, new_h = image.size