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

feat: add dblClickSpeed init config (#1710) #1736

Merged
merged 3 commits into from
Jul 19, 2024
Merged

Conversation

wang1212
Copy link
Contributor

@wang1212 wang1212 commented Jul 18, 2024

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / Document optimization
  • TypeScript definition update
  • Refactoring
  • Performance improvement
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

Previously, double-click detection was implemented internally with a hard-coded 200ms threshold.

Now, users are allowed to configure a dblClickSpeed initialization parameter to customize the speed of determining whether two consecutive clicks trigger a double-click event:

const canvas = new Canvas({
    // ...
    // allows to set to a custom value, default is 200 (ms)
    dblClickSpeed: 500
});

Please refer to the documentation for double click events: https://g-next.antv.vision/api/event/faq#%E9%BC%A0%E6%A0%87%E5%8F%8C%E5%87%BB%E4%BA%8B%E4%BB%B6

📝 Changelog

Language Changelog
🇺🇸 English add dblClickSpeed init config (#1710)
🇨🇳 Chinese 添加 dblClickSpeed 初始化配置 (#1710)

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@@ -0,0 +1,79 @@
import { Circle, Group, Text } from '../../../packages/g';

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused import Group.
@hustcc
Copy link
Member

hustcc commented Jul 18, 2024

为什么不直接一个 doubleClickDelay 变量?

@wang1212 wang1212 reopened this Jul 19, 2024
@wang1212
Copy link
Contributor Author

为什么不直接一个 doubleClickDelay 变量?

代码已经过重构,确保和现有的 apis 设计风格一致,暴露 dblClickSpeed 初始化参数变量,对于运行时修改场景暂未有相关需求,不做过度设计。

参数配置的命名参考了 chart.js 项目:https://www.chartjs.org/chartjs-plugin-annotation/1.0.2/guide/interaction.html#configuration

@wang1212 wang1212 changed the title feat: add isDblclickAction init config (#1710) feat: add dblClickSpeed init config (#1710) Jul 19, 2024
@hustcc hustcc merged commit 7c68899 into antvis:next Jul 19, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

G 能否开放参数, 来自定义双击的判定时机, 目前是写死的 200 ms
2 participants