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

Path 画圆弧, 属性d 改为refD后,图形变形 #3909

Closed
light-years-run opened this issue Sep 13, 2023 · 6 comments
Closed

Path 画圆弧, 属性d 改为refD后,图形变形 #3909

light-years-run opened this issue Sep 13, 2023 · 6 comments
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions

Comments

@light-years-run
Copy link

light-years-run commented Sep 13, 2023

问题描述

用画弧度方式绘制了一个圆,d属性可以正常显示,修改为refD后,变形
只有在大角度的时候才有此问题,比如超过180度,小角度,锐角的时候没有问题
d属性时
image
refD 时:
image

重现链接

代码如下

重现步骤

import { Graph } from '@antv/x6'

const graph = new Graph({
container: document.getElementById('container'),
grid: true,
})

graph.addNode({
shape: 'path',
x: 0,
y: 0,
width: 541.82,
height: 541.82,
label: 'path',
attrs: {
body: {
fill: '#efdbff',
stroke: '#9254de',
// 指定 refD 属性,pathData 随图形大小自动缩放
// https://x6.antv.vision/zh/docs/api/registry/attr#refdresetoffset

 d: 'M517.73,241.31 L703.9,438.12 A270.91 270.91 0 1 1 732.73,406.14Z',
 //refD:'M517.73,241.31 L703.9,438.12 A270.91 270.91 0 1 1 732.73,406.14Z',
},

},
})

预期行为

希望refD和 d一致

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox ...]
  • X6 版本: [2.11.1 ...]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@NewByVector
Copy link
Contributor

refD 是相对的 d,和 d 本身就不是一致的。

@NewByVector NewByVector added the type: discussion 讨论 Usage questions, guidance, and other discussions label Sep 19, 2023
@light-years-run
Copy link
Author

refD 是相对的 d,和 d 本身就不是一致的。

是的refD是相对的d,但是从官网给的例子和文档看,当refD和d路径点一致时,refD成图效果和d是一致的,只是d不会跟随图形缩放,refD可以,按照您的回复,refD难道和d成图效果会有偏差吗?那我用refD改怎么绘制出一个半椭圆呢?

@light-years-run
Copy link
Author

refD 是相对的 d,和 d 本身就不是一致的。

我用的是 path中的 A绘制的椭圆,是否是因为 X6将A转成了C造成的呢?

@NewByVector
Copy link
Contributor

NewByVector commented Sep 20, 2023

X6 中 path 对 A 支持不太好,可以使用下面方式规避:

// M517.73,241.31 L703.9,438.12 A270.91 270.91 0 1 1 732.73,406.14Z
const d = new Path()
  .moveTo(517.73, 241.31)
  .lineTo(703.9, 438.12)
  .arcTo(270.91, 270.91, 0, 0, 1, 732.73, 406.14)
  .close()
  .serialize();

@light-years-run
Copy link
Author

X6 中 path 对 A 支持不太好,可以使用下面方式规避:

// M517.73,241.31 L703.9,438.12 A270.91 270.91 0 1 1 732.73,406.14Z
const d = new Path()
  .moveTo(517.73, 241.31)
  .lineTo(703.9, 438.12)
  .arcTo(270.91, 270.91, 0, 0, 1, 732.73, 406.14)
  .close()
  .serialize();

非常好用,感谢

@x6-bot
Copy link
Contributor

x6-bot bot commented Sep 22, 2024

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Sep 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions
Projects
None yet
Development

No branches or pull requests

2 participants