Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 导入某些 svg 时,画布上展示出的图元变形 #259

Open
Dovahkinn opened this issue Oct 28, 2024 · 0 comments
Open

[Bug]: 导入某些 svg 时,画布上展示出的图元变形 #259

Dovahkinn opened this issue Oct 28, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Dovahkinn
Copy link

Code Sanbox异常重现

No response

bug描述

简述

  1. svg 文件:
<svg id="a1009a0a-5a0d-4994-a0ed-caea9dc64705" data-name="图层 1" xmlns="http://www.w3.org/2000/svg"
    viewBox="0 0 13.22 13.22">
    <title>未标题-1</title>
    <path
        d="M 0.49,7 A 6.46,6.46,0,0,1,1,4.47,6.59,6.59,0,0,1,4.47,1,6.53,6.53,0,0,1,9.53,1,6.59,6.59,0,0,1,13,4.47a6.53,6.53,0,0,1,0,5.06 A 6.59,6.59,0,0,1,9.53,13a6.53,6.53,0,0,1-5.06,0 A 6.59,6.59,0,0,1,1,9.53,6.46,6.46,0,0,1, 0.49,7 Z"
        transform="translate(-0.39, -0.39)"
        style="fill:none;stroke:#000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.2px" />
</svg>
  1. 控制台等效操作:
const pen = {
  name: "svgPath",
  x: 0,
  y: 0,
  width: 100,
  height: 100,
  path: "M 0.49,7 A 6.46,6.46,0,0,1,1,4.47,6.59,6.59,0,0,1,4.47,1,6.53,6.53,0,0,1,9.53,1,6.59,6.59,0,0,1,13,4.47a6.53,6.53,0,0,1,0,5.06 A 6.59,6.59,0,0,1,9.53,13a6.53,6.53,0,0,1-5.06,0 A 6.59,6.59,0,0,1,1,9.53,6.46,6.46,0,0,1, 0.49,7 Z",
};
meta2d.addPen(pen);
  1. svg 实际效果:
    image

  2. 画布中效果:
    screenshot-20241028-203617

初步分析

image
scalePath 计算时,x, y 值不一致,导致变形;
计算时取 x, y 中的最大值,是否可行?

期待效果

保持正常比例

发生频率

每次

核心库版本

1.0.62

浏览器版本

Chrome 130

其他需要补充的

麻烦确认一下
scalePath 计算时,x, y 值不一致,导致变形; 计算时取 x, y 中的最大值,是否可行?

@Dovahkinn Dovahkinn added the bug Something isn't working label Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant