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

使用ref的属性值未按照相对元素进行处理,如refWidth、refCx、refD等等 #4134

Open
cuidong626 opened this issue Jan 4, 2024 · 9 comments
Labels
resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems

Comments

@cuidong626
Copy link
Contributor

cuidong626 commented Jan 4, 2024

问题描述

官方文档上面描述,坐标原点会参考ref的坐标原点,但是我实际使用的时候发现并没有达到预期目标。
image
查看源码(没看懂)后,增加如下代码达到预期,是我理解的有问题还是我使用的有问题?
image

重现链接

重现链接

重现步骤

预期行为

按照ref的坐标原点偏移

平台

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

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@NewByVector
Copy link
Contributor

有没有对应的 demo 看下?

@NewByVector NewByVector added the resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems label Jan 9, 2024
@cuidong626
Copy link
Contributor Author

有没有对应的 demo 看下?

https://codesandbox.io/p/sandbox/long-butterfly-3yy3dl?file=%2Findex.ts%3A58%2C5

image
path1、path2的refD值是一样的,但是一个ref是circle1,另一个是circle2.
为什么渲染的时候会重叠到一起

@cuidong626
Copy link
Contributor Author

应该不管是不是resetOffset都应该偏移,看代码没有做相对处理

@cuidong626
Copy link
Contributor Author

polygon 也是这个问题

@cuidong626
Copy link
Contributor Author

我的理解,圆的坐标应该也是相对ref的 但是感觉也是有问题的
image

@cuidong626
Copy link
Contributor Author

cx、cy 我改成用 positionWrapper的方式进行计算了
image

@cuidong626
Copy link
Contributor Author

refWidth2,refHeight2
并不是10% - 2
image

@cuidong626
Copy link
Contributor Author

看逻辑时进行了覆盖操作。 position的进行了translate,所以一直在累加。
很奇怪之前为啥没发现
image

@cuidong626 cuidong626 changed the title 关于refDResetOffset的疑问 使用ref的属性值未按照相对元素进行处理,如refWidth、refCx、refD等等 Jan 12, 2024
@li-guanlong
Copy link

@NewByVector

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: needs demos 需要复现 Issues that need minimal demos to reproduce any problems
Projects
None yet
Development

No branches or pull requests

3 participants