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(tabs): supports scrolling operations via wheel or touchpad #4222

Merged
merged 4 commits into from
Jun 5, 2024

Conversation

oljc
Copy link
Contributor

@oljc oljc commented May 27, 2024

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

支持通过滚轮或者触摸板操作

详情见 #498

💡 需求背景和解决方案

优化逻辑提高性能:

  1. 原来箭头显示在每次变化时都需要 getRefs 、calculateCanToLeft 获取 Dom 的一系列复杂计算,现改为对最大/最小偏移零界点对比。
  2. 原来 resize 和 当前 tab 滚动到可视位置都需要独立计算且过于复杂,现改为统一由 calculateOffset 函数控制,只要调用就得到各状态下应滚动的偏移量。

⚠️ 考虑到变更太多,预留了 scrollPosition 滚动位置 Props 参数
⚠️ 对于用户而言无破坏性更新
滚轮触摸板:

iShot_2024-05-27-.mp4

滚动位置例 (center):

iShot_2024-05-27_18.52.32.mp4

📝 更新日志

  • feat(tabs): 支持通过滚轮或者触摸板进行滚动操作

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

Copy link
Contributor

github-actions bot commented May 27, 2024

完成

@HaixingOoO
Copy link
Contributor

看了一下,有点小问题,就是滚动的那个官网示例,你选择选项卡19点击下一个滑块,也就是一整个的切换的,他下一个显示的内容他会过掉选项卡20直接显示选项卡21了,優化一下才行

QQ2024528-94954-HD.mp4

@uyarn uyarn merged commit 26e43cc into Tencent:develop Jun 5, 2024
6 checks passed
@github-actions github-actions bot mentioned this pull request Jun 6, 2024
16 tasks
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.

3 participants