antvis / antvis/G6

[Bug]: Event trigger issues for zoom-canvas

Open
#6,841 3 comments 0 reactions 0 assignees View on GitHub
waiting for maintainer
Dominant language
TypeScript
Stars
12.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug / 问题描述

not sure if it only involve `zoom-canvas` behavior, when the left mouse button is pressed and dragged across the canvas , then zoom-canvas not worked any more
---
用下面的配置,用鼠标左键在canvas 上画一下,然后zoom-canvas就不能被触发了
```
behaviors: [
{
type: 'scroll-canvas',
enable: (event) => {
console.log('scroll', !event.ctrlKey&&!event.metaKey);
return !event.ctrlKey && !event.metaKey;
},
preventDefault: true,
},
{
type: 'drag-canvas',
enable: (event) => event.buttons === 4,
},
{
type: 'zoom-canvas',
enable: (event) => {
console.log('zoom',event.ctrlKey || event.metaKey);
return event.ctrlKey || event.metaKey;
},
preventDefault: true,
},
],
```

### Reproduction link / 复现链接

_No response_

### Steps to Reproduce the Bug or Issue / 重现步骤

https://github.com/user-attachments/assets/6e262af6-9a59-486e-96bc-51c6eaa27ca6

https://www.loom.com/share/aef43b948f0f4ed9855be2332257095e?sid=c03dcc64-c16f-47b0-8050-248671101d65

### Version / 版本

🆕 5.x

### OS / 操作系统

- [x] macOS
- [ ] Windows
- [ ] Linux
- [ ] Others / 其他

### Browser / 浏览器

- [x] Chrome
- [ ] Edge
- [ ] Firefox
- [ ] Safari (Limited support / 有限支持)
- [ ] IE (Nonsupport / 不支持)
- [ ] Others / 其他

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the macOS/Chrome sequence using the listed scroll-canvas, drag-canvas, and zoom-canvas configuration: drag with the left button, then try zooming with Ctrl or Meta. Trace the zoom-canvas enable condition and event state after the drag; done means zoom-canvas triggers again without breaking the other behaviors, with a regression test for the sequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.