Conversation
将客户端坐标转换为画布坐标,避免容器偏移导致的连线位置错误 Fixes #7618
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求旨在解决 G6 图形库中 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
| const { model, element } = this.context; | ||
| model.translateNodeTo(ASSIST_NODE_ID, [event.client.x, event.client.y]); | ||
| const { graph, model, element } = this.context; | ||
| // 将客户端坐标转换为画布坐标,避免容器偏移导致的连线位置错误 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v5 #7622 +/- ##
=======================================
Coverage 94.95% 94.95%
=======================================
Files 188 188
Lines 10014 10015 +1
Branches 2171 2171
=======================================
+ Hits 9509 9510 +1
+ Misses 505 467 -38
- Partials 0 38 +38
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Duplicate with #7609 |
修复 Issue #7618
问题描述
create-edge 时连接线发生偏移,不跟随鼠标,但连接节点后连接线正常。
修复方案
将客户端坐标转换为画布坐标,避免容器偏移导致的连线位置错误。
修改内容
packages/g6/src/behaviors/create-edge.ts中的updateAssistEdge方法graph.getCanvasByClient()将浏览器客户端坐标转换为画布坐标测试
该修复已针对 issue #7618 中描述的场景进行测试,当容器有 margin/padding 或非全屏时,连线能正确跟随鼠标。
Closes #7618