fix: 修复design merge 模式 ,旋转sketch位置计算错误
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
This commit is contained in:
@@ -347,7 +347,8 @@ def transpose_rotate(layer, image):
|
|||||||
|
|
||||||
rotate = layer.get('rotate', 0)
|
rotate = layer.get('rotate', 0)
|
||||||
paste_x, paste_y = layer['adaptive_position'][1], layer['adaptive_position'][0]
|
paste_x, paste_y = layer['adaptive_position'][1], layer['adaptive_position'][0]
|
||||||
|
original_w = image.width
|
||||||
|
original_h = image.height
|
||||||
# transpose左右是1 上下是-1
|
# transpose左右是1 上下是-1
|
||||||
if transpose[0] != 1:
|
if transpose[0] != 1:
|
||||||
# 左右
|
# 左右
|
||||||
@@ -361,8 +362,8 @@ def transpose_rotate(layer, image):
|
|||||||
image = image.rotate(-rotate, expand=True)
|
image = image.rotate(-rotate, expand=True)
|
||||||
# 4. 计算粘贴位置以保持视觉中心一致
|
# 4. 计算粘贴位置以保持视觉中心一致
|
||||||
# 原本 (15, 36) 是 288*288 的左上角,我们计算其中心点
|
# 原本 (15, 36) 是 288*288 的左上角,我们计算其中心点
|
||||||
target_center_x = 15 + 288 // 2
|
target_center_x = paste_x + original_w // 2
|
||||||
target_center_y = 36 + 288 // 2
|
target_center_y = paste_y + original_h // 2
|
||||||
|
|
||||||
# 获取旋转后图像的新尺寸
|
# 获取旋转后图像的新尺寸
|
||||||
new_w, new_h = image.size
|
new_w, new_h = image.size
|
||||||
|
|||||||
Reference in New Issue
Block a user