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

V5 translateTo is wrong when zoom is not equal to 1 #6373

Open
hh1412 opened this issue Sep 30, 2024 · 2 comments
Open

V5 translateTo is wrong when zoom is not equal to 1 #6373

hh1412 opened this issue Sep 30, 2024 · 2 comments

Comments

@hh1412
Copy link

hh1412 commented Sep 30, 2024

Describe the bug / 问题描述

当我知道图的位置和缩放状态1 我拖拽图改变位置到状态2 当我想使用translateTo回复到状态1时 位置不对 当zoom=1时 位置回复是正常的 也就是说当 zoom不等于1时 调用translateTo 图的位置不对

translateTo.bug.mp4

Reproduction link / 重现链接

No response

Steps to Reproduce the Bug or Issue / 重现步骤

graph.zoomTo(0.5)
let a = graph.getPosition()
拖拽到另一个位置
let b = graph.getPosition()
graph.translateTo(a)
位置不对
https://github.com/user-attachments/assets/9025bf95-f025-42d9-9c53-6c8613f2b549

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome

Additional context / 补充说明

No response

@github-actions github-actions bot changed the title V5 translateTo 当zoom不等于1时 位置错误 V5 translateTo is wrong when zoom is not equal to 1 Sep 30, 2024
@Aarebecca
Copy link
Contributor

graph 位置和元素位置不是一回事,如果你是想将画布中心移动到某个元素上,直接调用 focusElement 即可

@hh1412
Copy link
Author

hh1412 commented Sep 30, 2024

graph 位置和元素位置不是一回事,如果你想将收购中心移动到某个元素上,直接调用focusElement即可

不是 focusElement满足不了 我是想拖拽了graph 然后再复原回上一步的位置

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants