Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request moves the registration of the wheel event listener for the context menu from the initialization phase to the bindEvents method, which prevents wheel events from bubbling up and triggering canvas zoom logic. A review comment identifies a potential issue where the context menu might close unexpectedly when users interact with internal elements like scrollbars, suggesting an improvement to the click handling logic to ensure better usability.
|
|
||
| document.addEventListener('click', this.onMenuItemClick); | ||
| // 阻止滚轮事件冒泡,防止触发画布的 zoom-canvas 拦截逻辑 | ||
| this.$element.addEventListener('wheel', this.wheelHandler); |
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v5 #7638 +/- ##
=======================================
Coverage 94.95% 94.95%
=======================================
Files 188 188
Lines 10031 10031
Branches 2171 2171
=======================================
Hits 9525 9525
Misses 468 468
Partials 38 38
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复Contextmenu无法滚动的问题
Graph 初始化时,Contextmenu 的这三个函数触发顺序是这样的
initElement()->unbindEvents()->bindEvents(),导致wheelHandler添加后接着被移除将
addEventListener从initElement中移动到bindEvents即可解决