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

通过点击一个按钮手动添加节点时,若节点角度为90度,节点在画布出现的位置不对 #1906

Closed
Trojanpa opened this issue Mar 18, 2022 · 11 comments
Assignees
Labels
type: bug 缺陷 Defects and unexpected behaviors

Comments

@Trojanpa
Copy link

Trojanpa commented Mar 18, 2022

问题描述

在一个角度为90度的节点的 上/下/左/右 方向通过按钮添加节点时,添加后的节点出现在画布中的的位置不对,添加的这个节点的坐标是对的,但与其他相同x或相同y坐标的节点位置不对。(其他角度我没有试过,不排除可能也存在这个问题)

重现链接

https://codesandbox.io/s/xuan-zhuan-hou-tian-jia-jie-dian-de-bug-j9is51?file=/src/App.vue

重现步骤

选中一个旋转90度的节点,点击 “在节点上/下/左/右方添加节点” 按钮,观察添加后的节点位置,对比计算基准节点和添加后的节点的坐标信息。

预期行为

期望修复添加节点后出现在画布中的位置能够准确。

平台

  • 操作系统: [Windows.]
  • 网页浏览器: [Google Chrome, Safari, Firefox]
  • X6 版本: [1.30.2 ... ]

屏幕截图或视频(可选)

注意观察:x坐标相同,节点所处画布位置不同,y.....

bug

补充说明(可选)

No response

@NewByVector NewByVector added the type: bug 缺陷 Defects and unexpected behaviors label Mar 24, 2022
@NewByVector NewByVector self-assigned this Apr 21, 2022
@NewByVector
Copy link
Contributor

x6 的坐标是节点左上角的坐标,而不是中心点坐标,你的计算方式有问题。

@Trojanpa
Copy link
Author

x6 的坐标是节点左上角的坐标,而不是中心点坐标,你的计算方式有问题。

我用的就是节点左上角的坐标呀

@Trojanpa
Copy link
Author

x6 的坐标是节点左上角的坐标,而不是中心点坐标,你的计算方式有问题。
screenshots

@NewByVector
Copy link
Contributor

比如你中间那个图片,它的 position 是 { x: 100, y: 100 },旋转 90 度以后,它的 position 任然为 { x: 100, y: 100 },所以你的这段代码就有问题了。
image

@Trojanpa
Copy link
Author

比如你中间那个图片,它的 position 是 { x: 100, y: 100 },旋转 90 度以后,它的 position 任然为 { x: 100, y: 100 },所以你的这段代码就有问题了。 image

节点旋转后的坐标不变我是知道的。是不是我遗漏了什么,这种情况该怎么计算新节点的位置?

@NewByVector
Copy link
Contributor

@Trojanpa 我理解可以通过中心点来计算,不管怎么旋转,中心点坐标是不变的。

@Trojanpa
Copy link
Author

Trojanpa commented Feb 2, 2023

@Trojanpa 我理解可以通过中心点来计算,不管怎么旋转,中心点坐标是不变的。

不对,不是坐标的问题,坐标是对的,是渲染的位置不对。注意下图看左边两个节点的坐标,它们的x坐标是一样的,都是100,但两个节点左侧位置并不对齐。正常情况下,x相等的话是左侧对齐的,像下图右面那样。
screenshots

@NewByVector
Copy link
Contributor

NewByVector commented Feb 3, 2023

@Trojanpa 左上角坐标已经不是 x 坐标了呀。

@Trojanpa
Copy link
Author

Trojanpa commented Feb 3, 2023

@Trojanpa 左上角坐标已经不是 x 坐标了呀。

意思是旋转后节点的坐标不再是左上角了?感觉有点乱

@JoeWrights
Copy link

@Trojanpa 左上角坐标已经不是 x 坐标了呀。

意思是旋转后节点的坐标不再是左上角了?感觉有点乱

我也遇到这个问题了,旋转后,左上角的坐标是不会转换的,依然是旋转前的坐标

@x6-bot
Copy link
Contributor

x6-bot bot commented Jun 27, 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 Jun 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug 缺陷 Defects and unexpected behaviors
Projects
None yet
Development

No branches or pull requests

3 participants