G6 icon indicating copy to clipboard operation
G6 copied to clipboard

记录节点位置和缩放比例再次渲染

Open AF-Klara opened this issue 2 years ago • 3 comments

问题描述

我想记录一份节点的x、y位置和画布的缩放比比例,当我再次进来时展示我上一次的操作后的状态, 但我发现当缩放和平移画布是会导致出现不可控的偏移,无法正确的复原之前的操作

重现链接

https://codesandbox.io/s/damp-sky-3cnryw?file=/src/App.vue

重现步骤

  1. 拖动节点时 初始状态 image 只拖动节点 image 点击记录 点击复原(展示符合预期)

  2. 拖动节点与缩放画布 image 点击记录 点击复原(位置偏移) image

预期行为

节点/节点和画布同时进行操作时,点击复原能还原记录时的状态

平台

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

屏幕截图或视频(可选)

https://github.com/antvis/G6/assets/74236806/4c4a28ab-09e2-4579-8f7c-5835b4c8574a

补充说明(可选)

对数据进行排列组合

AF-Klara avatar Nov 09 '23 07:11 AF-Klara

Hi @AF-Klara, Please star this repo if you find it useful! Thanks :star:! 你好 @AF-Klara。如果该仓库对你有用,可以 star 一下,感谢你的 :star:!

github-actions[bot] avatar Nov 09 '23 07:11 github-actions[bot]

通过矩阵matrix来实现吧 https://codesandbox.io/p/sandbox/upbeat-marco-sp9xvx?file=%2Fsrc%2FApp.vue

GemT27 avatar Nov 29 '23 16:11 GemT27

画布缩放和平移画布可以通过matrix记录复位;节点位置你则需要监听node:drag事件保存相对应的节点位置吧

GemT27 avatar Nov 29 '23 16:11 GemT27

This issue has been closed because it has been outdate for a long time. Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了。 如果你仍然需要帮助,请创建一个新的 issue。

github-actions[bot] avatar Jul 05 '24 05:07 github-actions[bot]