feat:ignore click event when map drag or zoom#2789
Merged
fuzhenn merged 3 commits intomaptalks:masterfrom Jan 26, 2026
Merged
Conversation
fuzhenn
requested changes
Jan 21, 2026
| const downTime = this._mouseDownTime; | ||
| delete this._mouseDownTime; | ||
| const time = now(); | ||
| if (time - downTime > clickTimeThreshold) { |
Member
There was a problem hiding this comment.
现在是通过 click 与 mousedown 的间隔时间来过滤click事件的,但 mapViewEqual 判断确实更科学,我建议改用 mapViewEqual:
用 mapViewEqual 替换这里的 clickTimeThreshold 判断去掉 map.options.clickTimeThreshold 定义去掉 this._mouseDownTime 相关的逻辑- 在这里增加mapViewEqual的判断
Member
There was a problem hiding this comment.
更正一下:去掉clickTimeThreadhold判断不妥,和mapViewEqual的判断都加上更好一些。
Member
|
还是应该恢复原有的 click 与 mousedown 间隔时间判断,否则长按操作也会产生click事件 |
Collaborator
Author
已经恢复到第一次提交 |
fuzhenn
approved these changes
Jan 26, 2026
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.
fix #1980