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

fix: 增加单元格单双击的判断范围 #2924

Merged
merged 1 commit into from
Oct 22, 2024
Merged

Conversation

lijinke666
Copy link
Member

👀 PR includes

🐛 Bugfix

  • Solve the issue and close #0

📝 Description

🖼️ Screenshot

Before After

🔗 Related issue link

🔍 Self-Check before the merge

  • Add or update relevant docs.
  • Add or update relevant demos.
  • Add or update test case.
  • Add or update relevant TypeScript definitions.

Copy link

vercel bot commented Oct 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
antvis-s2 ❌ Failed (Inspect) Oct 14, 2024 8:03am

@github-actions github-actions bot added next 2.0-next 版本的问题 pr(fix) bug fix labels Oct 14, 2024
@@ -545,7 +545,11 @@ export class EventController {
}

// 双击的 detail 是 2
if (event.detail === 2) {
if (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里只是增加容错

Copy link
Contributor

Size Change: +53 B (+0.02%)

Total Size: 330 kB

Filename Size Change
./packages/s2-core/dist/index.min.js 229 kB +53 B (+0.02%)
ℹ️ View Unchanged
Filename Size
./packages/s2-core/dist/style.min.css 388 B
./packages/s2-react/dist/index.min.js 70.9 kB
./packages/s2-react/dist/style.min.css 3.88 kB
./packages/s2-vue/dist/index.min.js 22.9 kB
./packages/s2-vue/dist/style.min.css 1.97 kB

compressed-size-action

@@ -55,7 +55,11 @@ export class DataCellClick extends BaseEvent implements BaseEventImplement {

if (interaction.isSelectedCell(cell)) {
// https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/detail,使用 detail 属性来判断是否是双击,双击时不触发选择态 reset
if ((event.originalEvent as UIEvent)?.detail === 1) {
if (
Copy link
Member Author

@lijinke666 lijinke666 Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的逻辑是, 单击单元格时, 如果已经是选中状态, 则取消选中

但目前 G 有 bug, 只有在 click 事件时, 才会在模拟的 FederatedPointerEvent 增加 detail 属性

https://g.antv.antgroup.com/api/event/event-object#detail

Copy link
Contributor

你好, @lijinke666 CI 执行失败, 请点击 [Details] 按钮查看, 并根据日志修复。

Hello, @lijinke666 CI run failed, please click the [Details] button for detailed log information and fix it.

@github-actions github-actions bot added the 🚨 test failed 单元测试挂了 label Oct 14, 2024
@@ -347,6 +347,7 @@ export const s2Options: SheetComponentOptions = {
transformCanvasConfig() {
return {
supportsCSSTransform: true,
supportsPointerEvents: false,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原生的 PointerEvent 没有 detail 属性, 只有 MouseEvent 才有, 上层先这样规避下, 对应上面 (event.nativeEvent)

@github-actions github-actions bot removed the 🚨 test failed 单元测试挂了 label Oct 15, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.83%. Comparing base (ecdc9c8) to head (30999c4).
Report is 450 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2924      +/-   ##
==========================================
+ Coverage   75.77%   80.83%   +5.06%     
==========================================
  Files         257      180      -77     
  Lines       11994    10426    -1568     
  Branches     2464     2363     -101     
==========================================
- Hits         9088     8428     -660     
+ Misses       1398      554     -844     
+ Partials     1508     1444      -64     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@lijinke666 lijinke666 merged commit c40bbf9 into next Oct 22, 2024
12 of 13 checks passed
@lijinke666 lijinke666 deleted the fix-reset-data-cell branch October 22, 2024 06:15
@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-v2.0.0-next.30 🎉

The release is available on:

Your semantic-release bot 📦🚀

@lijinke666
Copy link
Member Author

🎉 This PR is included in version @antv/s2-react-v2.0.0-next.29 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next 2.0-next 版本的问题 pr(fix) bug fix released on @next
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants